lib/trac-wiki/parser.rb in trac-wiki-0.3.20 vs lib/trac-wiki/parser.rb in trac-wiki-0.3.21
- old
+ new
@@ -127,11 +127,11 @@
# macro {{$var}} | {{#comment}} | {{!cmd}} | {{template}} | {{/template}}
# string begins with macro
MACRO_BEG_REX = /\A\{\{ ( \$[\$\.\w]+ | [\#!\/]\w* |\w+ ) /x
- MACRO_BEG_INSIDE_REX = /\A(.*?)(?<!\{)\{\{ ( \$[\$\.\w]+ | [\#!\/]\w* | \w+ ) /xm
+ MACRO_BEG_INSIDE_REX = /\A(.*?) (?<!\{|!|!\{) \{\{ ( \$[\$\.\w]+ | [\#!\/]\w* | \w+ ) /xm
# find end of marcro or begin of inner macro
MACRO_END_REX = /\A(.*?) ( \}\} | \{\{ ( \$[\$\.\w]+ | [\#!\/]\w* | \w+) )/mx
# Create a new Parser instance.
def initialize(options = {})
@@ -470,11 +470,15 @@
# toggle_tag 'ins', $& # insert
when str =~ /\A\^/
toggle_tag 'sup', $& # ^{}
when str =~ /\A,,/
toggle_tag 'sub', $& # _{}
- when str =~ /\A!(\{\{|[^\s])/
+ when str =~ /\A!\./
+ @tree.add('') # !. \relax
+ when str =~ /\A!(\{\{|[\S])/
@tree.add($1) # !neco !{{
+# when str =~ /\A!(\{\{)/
+# @tree.add($1) # !neco !{
when str =~ /\A./
@tree.add($&) # ordinal char
end
str = $'
offset += $&.size