Module: Wptemplates::Regexes
- Included in:
- Parser
- Defined in:
- lib/wptemplates/regexes.rb
Class Method Summary collapse
- .a_doubleclosingbrace ⇒ Object
- .a_doubleopenbrace ⇒ Object
- .a_link ⇒ Object
- .a_pipe ⇒ Object
- .after_hash ⇒ Object
- .first_comma ⇒ Object
- .from_pipe_till_equals_no_doubleclosebrace_or_pipe ⇒ Object
- .has_parens ⇒ Object
- .parens ⇒ Object
- .till_doublebrace_doubleopenbrackets_or_pipe ⇒ Object
- .till_doubleclosebrace_or_pipe ⇒ Object
- .till_doubleopenbrace_or_doubleopenbrackets ⇒ Object
- .until_hash ⇒ Object
Class Method Details
.a_doubleclosingbrace ⇒ Object
52 53 54 |
# File 'lib/wptemplates/regexes.rb', line 52 def a_doubleclosingbrace /}}/ end |
.a_doubleopenbrace ⇒ Object
48 49 50 |
# File 'lib/wptemplates/regexes.rb', line 48 def a_doubleopenbrace /{{/ end |
.a_link ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/wptemplates/regexes.rb', line 56 def a_link / \[\[ (?<link> # ([% title-legal-chars])+ [%\ !"$&'()*,\-.\/0-9:;=?@A-Z\\^_`a-z~\u0080-\uFFFF+]+ # ("#" [# % title-legal-chars]+)? ( \# [\#%\ !"$&'()*,\-.\/0-9:;=?@A-Z\\^_`a-z~\u0080-\uFFFF+]+ )? ) ( # "|" LEGAL_ARTICLE_ENTITY* \| (?<link-description>([^\]]|\](?!\]))*) )? \]\] (?<extra_letters>\p{L}*) /x end |
.a_pipe ⇒ Object
44 45 46 |
# File 'lib/wptemplates/regexes.rb', line 44 def a_pipe /\|/ end |
.after_hash ⇒ Object
78 79 80 |
# File 'lib/wptemplates/regexes.rb', line 78 def after_hash /(?<=#).*/ end |
.first_comma ⇒ Object
86 87 88 |
# File 'lib/wptemplates/regexes.rb', line 86 def first_comma /^(?<before>([^,]|,(?! ))*)(, |$)/ end |
.from_pipe_till_equals_no_doubleclosebrace_or_pipe ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/wptemplates/regexes.rb', line 33 def from_pipe_till_equals_no_doubleclosebrace_or_pipe / \| # Pipe (( [^|=}] # Unproblematic chars |}(?!}) # A lone close brace )*) = # Equals /x end |
.has_parens ⇒ Object
82 83 84 |
# File 'lib/wptemplates/regexes.rb', line 82 def has_parens /^(?<no_parens>.*?) *\(.*\) *$/ end |
.parens ⇒ Object
90 91 92 |
# File 'lib/wptemplates/regexes.rb', line 90 def parens /^(?<before>.*?)(\(.*\) *)?$/ end |
.till_doublebrace_doubleopenbrackets_or_pipe ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/wptemplates/regexes.rb', line 7 def till_doublebrace_doubleopenbrackets_or_pipe /( [^{}\[|] # Unproblematic chars | { (?!{ ) # A lone open brace | } (?!} ) # A lone close brace | \[(?!\[) # A lone open bracket | ^\[\[ # Doubleopenbrackets at start )+/x end |
.till_doubleclosebrace_or_pipe ⇒ Object
26 27 28 29 30 31 |
# File 'lib/wptemplates/regexes.rb', line 26 def till_doubleclosebrace_or_pipe /( [^|}] # Unproblematic chars | } (?!} ) # A lone close brace )+/x end |
.till_doubleopenbrace_or_doubleopenbrackets ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/wptemplates/regexes.rb', line 17 def till_doubleopenbrace_or_doubleopenbrackets /( [^{\[] # Unproblematic chars | { (?!{ ) # A lone open brace | \[(?!\[) # A lone open bracket | ^\[\[ # Doubleopenbrackets at start )+/x end |
.until_hash ⇒ Object
74 75 76 |
# File 'lib/wptemplates/regexes.rb', line 74 def until_hash /[^#]*/ end |