mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 01:36:13 +00:00
Fix regex bug in _contrib/updatetx.rb
This commit is contained in:
parent
9a34a96fd8
commit
1b6d736637
1 changed files with 3 additions and 3 deletions
|
@ -28,11 +28,11 @@ dirs.each do |dir|
|
||||||
next if file == '.' or file == '..'
|
next if file == '.' or file == '..'
|
||||||
contents = File.read(dir + '/' + file)
|
contents = File.read(dir + '/' + file)
|
||||||
# Drop HTML code applied to current language only ( until next {% when / else / endcase %} statement )
|
# Drop HTML code applied to current language only ( until next {% when / else / endcase %} statement )
|
||||||
contents.gsub!(Regexp.new("{% when '" + lang + "' %}((?!.*?{% endcase %})(?!.*?{% else %}).)*?{% when", Regexp::MULTILINE),'{% when')
|
contents.gsub!(Regexp.new("{% when '" + lang + "' %}((?!{% endcase %})(?!.*?{% else %}).)*?{% when", Regexp::MULTILINE),'{% when')
|
||||||
contents.gsub!(Regexp.new("{% when '" + lang + "' %}((?!.*?{% endcase %}).)*?{% else %}", Regexp::MULTILINE),'{% else %}')
|
contents.gsub!(Regexp.new("{% when '" + lang + "' %}((?!{% endcase %}).)*?{% else %}", Regexp::MULTILINE),'{% else %}')
|
||||||
contents.gsub!(Regexp.new("{% when '" + lang + "' %}.*?{% endcase %}", Regexp::MULTILINE),'{% endcase %}')
|
contents.gsub!(Regexp.new("{% when '" + lang + "' %}.*?{% endcase %}", Regexp::MULTILINE),'{% endcase %}')
|
||||||
# Drop complete {% case / endcase %} statements when not used by any language anymore
|
# Drop complete {% case / endcase %} statements when not used by any language anymore
|
||||||
contents.gsub!(Regexp.new("{% case page.lang %}(((?!{% when ).)*?){% else %}(.*?){% endcase %}", Regexp::MULTILINE),'\1 \3')
|
contents.gsub!(Regexp.new("{% case page.lang %}(((?!{% endcase %})(?!{% when ).)*?){% else %}(.*?){% endcase %}", Regexp::MULTILINE),'\1 \3')
|
||||||
contents.gsub!(Regexp.new("{% case page.lang %}(((?!{% when ).)*?){% endcase %}", Regexp::MULTILINE),'\1')
|
contents.gsub!(Regexp.new("{% case page.lang %}(((?!{% when ).)*?){% endcase %}", Regexp::MULTILINE),'\1')
|
||||||
# Drop language in statements applied to many languages ( e.g. {% when 'ar' or 'fr' .. %} )
|
# Drop language in statements applied to many languages ( e.g. {% when 'ar' or 'fr' .. %} )
|
||||||
contents.gsub!(Regexp.new("{% when '" + lang + "' or (.*?) %}"),'{% when \1 %}')
|
contents.gsub!(Regexp.new("{% when '" + lang + "' or (.*?) %}"),'{% when \1 %}')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue