Path: | lib/asciidoctor/document.rb |
Last Update: | Fri Jun 28 20:33:28 +0000 2013 |
Public: Initialize an Asciidoc object.
data - The Array of Strings holding the Asciidoc source document. (default: []) options - A Hash of options to control processing, such as setting the safe mode (:safe),
suppressing the header/footer (:header_footer) and attribute overrides (:attributes) (default: {})
block - A block that can be used to retrieve external Asciidoc
data to include in this document.
Examples
data = File.readlines(filename) doc = Asciidoctor::Document.new(data) puts doc.render
Internal: Apply substitutions to the attribute value
If the value is an inline passthrough macro (e.g., pass:[text]), then apply the substitutions defined on the macro to the text. Otherwise, apply the verbatim substitutions to the value.
value - The String attribute value on which to perform substitutions
Returns The String value with substitutions performed.
Public: Determine if the attribute has been locked by being assigned in document options
key - The attribute key to check
Returns true if the attribute is locked, false otherwise
Public: Read the docinfo file(s) for inclusion in the document template
If the docinfo1 attribute is set, read the docinfo.ext file. If the docinfo attribute is set, read the doc-name.docinfo.ext file. If the docinfo2 attribute is set, read both files in that order.
ext - The extension of the docinfo file(s). If not set, the extension
will be determined based on the basebackend. (default: nil)
returns The contents of the docinfo file(s)
Internal: Get the next value in the sequence.
Handles both integer and character sequences.
current - the value to increment as a String or Integer
returns the next value in the sequence according to the current value‘s type
Public: Render the Asciidoc document using the templates loaded by Renderer. If a :template_dir is not specified, or a template is missing, the renderer will fall back to using the appropriate built-in template.
Public: Convenience method to retrieve the document attribute ‘revdate‘
returns the date of last revision for the document as a String
Public: Set the specified attribute on the document if the name is not locked
If the attribute is locked, false is returned. Otherwise, the value is assigned to the attribute name after first performing attribute substitutions on the value. If the attribute name is ‘backend’, then the value of backend-related attributes are updated.
name - the String attribute name value - the String attribute value
returns true if the attribute was set, false if it was not set because it‘s locked