Module: Defmastership::Core::DMRegexp
- Defined in:
- lib/defmastership/core/constants.rb
Overview
set of regexp of added asciidoctor constructions This module smells of :reek:TooManyConstants
Constant Summary collapse
- SINGLE_LINE_COMMENT =
- Regexp
-
to match a single line comment
%r{^//[^/]}
- DEF_KEYWORD =
- Regexp
-
match the definition keyword
'\s*define\s*'
- DEF_TYPE =
- Regexp
-
match a definition type
",\\s*#{an_id('type')}\\s*".freeze
- DEF_BEFORE_REF =
- Regexp
-
match all text before the definition’s reference
<<~"BEF".freeze ^ \\s* \\[ #{DEF_KEYWORD} #{DEF_TYPE} , \\s* BEF
- DEF_VERSION_AND_CHECKSUM =
- Regexp
-
match optional explicit version and explicit checksum
'(?<version_and_checksum>' \ '\((?<explicit_version>[^~]+)?(?<explicit_checksum>~\h+)?\)' \ ')?'
- REFERENCE =
- Regexp
-
match reference
an_id('reference').freeze
- REF_WITH_OPT_VER_CHK =
- Regexp
-
match reference with optional version and checksum
"\\s*#{REFERENCE}#{DEF_VERSION_AND_CHECKSUM}\\s*".freeze
- DEF_SUMMARY =
- Regexp
-
match defintion summary
<<~'SUM' \s* (,\s* (("\s*(?<summary>[^""]*?)\s*")|(?<summary>[^\s,\[\]][^,\[\]]*?)) \s*)? SUM
- DEF_LABELS =
- Regexp
-
match definition labels
'(,\s*\[\s*(?<labels>.*\b)\s*\])?'
- DEF_AFTER_REF =
- Regexp
-
match all text after the definition’s reference
<<~"AFT".freeze \\s* #{DEF_SUMMARY} #{DEF_LABELS} \\s* \\] AFT
- DEFINITION =
- Regexp
-
match a definition line
Regexp.new(definition_re_string, Regexp::EXTENDED)
- VARIABLE_DEF =
- Regexp
-
match a asciidcotor attribute definition
/^\s*:#{an_id('varname')}:\s+ (?<value>\S.*\S)\s*$/x
- VARIABLE_USE =
- Regexp
-
match a asciidcotor attribute use
/{#{an_id('varname')}}/x
- EREF_CONFIG =
- Regexp
-
match an external cross reference type configuration
/^\s*:eref-#{an_id('reference')}-(?<symb>prefix|url):\s* \s*(?<value>\S.*\S)\s*/x
- EREF_DEF =
- Regexp
-
match an external cross reference use
/^\s* defs:eref\[ \s*#{an_id('reference')}\s*, \s*\[\s*(?<extrefs>[^\]]+?)\s*\]\s*\]/x
- BLOCK =
- Regexp
-
match an asciidoc block delimiter
/^--\s*$/
- IREF_DEF_BEF =
- Regexp
-
match the begining of an internal cross reference
'defs:iref\[\s*'
- IREF_DEF_AFT =
- Regexp
-
match the end of an internal cross reference
'\s*\]'
- IREF_DEF =
- Regexp
-
match an internal cross reference
Regexp.new( "#{IREF_DEF_BEF}#{an_id('intref')}#{DEF_VERSION_AND_CHECKSUM}#{IREF_DEF_AFT}", Regexp::EXTENDED )
- ATTR_CONFIG =
- Regexp
-
match an attribute configuration
/\s*:attr-#{an_id('attr')}-prefix: \s+(?<prefix>.+?)\s*$/x
- ATTR_SET =
- Regexp
-
match an attribute use
/\s* defs:attribute\[ \s*#{an_id('attr')}\s*, \s*(?<value>.+?)\s*\]/x
- EMPTY_LINE =
- Regexp
-
match an empty line
/^\s*$/
- WHATEVER =
- Regexp
-
match everything
//
- INCLUDE_KEYWORD =
- Regexp
-
match asciidoc include statement keyword
'^\s*include::'
- INCLUDE_PATH =
- Regexp
-
match asciidoc include statement path
'(?<path>.*/)?'
- INCLUDE_FILENAME =
- Regexp
-
match asciidoc include statement filename
'(?<filename>[^\\\/]+)'
- INCLUDE_OPTIONS =
- Regexp
-
match asciidoc include statement options
'\[(?<options>[^\]]*)\]'
- INCLUDE =
- Regexp
-
match asciidoc include statement
Regexp.new( INCLUDE_KEYWORD + INCLUDE_PATH + INCLUDE_FILENAME + INCLUDE_OPTIONS, Regexp::EXTENDED )
Class Method Summary collapse
-
.an_id(backref_name) ⇒ Object
generic regexp pattern for ids.
Class Method Details
.an_id(backref_name) ⇒ Object
generic regexp pattern for ids
13 14 15 |
# File 'lib/defmastership/core/constants.rb', line 13 def self.an_id(backref_name) "(?<#{backref_name}>[\\w-]+)" end |