Class | Asciidoctor::AttributeList |
In: |
lib/asciidoctor/attribute_list.rb
|
Parent: | Object |
Public: Handles parsing AsciiDoc attribute lists into a Hash of key/value pairs. By default, attributes must each be separated by a comma and quotes may be used around the value. If a key is not detected, the value is assigned to a 1-based positional key, The positional attributes can be "rekeyed" when given a posattrs array either during parsing or after the fact.
Examples
attrlist = Asciidoctor::AttributeList.new('astyle') attrlist.parse => {0 => 'astyle'} attrlist.rekey(['style']) => {'style' => 'astyle'} attrlist = Asciidoctor::AttributeList.new('quote, Famous Person, Famous Book (2001)') attrlist.parse(['style', 'attribution', 'citetitle']) => {'style' => 'quote', 'attribution' => 'Famous Person', 'citetitle' => 'Famous Book (2001)'}
BOUNDARY_PATTERNS | = | { '"' => /.*?[^\\](?=")/, '\'' => /.*?[^\\](?=')/, ',' => /.*?(?=[ \t]*(,|$))/ | Public: Regular expressions for detecting the boundary of a value | |
UNESCAPE_PATTERNS | = | { '\\"' => /\\"/, '\\\'' => /\\'/ | Public: Regular expressions for unescaping quoted characters | |
SKIP_PATTERNS | = | { :blank => /[ \t]+/, ',' => /[ \t]*(,|$)/ | Public: Regular expressions for skipping blanks and delimiters | |
NAME_PATTERN | = | /[A-Za-z:_][A-Za-z:_\-\.]*/ | Public: A regular expression for an attribute name TODO named attributes cannot contain dash characters |