Skip to content
Browse files

Treat HTML code tags as nowiki tags, too.

  • Loading branch information...
1 parent ad44fee commit 1d9aba0e731ae346d001e20589415f5ff81f30eb @relistan relistan committed Oct 16, 2010
Showing with 9 additions and 3 deletions.
  1. +1 −1 ffi/yapwtp.rb
  2. +4 −0 spec/test_spec.rb
  3. +4 −2 src/syntax.leg
View
2 ffi/yapwtp.rb
@@ -132,7 +132,7 @@ def each_template
# Example using Ruby to read a file. Using the above C-implemented methods is barely faster.
File.open("../wikiwiki/wiki-development/\?ContactList", "rb") do |f|
- parser.html_from_string (f.read)
+ parser.html_from_string(f.read)
puts "# Templates: #{parser.get_template_count}"
puts "-" * 78;
parser.each_template do |template|
View
4 spec/test_spec.rb
@@ -161,6 +161,10 @@ def parse(wikitext, *args)
parse("<pre>'''bold'''</pre>").should == "<p><pre>'''bold'''</pre></p>";
end
+ it "should treat <code> tags as nowiki tags" do
+ parse("<code>'''bold'''</code>").should == "<p><code>'''bold'''</code></p>";
+ end
+
it "should handle nowiki in complex situations" do
parse('{| cellspacing="0" border="1"
!style="width:50%"|You type
View
6 src/syntax.leg
@@ -303,12 +303,14 @@ nowiki = nowiki_open < ( !nowiki_close . )* > {
append_to_tag_content("%s", bdata(markup));
bdestroy(markup);
} nowiki_close
-nowiki_open = nowiki_open_tag | html_pre_open
-nowiki_close = nowiki_close_tag | html_pre_close
+nowiki_open = nowiki_open_tag | html_pre_open | html_code_open
+nowiki_close = nowiki_close_tag | html_pre_close | html_code_close
nowiki_open_tag = '<nowiki>'
nowiki_close_tag = '</nowiki>'
html_pre_open = ( '<pre>' | '<PRE>' ) { append_to_tag_content("<pre>"); }
html_pre_close = ( '</pre>' | '</PRE>' ) { append_to_tag_content("</pre>"); }
+html_code_open = ( '<code>' | '<CODE>' ) { append_to_tag_content("<code>"); }
+html_code_close = ( '</code>' | '</CODE>' ) { append_to_tag_content("</code>"); }
# Links
link = ( local_link | external_link ) { start_of_line = 0; }

0 comments on commit 1d9aba0

Please sign in to comment.
Something went wrong with that request. Please try again.