encoding: UTF-8
RUBY_ENGINE | = | ::RUBY_ENGINE | alias the RUBY_ENGINE constant inside the Asciidoctor namespace | |
ROOT_PATH | = | ::File.dirname ::File.dirname ::File.expand_path __FILE__ | The absolute root path of the Asciidoctor RubyGem | |
LIB_PATH | = | ::File.join ROOT_PATH, 'lib' | The absolute lib path of the Asciidoctor RubyGem | |
DATA_PATH | = | ::File.join ROOT_PATH, 'data' | The absolute data path of the Asciidoctor RubyGem | |
USER_HOME | = | ::Dir.home | ||
USER_HOME | = | ::ENV['HOME'] || ::Dir.pwd | ||
COERCE_ENCODING | = | !::RUBY_ENGINE_OPAL && ::RUBY_MIN_VERSION_1_9 | Flag to indicate whether encoding can be coerced to UTF-8 All input data must be force encoded to UTF-8 if Encoding.default_external is not UTF-8 Addresses failures performing string operations that are reported as "invalid byte sequence in US-ASCII" Ruby 1.8 doesn‘t seem to experience this problem (perhaps because it isn‘t validating the encodings) | |
FORCE_ENCODING | = | COERCE_ENCODING && ::Encoding.default_external != ::Encoding::UTF_8 | Flag to indicate whether encoding of external strings needs to be forced to UTF-8 | |
BOM_BYTES_UTF_8 | = | "\xef\xbb\xbf".bytes.to_a | Byte arrays for UTF-* Byte Order Marks hex escape sequence used for Ruby 1.8 compatibility | |
BOM_BYTES_UTF_16LE | = | "\xff\xfe".bytes.to_a | ||
BOM_BYTES_UTF_16BE | = | "\xfe\xff".bytes.to_a | ||
FORCE_UNICODE_LINE_LENGTH | = | !::RUBY_MIN_VERSION_1_9 | Flag to indicate that line length should be calculated using a unicode mode hint | |
SUPPORTS_GSUB_RESULT_HASH | = | ::RUBY_MIN_VERSION_1_9 && !::RUBY_ENGINE_OPAL | Flag to indicate whether gsub can use a Hash to map matches to replacements | |
EOL | = | "\n" | The endline character used for output; stored in constant table as an optimization | |
NULL | = | "\0" | The null character to use for splitting attribute values | |
TAB | = | "\t" | String for matching tab character | |
DEFAULT_DOCTYPE | = | 'article' | The default document type Can influence markup generated by the converters | |
DEFAULT_BACKEND | = | 'html5' | The backend determines the format of the converted output, default to html5 | |
DEFAULT_STYLESHEET_KEYS | = | ['', 'DEFAULT'].to_set | ||
DEFAULT_STYLESHEET_NAME | = | 'asciidoctor.css' | ||
BACKEND_ALIASES | = | { 'html' => 'html5', 'docbook' => 'docbook5' | Pointers to the preferred version for a given backend. | |
DEFAULT_PAGE_WIDTHS | = | { 'docbook' => 425 | Default page widths for calculating absolute widths | |
DEFAULT_EXTENSIONS | = | { 'html' => '.html', 'docbook' => '.xml', 'pdf' => '.pdf', 'epub' => '.epub', 'asciidoc' => '.adoc' | Default extensions for the respective base backends | |
ASCIIDOC_EXTENSIONS | = | { '.asciidoc' => true, '.adoc' => true, '.ad' => true, '.asc' => true, # TODO .txt should be deprecated '.txt' => true | Set of file extensions recognized as AsciiDoc documents (stored as a truth hash) | |
SECTION_LEVELS | = | { '=' => 0, '-' => 1, '~' => 2, '^' => 3, '+' => 4 | ||
ADMONITION_STYLES | = | ['NOTE', 'TIP', 'IMPORTANT', 'WARNING', 'CAUTION'].to_set | ||
PARAGRAPH_STYLES | = | ['comment', 'example', 'literal', 'listing', 'normal', 'pass', 'quote', 'sidebar', 'source', 'verse', 'abstract', 'partintro'].to_set | ||
VERBATIM_STYLES | = | ['literal', 'listing', 'source', 'verse'].to_set | ||
DELIMITED_BLOCKS | = | { '--' => [:open, ['comment', 'example', 'literal', 'listing', 'pass', 'quote', 'sidebar', 'source', 'verse', 'admonition', 'abstract', 'partintro'].to_set], '----' => [:listing, ['literal', 'source'].to_set], '....' => [:literal, ['listing', 'source'].to_set], '====' => [:example, ['admonition'].to_set], '****' => [:sidebar, ::Set.new], '____' => [:quote, ['verse'].to_set], '""' => [:quote, ['verse'].to_set], '++++' => [:pass, ['stem', 'latexmath', 'asciimath'].to_set], '|===' => [:table, ::Set.new], ',===' => [:table, ::Set.new], ':===' => [:table, ::Set.new], '!===' => [:table, ::Set.new], '////' => [:comment, ::Set.new], '```' => [:fenced_code, ::Set.new] | ||
DELIMITED_BLOCK_LEADERS | = | DELIMITED_BLOCKS.keys.map {|key| key[0..1] }.to_set | ||
LAYOUT_BREAK_LINES | = | { '\'' => :thematic_break, '-' => :thematic_break, '*' => :thematic_break, '_' => :thematic_break, '<' => :page_break | ||
NESTABLE_LIST_CONTEXTS | = | [:ulist, :olist, :dlist] | LIST_CONTEXTS = [:ulist, :olist, :dlist, :colist] | |
ORDERED_LIST_STYLES | = | [:arabic, :loweralpha, :lowerroman, :upperalpha, :upperroman] | TODO validate use of explicit style name above ordered list (this list is for selecting an implicit style) | |
ORDERED_LIST_KEYWORDS | = | { 'loweralpha' => 'a', 'lowerroman' => 'i', 'upperalpha' => 'A', 'upperroman' => 'I' | ||
LIST_CONTINUATION | = | '+' | ||
LINE_BREAK | = | ' +' | NOTE AsciiDoc Python recognizes both a preceding TAB and a space | |
LINE_CONTINUATION | = | ' \\' | ||
LINE_CONTINUATION_LEGACY | = | ' +' | ||
BLOCK_MATH_DELIMITERS | = | { :asciimath => ['\\$', '\\$'], :latexmath => ['\\[', '\\]'], } | ||
INLINE_MATH_DELIMITERS | = | { :asciimath => ['\\$', '\\$'], :latexmath => ['\\(', '\\)'], } | ||
FLEXIBLE_ATTRIBUTES | = | %w(sectnums) | attributes which be changed within the content of the document (but not header) because it has semantic meaning; ex. sectnums | |
CC_ALPHA | = | 'a-zA-Z' | ||
CG_ALPHA | = | '[a-zA-Z]' | ||
CC_ALNUM | = | 'a-zA-Z0-9' | ||
CG_ALNUM | = | '[a-zA-Z0-9]' | ||
CG_BLANK | = | '[ \\t]' | ||
CC_EOL | = | '(?=\\n|$)' | ||
CG_GRAPH | = | '[\\x21-\\x7E]' | ||
CC_ALL | = | '[\s\S]' | ||
CC_WORD | = | 'a-zA-Z0-9_' | ||
CG_WORD | = | '[a-zA-Z0-9_]' | ||
CC_ALPHA | = | CG_ALPHA = '\p{Alpha}' | ||
CC_ALNUM | = | CG_ALNUM = '\p{Alnum}' | ||
CC_ALL | = | '.' | ||
CG_BLANK | = | '\p{Blank}' | ||
CC_EOL | = | '$' | ||
CG_GRAPH | = | '\p{Graph}' | ||
CC_WORD | = | CG_WORD = '\p{Word}' | ||
CC_ALPHA | = | '[:alpha:]' | ||
CG_ALPHA | = | '[[:alpha:]]' | ||
CC_ALL | = | '.' | ||
CC_ALNUM | = | '[:alnum:]' | ||
CG_ALNUM | = | '[[:alnum:]]' | ||
CG_BLANK | = | '[[:blank:]]' | ||
CC_EOL | = | '$' | ||
CG_GRAPH | = | '[[:graph:]]' | ||
CC_WORD | = | '[:word:]' | ||
CG_WORD | = | '[[:word:]]' | ||
CC_WORD | = | '[:alnum:]_' | NOTE Ruby 1.8 cannot match word characters beyond the ASCII range; if you need this feature, upgrade! | |
CG_WORD | = | '[[:alnum:]_]' | ||
AuthorInfoLineRx | = | /^(#{CG_WORD}[#{CC_WORD}\-'.]*)(?: +(#{CG_WORD}[#{CC_WORD}\-'.]*))?(?: +(#{CG_WORD}[#{CC_WORD}\-'.]*))?(?: +<([^>]+)>)?$/ |
Matches the author info line immediately following the document title.
Examples Doc Writer <doc@example.com> Mary_Sue Brontë |
|
RevisionInfoLineRx | = | /^(?:\D*(.*?),)?(?:\s*(?!:)(.*?))(?:\s*(?!^):\s*(.*))?$/ |
Matches the revision info line, which appears immediately following the
author info line beneath the document title.
Examples v1.0 2013-01-01 v1.0, 2013-01-01: Ring in the new year release 1.0, Jan 01, 2013 |
|
ManpageTitleVolnumRx | = | /^(.*)\((.*)\)$/ |
Matches the title and volnum in the manpage doctype.
Examples = asciidoctor ( 1 ) |
|
ManpageNamePurposeRx | = | /^(.*?)#{CG_BLANK}+-#{CG_BLANK}+(.*)$/ |
Matches the name and purpose in the manpage doctype.
Examples asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats |
|
ConditionalDirectiveRx | = | /^\\?(ifdef|ifndef|ifeval|endif)::(\S*?(?:([,\+])\S+?)?)\[(.+)?\]$/ |
Matches a conditional preprocessor directive (e.g., ifdef, ifndef, ifeval
and endif).
Examples ifdef::basebackend-html[] ifndef::theme[] ifeval::["{asciidoctor-version}" >= "0.1.0"] ifdef::asciidoctor[Asciidoctor!] endif::theme[] endif::basebackend-html[] endif::[] |
|
EvalExpressionRx | = | /^(\S.*?)#{CG_BLANK}*(==|!=|<=|>=|<|>)#{CG_BLANK}*(\S.*)$/ |
Matches a restricted (read as safe) eval expression.
Examples "{asciidoctor-version}" >= "0.1.0" |
|
IncludeDirectiveRx | = | /^\\?include::([^\[]+)\[(.*?)\]$/ |
Matches an include preprocessor directive.
Examples include::chapter1.ad[] include::example.txt[lines=1;2;5..10] |
|
TagDirectiveRx | = | /\b(?:tag|end)::\S+\[\]$/ |
Matches a trailing tag directive in an include file.
Examples // tag::try-catch[] try { someMethod(); catch (Exception e) { log(e); } // end::try-catch[] |
|
AttributeEntryRx | = | /^:(!?\w.*?):(?:#{CG_BLANK}+(.*))?$/ |
Matches a document attribute entry.
Examples :foo: bar :First Name: Dan :sectnums!: :!toc: :long-entry: Attribute value lines ending in ' +' are joined together as a single value, collapsing the line breaks and indentation to a single space. |
|
InvalidAttributeNameCharsRx | = | /[^\w\-]/ | Matches invalid characters in an attribute name. | |
AttributeEntryPassMacroRx | = | /^pass:([a-z,]*)\[(.*)\]$/ |
Matches the pass inline macro allowed in value of attribute assignment.
Examples pass:[text] |
|
AttributeReferenceRx | = | /(\\)?\{((set|counter2?):.+?|\w+(?:[\-]\w+)*)(\\)?\}/ |
Matches an inline attribute reference.
Examples {foo} {counter:pcount:1} {set:foo:bar} {set:name!} |
|
BlockAnchorRx | = | /^\[\[(?:|([#{CC_ALPHA}:_][#{CC_WORD}:.-]*)(?:,#{CG_BLANK}*(\S.*))?)\]\]$/ |
Matches an anchor (i.e., id + optional reference text) on a line above a
block.
Examples [[idname]] [[idname,Reference Text]] |
|
BlockAttributeListRx | = | /^\[(|#{CG_BLANK}*[#{CC_WORD}\{,.#"'%].*)\]$/ |
Matches an attribute list above a block element.
Examples # strictly positional [quote, Adam Smith, Wealth of Nations] # name/value pairs [NOTE, caption="Good to know"] # as attribute reference [{lead}] |
|
BlockAttributeLineRx | = | /^\[(|#{CG_BLANK}*[#{CC_WORD}\{,.#"'%].*|\[(?:|[#{CC_ALPHA}:_][#{CC_WORD}:.-]*(?:,#{CG_BLANK}*\S.*)?)\])\]$/ |
A combined pattern that matches either a block anchor or a block attribute
list.
TODO this one gets hit a lot, should be optimized as much as possible |
|
BlockTitleRx | = | /^\.([^\s.].*)$/ |
Matches a title above a block.
Examples .Title goes here |
|
AdmonitionParagraphRx | = | /^(#{ADMONITION_STYLES.to_a * '|'}):#{CG_BLANK}/ |
Matches an admonition label at the start of a paragraph.
Examples NOTE: Just a little note. TIP: Don't forget! |
|
LiteralParagraphRx | = | /^(#{CG_BLANK}+.*)$/ |
Matches a literal paragraph, which is a line of text preceded by at least
one space.
Examples <SPACE>Foo <TAB>Foo |
|
CommentBlockRx | = | %r{^/{4,}$} |
Matches a comment block.
Examples //// This is a block comment. It can span one or more lines. //// |
|
CommentLineRx | = | %r{^//(?:[^/]|$)} |
Matches a comment line.
Examples // an then whatever |
|
AtxSectionRx | = | /^((?:=|#){1,6})#{CG_BLANK}+(\S.*?)(?:#{CG_BLANK}+\1)?$/ |
Matches a single-line (Atx-style) section title.
Examples == Foo # ^ a level 1 (h2) section title == Foo == # ^ also a level 1 (h2) section title match[1] is the delimiter, whose length determines the level match[2] is the title itself match[3] is an inline anchor, which becomes the section id |
|
SetextSectionTitleRx | = | /^((?=.*#{CG_WORD}+.*)[^.].*?)$/ | Matches the restricted section name for a two-line (Setext-style) section title. The name cannot begin with a dot and has at least one alphanumeric character. | |
SetextSectionLineRx | = | /^(?:=|-|~|\^|\+)+$/ |
Matches the underline in a two-line (Setext-style) section title.
Examples ====== || ------ || ~~~~~~ || ^^^^^^ || ++++++ |
|
InlineSectionAnchorRx | = | /^(.*?)#{CG_BLANK}+(\\)?\[\[([#{CC_ALPHA}:_][#{CC_WORD}:.-]*)(?:,#{CG_BLANK}*(\S.*?))?\]\]$/ |
Matches an anchor (i.e., id + optional reference text) inside a section
title.
Examples Section Title [[idname]] Section Title [[idname,Reference Text]] |
|
InvalidSectionIdCharsRx | = | /&(?:[a-zA-Z]{2,}|#\d{2,5}|#x[a-fA-F0-9]{2,4});|[^#{CC_WORD}]+?/ | Matches invalid characters in a section id. | |
FloatingTitleStyleRx | = | /^(?:float|discrete)\b/ |
Matches the block style used to designate a section title as a floating
title.
Examples [float] = Floating Title |
|
AnyListRx | = | /^(?:<?\d+>#{CG_BLANK}+#{CG_GRAPH}|#{CG_BLANK}*(?:-|(?:\*|\.|\u2022){1,5}|\d+\.|[a-zA-Z]\.|[IVXivx]+\))#{CG_BLANK}+#{CG_GRAPH}|#{CG_BLANK}*.*?(?::{2,4}|;;)(?:#{CG_BLANK}+#{CG_GRAPH}|$))/ | Detects the start of any list item. | |
UnorderedListRx | = | /^#{CG_BLANK}*(-|\*{1,5}|\u2022{1,5})#{CG_BLANK}+(.*)$/ |
Matches an unordered list item (one level for hyphens, up to 5 levels for
asterisks).
Examples * Foo - Foo NOTE we know trailing (.*) will match at least one character because we strip trailing spaces |
|
OrderedListRx | = | /^#{CG_BLANK}*(\.{1,5}|\d+\.|[a-zA-Z]\.|[IVXivx]+\))#{CG_BLANK}+(.*)$/ |
Matches an ordered list item (explicit numbering or up to 5 consecutive
dots).
Examples . Foo .. Foo 1. Foo (arabic, default) a. Foo (loweralpha) A. Foo (upperalpha) i. Foo (lowerroman) I. Foo (upperroman) NOTE leading space match is not always necessary, but is used for list reader NOTE we know trailing (.*) will match at least one character because we strip trailing spaces |
|
OrderedListMarkerRxMap | = | { :arabic => /\d+[.>]/, :loweralpha => /[a-z]\./, :lowerroman => /[ivx]+\)/, :upperalpha => /[A-Z]\./, :upperroman => /[IVX]+\)/ | Matches the ordinals for each type of ordered list. | |
DefinitionListRx | = | /^(?!\/\/)#{CG_BLANK}*(.*?)(:{2,4}|;;)(?:#{CG_BLANK}+(.*))?$/ |
Matches a definition list item.
Examples foo:: foo::: foo:::: foo;; # should be followed by a definition, on the same line... foo:: That which precedes 'bar' (see also, <<bar>>) # ...or on a separate line foo:: That which precedes 'bar' (see also, <<bar>>) # the term may be an attribute reference {foo_term}:: {foo_def} NOTE negative match for comment line is intentional since that isn‘t handled when looking for next list item QUESTION should we check for line comment in regex or when scanning the lines? |
|
DefinitionListSiblingRx | = | { # (?:.*?[^:])? - a non-capturing group which grabs longest sequence of characters that doesn't end w/ colon '::' => /^(?!\/\/)#{CG_BLANK}*((?:.*[^:])?)(::)(?:#{CG_BLANK}+(.*))?$/, ':::' => /^(?!\/\/)#{CG_BLANK}*((?:.*[^:])?)(:::)(?:#{CG_BLANK}+(.*))?$/, '::::' => /^(?!\/\/)#{CG_BLANK}*((?:.*[^:])?)(::::)(?:#{CG_BLANK}+(.*))?$/, ';;' => /^(?!\/\/)#{CG_BLANK}*(.*)(;;)(?:#{CG_BLANK}+(.*))?$/ | Matches a sibling definition list item (which does not include the keyed type). | |
CalloutListRx | = | /^<?(\d+)>#{CG_BLANK}+(.*)/ |
Matches a callout list item.
Examples <1> Foo NOTE we know trailing (.*) will match at least one character because we strip trailing spaces |
|
CalloutExtractRx | = | /(?:(?:\/\/|#|--|;;) ?)?(\\)?<!?(--|)(\d+)\2>(?=(?: ?\\?<!?\2\d+\2>)*$)/ |
Matches a callout reference inside literal text.
Examples <1> (optionally prefixed by //, #, -- or ;; line comment chars) <1> <2> (multiple callouts on one line) <!--1--> (for XML-based languages) NOTE extract regexps are applied line-by-line, so we can use $ as end-of-line char |
|
CalloutExtractRxt | = | '(\\\\)?<()(\\d+)>(?=(?: ?\\\\?<\\d+>)*$)' | ||
CalloutQuickScanRx | = | /\\?<!?(--|)(\d+)\1>(?=(?: ?\\?<!?\1\d+\1>)*#{CC_EOL})/ | NOTE special characters have not been replaced when scanning | |
CalloutSourceRx | = | /(?:(?:\/\/|#|--|;;) ?)?(\\)?<!?(--|)(\d+)\2>(?=(?: ?\\?<!?\2\d+\2>)*#{CC_EOL})/ | NOTE special characters have already been replaced when converting to an SGML format | |
CalloutSourceRxt | = | "(\\\\)?<()(\\d+)>(?=(?: ?\\\\?<\\d+>)*#{CC_EOL})" | ||
ListRxMap | = | { :ulist => UnorderedListRx, :olist => OrderedListRx, :dlist => DefinitionListRx, :colist => CalloutListRx | A Hash of regexps for lists used for dynamic access. | |
ColumnSpecRx | = | /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?)?([a-z])?$/ |
Parses the column spec (i.e., colspec) for a table.
Examples 1*h,2*,^3e |
|
CellSpecStartRx | = | /^#{CG_BLANK}*(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/ |
Parses the start and end of a cell spec (i.e., cellspec) for a table.
Examples 2.3+<.>m FIXME use step-wise scan (or treetop) rather than this mega-regexp |
|
CellSpecEndRx | = | /#{CG_BLANK}+(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/ | ||
GenericBlockMacroRx | = | /^(#{CG_WORD}+)::(\S*?)\[((?:\\\]|[^\]])*?)\]$/ |
Matches the general block macro pattern.
Examples gist::123456[] |
|
MediaBlockMacroRx | = | /^(image|video|audio)::(\S+?)\[((?:\\\]|[^\]])*?)\]$/ |
Matches an image, video or audio block macro.
Examples image::filename.png[Caption] video::http://youtube.com/12345[Cats vs Dogs] |
|
TocBlockMacroRx | = | /^toc::\[(.*?)\]$/ |
Matches the TOC block macro.
Examples toc::[] toc::[levels=2] |
|
InlineAnchorRx | = | /\\?(?:\[\[([#{CC_ALPHA}:_][#{CC_WORD}:.-]*)(?:,#{CG_BLANK}*(\S.*?))?\]\]|anchor:(\S+)\[(.*?[^\\])?\])/ |
Matches an anchor (i.e., id + optional reference text) in the flow of text.
Examples [[idname]] [[idname,Reference Text]] anchor:idname[] anchor:idname[Reference Text] |
|
InlineBiblioAnchorRx | = | /\\?\[\[\[([#{CC_WORD}:][#{CC_WORD}:.-]*?)\]\]\]/ |
Matches a bibliography anchor anywhere inline.
Examples [[[Foo]]] |
|
EmailInlineMacroRx | = | /([\\>:\/])?#{CG_WORD}[#{CC_WORD}.%+-]*@#{CG_ALNUM}[#{CC_ALNUM}.-]*\.#{CG_ALPHA}{2,4}\b/ |
Matches an inline e-mail address.
doc.writer@example.com |
|
FootnoteInlineMacroRx | = | /\\?(footnote(?:ref)?):\[(#{CC_ALL}*?[^\\])\]/m |
Matches an inline footnote macro, which is allowed to span multiple lines.
Examples footnote:[text] footnoteref:[id,text] footnoteref:[id] |
|
ImageInlineMacroRx | = | /\\?(?:image|icon):([^:\[][^\[]*)\[((?:\\\]|[^\]])*?)\]/ |
Matches an image or icon inline macro.
Examples image:filename.png[Alt Text] image:http://example.com/images/filename.png[Alt Text] image:filename.png[More [Alt\] Text] (alt text becomes "More [Alt] Text") icon:github[large] |
|
IndextermInlineMacroRx | = | /\\?(?:(indexterm2?):\[(#{CC_ALL}*?[^\\])\]|\(\((#{CC_ALL}+?)\)\)(?!\)))/m |
Matches an indexterm inline macro, which may span multiple lines.
Examples indexterm:[Tigers,Big cats] (((Tigers,Big cats))) indexterm2:[Tigers] ((Tigers)) |
|
KbdBtnInlineMacroRx | = | /\\?(?:kbd|btn):\[((?:\\\]|[^\]])+?)\]/ |
Matches either the kbd or btn inline macro.
Examples kbd:[F3] kbd:[Ctrl+Shift+T] kbd:[Ctrl+\]] kbd:[Ctrl,T] btn:[Save] |
|
KbdDelimiterRx | = | /(?:\+|,)(?=#{CG_BLANK}*[^\1])/ |
Matches the delimiter used for kbd value.
Examples Ctrl + Alt+T Ctrl,T |
|
LinkInlineRx | = | %r{(^|link:|<|[\s>\(\)\[\];])(\\?(?:https?|file|ftp|irc)://[^\s\[\]<]*[^\s.,\[\]<])(?:\[((?:\\\]|[^\]])*?)\])?} |
Matches an implicit link and some of the link inline macro.
Examples http://github.com http://github.com[GitHub] FIXME revisit! the main issue is we need different rules for implicit vs explicit |
|
LinkInlineMacroRx | = | /\\?(?:link|mailto):([^\s\[]+)(?:\[((?:\\\]|[^\]])*?)\])/ |
Match a link or e-mail inline macro.
Examples link:path[label] mailto:doc.writer@example.com[] |
|
StemInlineMacroRx | = | /\\?(stem|(?:latex|ascii)math):([a-z,]*)\[(#{CC_ALL}*?[^\\])\]/m |
Matches a stem (and alternatives, asciimath and latexmath) inline macro,
which may span multiple lines.
Examples stem:[x != 0] asciimath:[x != 0] latexmath:[\sqrt{4} = 2] |
|
MenuInlineMacroRx | = | /\\?menu:(#{CG_WORD}|#{CG_WORD}.*?\S)\[#{CG_BLANK}*(.+?)?\]/ |
Matches a menu inline macro.
Examples menu:File[New...] menu:View[Page Style > No Style] menu:View[Page Style, No Style] |
|
MenuInlineRx | = | /\\?"(#{CG_WORD}[^"]*?#{CG_BLANK}*>#{CG_BLANK}*[^" \t][^"]*)"/ |
Matches an implicit menu inline macro.
Examples "File > New..." |
|
PassInlineRx | = | { false => ['+', '`', /(^|[^#{CC_WORD};:])(?:\[([^\]]+?)\])?(\\?(\+|`)(\S|\S#{CC_ALL}*?\S)\4)(?!#{CG_WORD})/m], true => ['`', nil, /(^|[^`#{CC_WORD}])(?:\[([^\]]+?)\])?(\\?(`)([^`\s]|[^`\s]#{CC_ALL}*?\S)\4)(?![`#{CC_WORD}])/m] |
Matches an inline passthrough value, which may span multiple lines.
Examples +text+ `text` (compat) NOTE we always capture the attributes so we know when to use compatible (i.e., legacy) behavior |
|
PassInlineMacroRx | = | /(?:(?:(\\?)\[([^\]]+?)\])?(\\{0,2})(\+{2,3}|\${2})(#{CC_ALL}*?)\4|(\\?)pass:([a-z,]*)\[(#{CC_ALL}*?[^\\])\])/m |
Matches several variants of the passthrough inline macro, which may span
multiple lines.
Examples +++text+++ $$text$$ pass:quotes[text] |
|
XrefInlineMacroRx | = | /\\?(?:<<([#{CC_WORD}":.\/]#{CC_ALL}*?)>>|xref:([#{CC_WORD}":.\/]#{CC_ALL}*?)\[(#{CC_ALL}*?)\])/m |
Matches an xref (i.e., cross-reference) inline macro, which may span
multiple lines.
Examples <<id,reftext>> xref:id[reftext] NOTE special characters have already been escaped, hence the entity references |
|
LineBreakRx | = | /^(.*)[ \t]\+$/m | NOTE JavaScript only treats ^ and $ as line boundaries in multiline regexp; . won‘t match newlines | |
LineBreakRx | = | /^(.*)[[:blank:]]\+$/ | ||
LayoutBreakLineRx | = | /^('|<){3,}$/ |
Matches an AsciiDoc horizontal rule or AsciiDoc page break.
Examples ''' (horizontal rule) <<< (page break) |
|
LayoutBreakLinePlusRx | = | /^(?:'|<){3,}$|^ {0,3}([-\*_])( *)\1\2\1$/ |
Matches an AsciiDoc or Markdown horizontal rule or AsciiDoc page break.
Examples ''' or ' ' ' (horizontal rule) --- or - - - (horizontal rule) *** or * * * (horizontal rule) <<< (page break) |
|
BlankLineRx | = | /^#{CG_BLANK}*\n/ |
Matches a blank line.
NOTE allows for empty space in line as it could be left by the template engine |
|
DataDelimiterRx | = | /,|;/ |
Matches a comma or semi-colon delimiter.
Examples one,two three;four |
|
DoubleQuotedRx | = | /^("|)(.*)\1$/ |
Matches a single-line of text enclosed in double quotes, capturing the
quote char and text.
Examples "Who goes there?" |
|
DoubleQuotedMultiRx | = | /^("|)(#{CC_ALL}*)\1$/m |
Matches multiple lines of text enclosed in double quotes, capturing the
quote char and text.
Examples "I am a run-on sentence and I like to take up multiple lines and I still want to be matched." |
|
TrailingDigitsRx | = | /\d+$/ |
Matches one or more consecutive digits at the end of a line.
Examples docbook45 html5 |
|
EscapedSpaceRx | = | /\\(#{CG_BLANK})/ |
Matches a space escaped by a backslash.
Examples one\ two\ three |
|
SpaceDelimiterRx | = | /([^\\])#{CG_BLANK}+/ |
Matches a space delimiter that‘s not escaped.
Examples one two three four |
|
SubModifierSniffRx | = | /[+-]/ | Matches a + or - modifier in a subs list | |
UnicodeCharScanRx | = | unless RUBY_ENGINE == 'opal' |
Matches any character with multibyte support explicitly enabled (length of
multibyte char = 1)
NOTE If necessary to hide use of the language modifier (u) from JavaScript, use (Regexp.new ’.’, false, ‘u’) |
|
VERSION | = | '1.5.4' |