Ticket #49 (closed defect: wontfix)

Opened 18 months ago

Last modified 18 months ago

HTML Comment causes Malformed tag

Reported by: pbarry Owned by: deveiant
Priority: low Milestone: Bugfixes
Component: MarkdownSyntax Version: 1.0.0
Severity: minor Keywords: malformed comment tag
Cc:

Description

Using blue cloth, if you enter text like this:

Here is how you create an HTML comment:

    <!

You get a Malformed tag error:

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'bluecloth'
=> true
irb(main):003:0> BlueCloth.new('    <!').to_html
RuntimeError: Malformed tag at character 8: "<!\n\n"
        from /usr/local/lib/ruby/gems/1.8/gems/BlueCloth-1.0.0/lib/bluecloth.rb:1093:in `tokenize_html'
        from /usr/local/lib/ruby/gems/1.8/gems/BlueCloth-1.0.0/lib/bluecloth.rb:402:in `escape_special_chars'
        from /usr/local/lib/ruby/gems/1.8/gems/BlueCloth-1.0.0/lib/bluecloth.rb:200:in `to_html'
        from (irb):3

Change History

Changed 18 months ago by deveiant

  • status changed from new to closed
  • severity changed from normal to minor
  • component changed from API to MarkdownSyntax
  • priority changed from normal to low
  • version set to 1.0.0
  • keywords malformed comment tag added
  • resolution set to wontfix

<! by itself is not an HTML comment. Quoting from the W3C's On SGML and HTML (emphasis mine):

3.2.4 Comments

HTML comments have the following syntax:

	<!-- this is a comment -->
	<!-- and so is this one,
	    which occupies more than one line -->
	

White space is not permitted between the markup declaration open delimiter("<!") and the comment open delimiter ("--"), but is permitted between the comment close delimiter ("--") and the markup declaration close delimiter (">"). A common error is to include a string of hyphens ("---") within a comment. Authors should avoid putting two or more adjacent hyphens inside comments.

I won't argue that the parser should perhaps be a bit more liberal (the point made by #24), but what you're inputting is a malformed tag. Given that fact, would you still want it to behave differently than it does?

Note: See TracTickets for help on using tickets.