Module | MaRuKu::Strings |
In: |
lib/maruku/input/type_detection.rb
lib/maruku/string_utils.rb lib/maruku.rb |
These are strings utilities.
AttributeDefinitionList | = | /^\s{0,3}\{([\w\d\s]+)\}:\s*(.*)\s*$/ | $1 = id $2 = attribute list | |
InlineAttributeList | = | /^\s{0,3}\{([:#\.].*)\}\s*$/ | ||
Definition | = | %r{ ^ # begin of line [ ]{0,3} # up to 3 spaces : # colon \s* # whitespace (\S.*) # the text = $1 $ # end of line }x |
Example:
^:blah blah ^: blah blah ^ : blah blah |
|
Abbreviation | = | %r{ ^ # begin of line [ ]{0,3} # up to 3 spaces \* # one asterisk \[ # opening bracket ([^\]]+) # any non-closing bracket: id = $1 \] # closing bracket : # colon \s* # whitespace (\S.*\S)* # definition=$2 \s* # strip this whitespace $ # end of line }x |
Example:
*[HTML]: Hyper Text Markup Language |
|
FootnoteText | = | %r{ ^ # begin of line [ ]{0,3} # up to 3 spaces \[(\^.+)\]: # id = $1 (including '^') \s*(\S.*)?$ # text = $2 (not obb.) }x | ||
LinkRegex | = | %r{ ^[ ]{0,3}\[([^\[\]]+)\]: # id = $1 [ ]* <?([^>\s]+)>? # url = $2 [ ]* (?:# Titles are delimited by "quotes" or (parens). ["('] (.+?) # title = $3 [")'] # Matching ) or " \s*(.+)? # stuff = $4 )? # title is optional }x | This regex is taken from BlueCloth sources Link defs are in the form: ^[id]: \n? url "optional title" | |
IncompleteLink | = | %r{^[ ]{0,3}\[([^\[\]]+)\]:\s*$} | ||
HeaderWithId | = | /^(.*)\{\#([\w_-]+)\}\s*$/ | ||
HeaderWithAttributes | = | /^(.*)\{(.*)\}\s*$/ | ||
MightBeTableHeader | = | %r{\|} | if contains a pipe, it could be a table header | |
Sep | = | /\s*(\:)?\s*-+\s*(\:)?\s*/ | ————-: | |
TableSeparator | = | %r{^(\|?#{Sep}\|?)+\s*$} | | ————-:| —————————— | | |
EMailAddress | = | /<([^:]+@[^:]+)>/ | ||
TabSize | = | 4; |
This parses email headers. Returns an hash.
+hash[‘data’]+ is the message.
Keys are downcased, space becomes underscore, converted to symbols.
My key: true
becomes:
{:my_key => true}