lib/trac-wiki/parser.rb in trac-wiki-0.3.15 vs lib/trac-wiki/parser.rb in trac-wiki-0.3.16
- old
+ new
@@ -53,15 +53,12 @@
# title: 'heading title'
# },
# ...
# ]
attr_accessor :headings
+ attr_accessor :env
- def env
- @env
- end
-
attr_reader :used_templates
@used_templates = {}
# url base for links
@@ -132,11 +129,11 @@
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 = nil)
+ def initialize(options = {})
init_macros
@env = Env.new(self)
@macros = true
@allowed_schemes = %w(http https ftp ftps)
macro_commands = options.delete :macro_commands
@@ -678,12 +675,12 @@
ret = {}
@env.atput('lineno', @line_no);
while str =~ /\A\s*(\w+)\s*=\s*'([^>']*)'/ ||
str =~ /\A\s*(\w+)\s*=\s*"([^>"]*)"/ ||
str =~ /\A\s*(\w+)\s*=\s*(\S*)/
- ret[$1] = @env.expand($2)
- str = $'
+ ret[$1] = @env.expand($2)
+ str = $'
end
ret
end
def do_hr
@@ -776,10 +773,11 @@
when str =~ /\A[ \t]*\|\|(.*)$(\r?\n)?/
do_table_row($1)
# empty line
when str =~ /\A\s*$(\r?\n)?/
end_paragraph
- when str =~ /\A([:\w\s]+)::(\s+|\r?\n)/
+ #when str =~ /\A([:\w\s]+)::(\s+|\r?\n)/
+ when str =~ /\A(.+)::(\s+|\r?\n)/
do_term($1)
# li
when str =~ /\A((\s*)([*-]|[aAIi\d]\.)\s+)(.*?)$(\r?\n)?/
parse_li_line($2.size, $3)
parse_inline($4, $1.size)