maruku 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/docs/markdown_syntax.md +9 -21
  5. data/lib/maruku/defaults.rb +1 -1
  6. data/lib/maruku/element.rb +18 -3
  7. data/lib/maruku/ext/fenced_code.rb +1 -1
  8. data/lib/maruku/ext/math/mathml_engines/blahtex.rb +1 -1
  9. data/lib/maruku/ext/math/to_html.rb +2 -9
  10. data/lib/maruku/html.rb +5 -8
  11. data/lib/maruku/input/html_helper.rb +94 -81
  12. data/lib/maruku/input/mdline.rb +6 -4
  13. data/lib/maruku/input/parse_block.rb +145 -37
  14. data/lib/maruku/input/parse_span.rb +7 -8
  15. data/lib/maruku/input/rubypants.rb +22 -9
  16. data/lib/maruku/maruku.rb +5 -0
  17. data/lib/maruku/output/to_html.rb +15 -6
  18. data/lib/maruku/output/to_latex.rb +9 -3
  19. data/lib/maruku/output/to_s.rb +0 -1
  20. data/lib/maruku/string_utils.rb +2 -2
  21. data/lib/maruku/version.rb +1 -1
  22. data/spec/block_docs/abbrev.md +18 -18
  23. data/spec/block_docs/attribute_sanitize.md +22 -0
  24. data/spec/block_docs/auto_cdata.md +48 -0
  25. data/spec/block_docs/bug_table.md +4 -4
  26. data/spec/block_docs/code4.md +79 -0
  27. data/spec/block_docs/div_without_newline.md +16 -0
  28. data/spec/block_docs/empty_cells.md +3 -9
  29. data/spec/block_docs/entities.md +6 -12
  30. data/spec/block_docs/extra_table1.md +6 -6
  31. data/spec/block_docs/fenced_code_blocks.md +12 -20
  32. data/spec/block_docs/fenced_code_blocks_highlighted.md +1 -2
  33. data/spec/block_docs/footnotes2.md +4 -1
  34. data/spec/block_docs/ignore_bad_header.md +9 -0
  35. data/spec/block_docs/issue106.md +78 -0
  36. data/spec/block_docs/issue115.md +20 -0
  37. data/spec/block_docs/issue117.md +13 -0
  38. data/spec/block_docs/issue120.md +48 -0
  39. data/spec/block_docs/issue123.md +11 -0
  40. data/spec/block_docs/issue124.md +16 -0
  41. data/spec/block_docs/issue40.md +24 -12
  42. data/spec/block_docs/issue89.md +1 -1
  43. data/spec/block_docs/lists_nested_blankline.md +14 -8
  44. data/spec/block_docs/lists_ol.md +5 -5
  45. data/spec/block_docs/lists_paraindent.md +6 -11
  46. data/spec/block_docs/math-blahtex/equations.md +12 -13
  47. data/spec/block_docs/math-blahtex/math2.md +9 -2
  48. data/spec/block_docs/math/embedded_invalid_svg.md +31 -2
  49. data/spec/block_docs/math/embedded_svg.md +41 -2
  50. data/spec/block_docs/math/equations.md +7 -2
  51. data/spec/block_docs/math/inline.md +2 -2
  52. data/spec/block_docs/math/math2.md +9 -1
  53. data/spec/block_docs/math/spaces_after_inline_math.md +17 -0
  54. data/spec/block_docs/math/table.md +2 -2
  55. data/spec/block_docs/math/table2.md +6 -6
  56. data/spec/block_docs/table_attributes.md +4 -6
  57. data/spec/block_docs/table_colspan.md +41 -0
  58. data/spec/block_docs/tables.md +10 -21
  59. data/spec/block_docs/tables2.md +74 -0
  60. data/spec/block_docs/xml_comments.md +32 -0
  61. data/spec/span_spec.rb +1 -1
  62. data/spec/spec_helper.rb +1 -0
  63. metadata +42 -28
  64. metadata.gz.sig +3 -3
  65. data/spec/block_docs/xml2.md +0 -19
@@ -409,7 +409,7 @@ Created by \\href{#{MaRuKu::MARUKU_URL}}{Maruku} #{self.nice_date}.
409
409
  def to_latex_table
410
410
  num_columns = self.align.size
411
411
 
412
- head, *rows = @children.each_slice(num_columns).to_a
412
+ head, *rows = @children
413
413
 
414
414
  h = { :center => 'c' , :left => 'l' , :right => 'r'}
415
415
  align_string = self.align.map {|a| h[a] }.join('|')
@@ -432,11 +432,17 @@ Created by \\href{#{MaRuKu::MARUKU_URL}}{Maruku} #{self.nice_date}.
432
432
 
433
433
 
434
434
  def to_latex_head_cell
435
- children_to_latex
435
+ to_latex_cell
436
436
  end
437
437
 
438
438
  def to_latex_cell
439
- children_to_latex
439
+ s=""
440
+ if @attributes.has_key?(:colspan)
441
+ # TODO figure out how to set the alignment (defaulting to left for now)
442
+ s="\\multicolumn {"<< @attributes[:colspan]<<"}{|l|}{"<<children_to_latex<<"}"
443
+ else
444
+ children_to_latex
445
+ end
440
446
  end
441
447
 
442
448
  def to_latex_footnote_reference
@@ -4,7 +4,6 @@ module MaRuKu
4
4
 
5
5
  # Strips all formatting from the string
6
6
  def to_s
7
- warn "Maruku#to_s is deprecated and will be removed or changed in a near-future version of Maruku."
8
7
  children_to_s
9
8
  end
10
9
 
@@ -57,8 +57,8 @@ module MaRuKu
57
57
  # @param s [String]
58
58
  # @return [Fixnum]
59
59
  def spaces_before_first_char(s)
60
- match =
61
- case s.md_type
60
+ s = MaRuKu::MDLine.new(s.gsub(/([^\t]*)(\t)/) { $1 + " " * (TAB_SIZE - $1.length % TAB_SIZE) })
61
+ match = case s.md_type
62
62
  when :ulist
63
63
  # whitespace, followed by ('*'|'+'|'-') followed by
64
64
  # more whitespace, followed by an optional IAL, followed
@@ -1,6 +1,6 @@
1
1
  module MaRuKu
2
2
  # The Maruku version.
3
- VERSION = '0.7.0'
3
+ VERSION = '0.7.1'
4
4
 
5
5
  # @deprecated Exists for backwards compatibility. Use {VERSION}
6
6
  # @private
@@ -415,17 +415,17 @@ md_el(:document,[
415
415
  *** Output of to_html ***
416
416
  <h1 id="webkit_safari_31_and_the_css_fontface_declaration">WebKit (Safari 3.1) and the <abbr title="Cascading Style Sheets">CSS</abbr> @font-face declaration</h1>
417
417
 
418
- <p>I&#8217;m a big fan of typography in general. If you check out <a href="http://elliottcable.name">my homepage</a> or my <a href="http://elliottcable.name/contact.xhtml">contact elliottcable</a> page, and you&#8217;re using Safari/WebKit or Opera/Kestrel, you&#8217;ll notice the typefaces (fonts, as colloquialized) are <em>very</em> non-standard. (As of this writing, I&#8217;m using <a href="http://www.josbuivenga.demon.nl/museo.html" title="Jos Buivenga's Museo free typeface">Museo</a> and <a href="http://www.josbuivenga.demon.nl/diavlo.html" title="Jos Buivenga's free Diavlo typeface">Diavlo</a><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> heavily on both.)</p>
418
+ <p>Im a big fan of typography in general. If you check out <a href="http://elliottcable.name">my homepage</a> or my <a href="http://elliottcable.name/contact.xhtml">contact elliottcable</a> page, and youre using Safari/WebKit or Opera/Kestrel, youll notice the typefaces (fonts, as colloquialized) are <em>very</em> non-standard. (As of this writing, Im using <a href="http://www.josbuivenga.demon.nl/museo.html" title="Jos Buivenga's Museo free typeface">Museo</a> and <a href="http://www.josbuivenga.demon.nl/diavlo.html" title="Jos Buivenga's free Diavlo typeface">Diavlo</a><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> heavily on both.)</p>
419
419
 
420
- <p>The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. We&#8217;ve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and&#8230; dare I invoke ye, thou my terrible overlord? Times New Roman.</p>
420
+ <p>The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. Weve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and dare I invoke ye, thou my terrible overlord? Times New Roman.</p>
421
421
 
422
422
  <p>Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world.</p>
423
423
 
424
- <p>All hyperbole aside, I&#8217;m extremely happy to see the advent of a standard <code>@font-face</code> declaration in <abbr title="Cascading Style Sheets">CSS</abbr>. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary <abbr title="Embedded OpenType">.EOT</abbr><sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup> format to appease overly restrictive type foundries&#8217; worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and it&#8217;s advocates to the web. This new run at <code>@font-face</code> by an established, trusted, and open group (the <a href="http://w3c.org" title="World Wide Web Consortium"><abbr title="World Wide Web Consortium">W3C</abbr></a> itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds.</p>
424
+ <p>All hyperbole aside, Im extremely happy to see the advent of a standard <code>@font-face</code> declaration in <abbr title="Cascading Style Sheets">CSS</abbr>. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary <abbr title="Embedded OpenType">.EOT</abbr><sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup> format to appease overly restrictive type foundries worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and its advocates to the web. This new run at <code>@font-face</code> by an established, trusted, and open group (the <a href="http://w3c.org" title="World Wide Web Consortium"><abbr title="World Wide Web Consortium">W3C</abbr></a> itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds.</p>
425
425
 
426
- <p>Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but it&#8217;s an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the &#8216;new&#8217; <code>@font-face</code> declaration. No, it&#8217;s not really &#8216;new&#8217;, but yes, it feels like it is.</p>
426
+ <p>Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but its an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the new <code>@font-face</code> declaration. No, its not really new’, but yes, it feels like it is.</p>
427
427
 
428
- <p>To put it simply, and to be very blunt, it&#8217;s broken.</p>
428
+ <p>To put it simply, and to be very blunt, its broken.</p>
429
429
 
430
430
  <p>The <a href="http://?"><abbr title="Cascading Style Sheets">CSS</abbr> spec section</a> for <code>@font-face</code> is very specific - typefaces are to be selected based on a wide array of criteria placed in the <code>@font-face</code> declaration block itself. Various textual <abbr title="Cascading Style Sheets">CSS</abbr> attributes may be defined within the <code>@font-face</code> declaration, and then they will be checked when the typeface is referred to later in the <abbr title="Cascading Style Sheets">CSS</abbr>. For instance, if I have two <code>@font-face</code> declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a <code>font-family:</code> attribute, it should refer to the basic Diavlo font defined in the first <code>@font-face</code>. However, if I were to do the same, but also specify a heavy <code>font-weight:</code>, then it should use the heavier version of Diavlo. To place this example in code:</p>
431
431
 
@@ -449,9 +449,9 @@ div#content {
449
449
  font-family: 'Diavlo';
450
450
  }</code></pre>
451
451
 
452
- <p>As you can see, my headings should use the typeface defined in <code>Diavlo_Black.otf</code>, while my body content should use <code>Diavlo_Book.otf</code>. However, in WebKit, this doesn&#8217;t work - it completely ignores any attribute except <code>font-family:</code> and <code>src:</code> in a <code>@font-face</code> declaration! Completely ignores them! Not only that - not <em>only</em> that - it disregards all but the last <code>@font-face</code> for a given <code>font-family:</code> attribute string!</p>
452
+ <p>As you can see, my headings should use the typeface defined in <code>Diavlo_Black.otf</code>, while my body content should use <code>Diavlo_Book.otf</code>. However, in WebKit, this doesnt work - it completely ignores any attribute except <code>font-family:</code> and <code>src:</code> in a <code>@font-face</code> declaration! Completely ignores them! Not only that - not <em>only</em> that - it disregards all but the last <code>@font-face</code> for a given <code>font-family:</code> attribute string!</p>
453
453
 
454
- <p>The implication here is that, to make <code>@font-face</code> work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare <em>completely imaginary, non-existent type families</em> to satisfy WebKit alone. Here&#8217;s the method I have used in the places I current implement <code>@font-face</code>:</p>
454
+ <p>The implication here is that, to make <code>@font-face</code> work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare <em>completely imaginary, non-existent type families</em> to satisfy WebKit alone. Heres the method I have used in the places I current implement <code>@font-face</code>:</p>
455
455
 
456
456
  <pre><code>@font-face {
457
457
  font-family: 'Diavlo Book';
@@ -471,7 +471,7 @@ div#content {
471
471
  font-family: 'Diavlo Book';
472
472
  }</code></pre>
473
473
 
474
- <p>Isn&#8217;t it horrible? Seriously, my eyes, they bleed. There&#8217;s lots of problems with this far beyond the lack of semanticity when it comes to the typeface names&#8230; let me see how many ways this breaks the purpose of <code>@font-face</code>:</p>
474
+ <p>Isnt it horrible? Seriously, my eyes, they bleed. Theres lots of problems with this far beyond the lack of semanticity when it comes to the typeface names let me see how many ways this breaks the purpose of <code>@font-face</code>:</p>
475
475
 
476
476
  <ul>
477
477
  <li>
@@ -479,33 +479,33 @@ div#content {
479
479
 
480
480
  <p>As soon as we begin to use <code>@font-face</code> in our page, we can no longer make any use of any other textual control attribute - <code>font-weight:</code>, <code>font-style:</code>, and <code>font-variant:</code> are no longer available to us, because they no longer correctly map to technical typeface variant/features.</p>
481
481
 
482
- <p>Also, many default elements are destroyed, unusable, without &#8216;fixing&#8217; - for instance, <code>&lt;b&gt;</code> would have no effect in a page styled for WebKit as above; We would have to specify something like <code>b {font-family: 'Diavlo Black';}</code> - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes?</p>
482
+ <p>Also, many default elements are destroyed, unusable, without fixing - for instance, <code>&lt;b&gt;</code> would have no effect in a page styled for WebKit as above; We would have to specify something like <code>b {font-family: 'Diavlo Black';}</code> - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes?</p>
483
483
 
484
- <p>If we want to use Javascript to modify the display of the content, we can&#8217;t simply adjust the mentioned textual control attributes - we have to know and change the entire <code>font-family:</code> array of strings.</p>
484
+ <p>If we want to use Javascript to modify the display of the content, we cant simply adjust the mentioned textual control attributes - we have to know and change the entire <code>font-family:</code> array of strings.</p>
485
485
  </li>
486
486
 
487
487
  <li>
488
488
  <p>You make us very wet.</p>
489
489
 
490
- <p>And by wet, I mean &#8216;not <abbr title="Don't Repeat Yourself">DRY</abbr>&#8217;. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our <abbr title="Cascading Style Sheets">CSS</abbr>, all of our Javascript, and make sure we update every occurrence of the typeface&#8217;s bastardized name.</p>
490
+ <p>And by wet, I mean not <abbr title="Don't Repeat Yourself">DRY</abbr>’. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our <abbr title="Cascading Style Sheets">CSS</abbr>, all of our Javascript, and make sure we update every occurrence of the typefaces bastardized name.</p>
491
491
  </li>
492
492
 
493
493
  <li>
494
- <p>You remove our user&#8217;s user choice, and waste bandwidth.</p>
494
+ <p>You remove our users user choice, and waste bandwidth.</p>
495
495
 
496
- <p>Since the names refer to families that don&#8217;t, in fact, exist, the browser can&#8217;t override the declaration with a user&#8217;s installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser won&#8217;t use that - it doesn&#8217;t know to use &#8216;Diavlo&#8217;, which the user has installed, because it was told to use &#8216;Diavlo Black&#8217;, which no user in the entire world has installed on their computer.</p>
496
+ <p>Since the names refer to families that dont, in fact, exist, the browser cant override the declaration with a users installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser wont use that - it doesnt know to use Diavlo’, which the user has installed, because it was told to use Diavlo Black’, which no user in the entire world has installed on their computer.</p>
497
497
  </li>
498
498
  </ul>
499
499
 
500
- <p>This whole thing is rather worrying - I&#8217;ve heard Opera has <code>@font-face</code> support, though I haven&#8217;t had time to test this myself, so I don&#8217;t know if it actually does - or, for that matter, if it does it &#8216;correctly&#8217;, or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support <code>@font-face</code> (Microsoft&#8217;s unrelated <code>@font-face</code> declaration notwithstanding) - I really don&#8217;t want to see it&#8217;s early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that.</p>
500
+ <p>This whole thing is rather worrying - Ive heard Opera has <code>@font-face</code> support, though I havent had time to test this myself, so I dont know if it actually does - or, for that matter, if it does it correctly’, or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support <code>@font-face</code> (Microsofts unrelated <code>@font-face</code> declaration notwithstanding) - I really dont want to see its early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that.</p>
501
501
 
502
- <p>In summary&#8230; come on, WebKit team, this isn&#8217;t like you - you&#8217;re always the ones with the closest-to-standard implementation, and the cleanest code, and&#8230; hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. You&#8217;re pioneering a leap into the future when it comes to the Web - this is as important, or <em>more</em> important, than Mosiac&#8217;s allowing of images was.</p>
502
+ <p>In summary come on, WebKit team, this isnt like you - youre always the ones with the closest-to-standard implementation, and the cleanest code, and hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. Youre pioneering a leap into the future when it comes to the Web - this is as important, or <em>more</em> important, than Mosiacs allowing of images was.</p>
503
503
 
504
- <p>To put it succinctly - don&#8217;t fuck this up, y&#8217;all.</p>
504
+ <p>To put it succinctly - dont fuck this up, yall.</p>
505
505
  <div class="footnotes"><hr /><ol><li id="fn:1">
506
- <p>These are fonts by <a href="jos">Jos Buivenga</a>, quite the amazing person. His (free) fonts are, uniquely, released for use on the web in <code>@font-face</code> declarations - unlike the vast majority of other (even free to download) typefaces, which have ridiculously restricting licenses and terms of use statements. Props, Jos - you&#8217;re a pioneer, and deserve recognition as such. <a href="#fnref:1" rev="footnote">&#8617;</a></p>
506
+ <p>These are fonts by <a href="jos">Jos Buivenga</a>, quite the amazing person. His (free) fonts are, uniquely, released for use on the web in <code>@font-face</code> declarations - unlike the vast majority of other (even free to download) typefaces, which have ridiculously restricting licenses and terms of use statements. Props, Jos - youre a pioneer, and deserve recognition as such. <a href="#fnref:1" rev="footnote">↩</a></p>
507
507
  </li><li id="fn:2">
508
- <p>To give Microsoft a little credit, something I rarely do&#8230; Yes, I&#8217;m aware Microsoft submitted EOT to the <abbr title="World Wide Web Consortium">W3C</abbr> as a proposal - the problem isn&#8217;t with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century? <a href="#fnref:2" rev="footnote">&#8617;</a></p>
508
+ <p>To give Microsoft a little credit, something I rarely do Yes, Im aware Microsoft submitted EOT to the <abbr title="World Wide Web Consortium">W3C</abbr> as a proposal - the problem isnt with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century? <a href="#fnref:2" rev="footnote">↩</a></p>
509
509
  </li></ol></div>
510
510
  *** Output of to_latex ***
511
511
  \hypertarget{webkit_safari_31_and_the_css_fontface_declaration}{}\section*{{WebKit (Safari 3.1) and the CSS @font-face declaration}}\label{webkit_safari_31_and_the_css_fontface_declaration}
@@ -0,0 +1,22 @@
1
+ Make sure extended attributes get escaped when generating HTML: https://github.com/bhollis/maruku/issues/114
2
+ *** Parameters: ***
3
+ {} # params
4
+ *** Markdown input: ***
5
+ *foo*{: style='ball & chain'}
6
+
7
+ *foo*{: style='ball\008 chain'}
8
+
9
+ *foo*{: style='ball\" badAttribute=\"chain'}
10
+ *** Output of inspect ***
11
+ md_el(:document, [
12
+ md_par(md_em("foo", [["style", "ball & chain"]])),
13
+ md_par(md_em("foo", [["style", "ball\\008 chain"]])),
14
+ md_par(md_em("foo", [["style", "ball\" badAttribute=\"chain"]]))
15
+ ])
16
+ *** Output of to_html ***
17
+ <p><em style="ball &amp; chain">foo</em>
18
+ </p>
19
+ <p><em style="ball\008 chain">foo</em>
20
+ </p>
21
+ <p><em style="ball&quot; badAttribute=&quot;chain">foo</em>
22
+ </p>
@@ -0,0 +1,48 @@
1
+ Adds CDATA only when necessary.
2
+ NOTE: CDATA is output because we use XHTML - for HTML mode it should be omitted.
3
+ *** Parameters: ***
4
+ {}
5
+ *** Markdown input: ***
6
+ <script>
7
+ var x = true && true;
8
+ </script>
9
+
10
+ <script>
11
+ var x = true;
12
+ </script>
13
+
14
+ <script>foo && bar</script>
15
+
16
+ <script>alert('foo');</script>
17
+
18
+ <style type="text/css">
19
+ p > .highlight {
20
+ color: red;
21
+ background-image: url('/foo?bar&baz');
22
+ }
23
+ </style>
24
+
25
+ <style type="text/css">
26
+ .highlight {
27
+ color: red;
28
+ }
29
+ </style>
30
+ *** Output of inspect ***
31
+
32
+ *** Output of to_html ***
33
+ <script>//<![CDATA[
34
+ var x = true && true;
35
+ //]]></script><script>
36
+ var x = true;
37
+ </script><script>//<![CDATA[
38
+ foo && bar
39
+ //]]></script><script>alert('foo');</script><style type='text/css'>/*<![CDATA[*/
40
+ p > .highlight {
41
+ color: red;
42
+ background-image: url('/foo?bar&baz');
43
+ }
44
+ /*]]>*/</style><style type='text/css'>
45
+ .highlight {
46
+ color: red;
47
+ }
48
+ </style>
@@ -19,10 +19,10 @@ h | h
19
19
  md_el(:document,[
20
20
  md_par(["hello"], [["summary", "Table summary"], [:class, "class1"], ["style", "color:red"]]),
21
21
  md_el(:table,[
22
- md_el(:head_cell,["h"],{},[]),
23
- md_el(:head_cell,["h"],{},[]),
24
- md_el(:cell,[" c1"],{},[[:ref, "t"]]),
25
- md_el(:cell,["c2"],{},[])
22
+ [md_el(:head_cell,["h"],{},[]),
23
+ md_el(:head_cell,["h"],{},[])],
24
+ [md_el(:cell,[" c1"],{},[[:ref, "t"]]),
25
+ md_el(:cell,["c2"],{},[])]
26
26
  ],{:align=>[:left, :left]},[["summary", "Table summary"], [:class, "class1"], ["style", "color:red"]]),
27
27
  md_el(:ald,[],{:ald=>[["scope", "row"]],:ald_id=>"t"},[])
28
28
  ],{},[])
@@ -0,0 +1,79 @@
1
+ Codes which look like lists
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+
6
+ This is code (4 spaces):
7
+
8
+ * Code
9
+ * Code (again)
10
+
11
+ This is also code
12
+
13
+ * Code
14
+ * Code (again)
15
+
16
+ This is code (1 tab):
17
+
18
+ * Code
19
+ * Code (again)
20
+
21
+
22
+ *** Output of inspect ***
23
+ md_el(:document,[
24
+ md_par(["This is code (4 spaces):"]),
25
+ md_el(:code,[],{:raw_code=>"* Code
26
+ * Code (again)", :lang=>nil},[]),
27
+ md_par(["This is also code"]),
28
+ md_el(:code,[],{:raw_code=>"* Code
29
+ * Code (again)", :lang=>nil},[]),
30
+ md_par(["This is code (1 tab):"]),
31
+ md_el(:code,[],{:raw_code=>"* Code
32
+ * Code (again)", :lang=>nil},[])
33
+ ],{},[])
34
+ *** Output of to_html ***
35
+ <p>This is code (4 spaces):</p>
36
+
37
+ <pre><code>* Code
38
+ * Code (again)</code></pre>
39
+
40
+ <p>This is also code</p>
41
+
42
+ <pre><code>* Code
43
+ * Code (again)</code></pre>
44
+
45
+ <p>This is code (1 tab):</p>
46
+
47
+ <pre><code>* Code
48
+ * Code (again)</code></pre>
49
+ *** Output of to_latex ***
50
+ This is code (4 spaces):
51
+
52
+ \begin{verbatim}* Code
53
+ * Code (again)\end{verbatim}
54
+ This is also code
55
+
56
+ \begin{verbatim}* Code
57
+ * Code (again)\end{verbatim}
58
+ This is code (1 tab):
59
+
60
+ \begin{verbatim}* Code
61
+ * Code (again)\end{verbatim}
62
+ *** Output of to_md ***
63
+ This is code (4 spaces):
64
+
65
+ * Code
66
+ * Code (again)
67
+
68
+ This is also code
69
+
70
+ * Code
71
+ * Code (again)
72
+
73
+ This is code (1 tab):
74
+
75
+ * Code
76
+ * Code (again)
77
+ *** Output of to_s ***
78
+ This is code (4 spaces):This is also codeThis is code (1 tab):
79
+
@@ -0,0 +1,16 @@
1
+ Handle blocks of block HTML without a newline. https://github.com/bhollis/maruku/issues/123
2
+ REXML won't clean up the HTML the way Nokogiri will...
3
+ *** Parameters: ***
4
+ { }
5
+ *** Markdown input: ***
6
+ Heres some HTML.
7
+ <div>
8
+ Foo
9
+ </div>
10
+ *** Output of inspect ***
11
+
12
+ *** Output of to_html ***
13
+ <p>Heres some HTML.</p>
14
+ <div>
15
+ Foo
16
+ </div>
@@ -9,15 +9,9 @@ Write a comment here
9
9
  *** Output of inspect ***
10
10
  md_el(:document,[
11
11
  md_el(:table,[
12
- md_el(:head_cell,[],{},[]),
13
- md_el(:head_cell,["1"],{},[]),
14
- md_el(:head_cell,["2"],{},[]),
15
- md_el(:cell,["A"],{},[]),
16
- md_el(:cell,["X"],{},[]),
17
- md_el(:cell,[],{},[]),
18
- md_el(:cell,["B"],{},[]),
19
- md_el(:cell,[],{},[]),
20
- md_el(:cell,["X"],{},[])
12
+ [md_el(:head_cell,[],{},[]),md_el(:head_cell,["1"],{},[]),md_el(:head_cell,["2"],{},[])],
13
+ [md_el(:cell,["A"],{},[]),md_el(:cell,["X"],{},[]),md_el(:cell,[],{},[])],
14
+ [md_el(:cell,["B"],{},[]),md_el(:cell,[],{},[]),md_el(:cell,["X"],{},[])]
21
15
  ],{:align=>[:left, :left, :left]},[])
22
16
  ],{},[])
23
17
  *** Output of to_html ***
@@ -26,18 +26,12 @@ It should read like this: `&copy;`.
26
26
  md_el(:document,[
27
27
  md_par(["Maruku translates HTML entities to the equivalent in LaTeX:"]),
28
28
  md_el(:table,[
29
- md_el(:head_cell,["Entity"],{},[]),
30
- md_el(:head_cell,["Result"],{},[]),
31
- md_el(:cell,[md_code("&copy;")],{},[]),
32
- md_el(:cell,[md_entity("copy")],{},[]),
33
- md_el(:cell,[md_code("&pound;")],{},[]),
34
- md_el(:cell,[md_entity("pound")],{},[]),
35
- md_el(:cell,[md_code("a&nbsp;b")],{},[]),
36
- md_el(:cell,["a", md_entity("nbsp"), "b"],{},[]),
37
- md_el(:cell,[md_code("&lambda;")],{},[]),
38
- md_el(:cell,[md_entity("lambda")],{},[]),
39
- md_el(:cell,[md_code("&mdash;")],{},[]),
40
- md_el(:cell,[md_entity("mdash")],{},[])
29
+ [md_el(:head_cell,["Entity"],{},[]),md_el(:head_cell,["Result"],{},[])],
30
+ [md_el(:cell,[md_code("&copy;")],{},[]),md_el(:cell,[md_entity("copy")],{},[])],
31
+ [md_el(:cell,[md_code("&pound;")],{},[]),md_el(:cell,[md_entity("pound")],{},[])],
32
+ [md_el(:cell,[md_code("a&nbsp;b")],{},[]),md_el(:cell,["a", md_entity("nbsp"), "b"],{},[])],
33
+ [md_el(:cell,[md_code("&lambda;")],{},[]),md_el(:cell,[md_entity("lambda")],{},[])],
34
+ [md_el(:cell,[md_code("&mdash;")],{},[]),md_el(:cell,[md_entity("mdash")],{},[])]
41
35
  ],{:align=>[:left, :left]},[]),
42
36
  md_par([
43
37
  "Entity-substitution does not happen in code blocks or inline code."
@@ -12,12 +12,12 @@ Content Cell | Content Cell
12
12
  *** Output of inspect ***
13
13
  md_el(:document,[
14
14
  md_el(:table,[
15
- md_el(:head_cell,["First Header"],{},[]),
16
- md_el(:head_cell,["Second Header"],{},[]),
17
- md_el(:cell,["Content Cell"],{},[]),
18
- md_el(:cell,["Content Cell"],{},[]),
19
- md_el(:cell,["Content Cell"],{},[]),
20
- md_el(:cell,["Content Cell"],{},[])
15
+ [md_el(:head_cell,["First Header"],{},[]),
16
+ md_el(:head_cell,["Second Header"],{},[])],
17
+ [md_el(:cell,["Content Cell"],{},[]),
18
+ md_el(:cell,["Content Cell"],{},[])],
19
+ [md_el(:cell,["Content Cell"],{},[]),
20
+ md_el(:cell,["Content Cell"],{},[])]
21
21
  ],{:align=>[:left, :left]},[])
22
22
  ],{},[])
23
23
  *** Output of to_html ***
@@ -31,36 +31,28 @@ john = Twitter::Client.new(
31
31
  ~~~~~
32
32
  *** Output of inspect ***
33
33
  md_el(:document, [
34
- md_el(:code, [], {:raw_code=>"\njohn = Twitter::Client.new(\n :oauth_token => \"John's access token\",\n :oauth_token_secret => \"John's access secret\"\n)\n", :lang=>"ruby"}),
35
- md_el(:code, [], {:raw_code=>"\njohn = Twitter::Client.new(\n :oauth_token => \"John's access token\",\n :oauth_token_secret => \"John's access secret\"\n)\n", :lang=>nil}),
36
- md_el(:code, [], {:raw_code=>"\njohn = Twitter::Client.new(\n :oauth_token => \"John's access token\",\n :oauth_token_secret => \"John's access secret\"\n)\n", :lang=>"ruby"}),
37
- md_el(:code, [], {:raw_code=>"\njohn = Twitter::Client.new(\n :oauth_token => \"John's access token\",\n :oauth_token_secret => \"John's access secret\"\n)\n", :lang=>nil})
34
+ md_el(:code, [], {:raw_code=>"john = Twitter::Client.new(\n :oauth_token => \"John's access token\",\n :oauth_token_secret => \"John's access secret\"\n)", :lang=>"ruby"}),
35
+ md_el(:code, [], {:raw_code=>"john = Twitter::Client.new(\n :oauth_token => \"John's access token\",\n :oauth_token_secret => \"John's access secret\"\n)", :lang=>nil}),
36
+ md_el(:code, [], {:raw_code=>"john = Twitter::Client.new(\n :oauth_token => \"John's access token\",\n :oauth_token_secret => \"John's access secret\"\n)", :lang=>"ruby"}),
37
+ md_el(:code, [], {:raw_code=>"john = Twitter::Client.new(\n :oauth_token => \"John's access token\",\n :oauth_token_secret => \"John's access secret\"\n)", :lang=>nil})
38
38
  ])
39
39
  *** Output of to_html ***
40
- <pre class="ruby"><code class="ruby">
41
- john = Twitter::Client.new(
40
+ <pre class="ruby"><code class="ruby">john = Twitter::Client.new(
42
41
  :oauth_token =&gt; "John's access token",
43
42
  :oauth_token_secret =&gt; "John's access secret"
44
- )
45
- </code></pre>
43
+ )</code></pre>
46
44
 
47
- <pre><code>
48
- john = Twitter::Client.new(
45
+ <pre><code>john = Twitter::Client.new(
49
46
  :oauth_token =&gt; "John's access token",
50
47
  :oauth_token_secret =&gt; "John's access secret"
51
- )
52
- </code></pre>
48
+ )</code></pre>
53
49
 
54
- <pre class="ruby"><code class="ruby">
55
- john = Twitter::Client.new(
50
+ <pre class="ruby"><code class="ruby">john = Twitter::Client.new(
56
51
  :oauth_token =&gt; "John's access token",
57
52
  :oauth_token_secret =&gt; "John's access secret"
58
- )
59
- </code></pre>
53
+ )</code></pre>
60
54
 
61
- <pre><code>
62
- john = Twitter::Client.new(
55
+ <pre><code>john = Twitter::Client.new(
63
56
  :oauth_token =&gt; "John's access token",
64
57
  :oauth_token_secret =&gt; "John's access secret"
65
- )
66
- </code></pre>
58
+ )</code></pre>
@@ -11,8 +11,7 @@ john = Twitter::Client.new(
11
11
  *** Output of inspect ***
12
12
 
13
13
  *** Output of to_html ***
14
- <pre class="ruby"><code class="ruby">
15
- <span class="ident">john</span> <span class="punct">=</span> <span class="constant">Twitter</span><span class="punct">::</span><span class="constant">Client</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span>
14
+ <pre class="ruby"><code class="ruby"><span class="ident">john</span> <span class="punct">=</span> <span class="constant">Twitter</span><span class="punct">::</span><span class="constant">Client</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span>
16
15
  <span class="symbol">:oauth_token</span> <span class="punct">=&gt;</span> <span class="punct">"</span><span class="string">John's access token</span><span class="punct">",</span>
17
16
  <span class="symbol">:oauth_token_secret</span> <span class="punct">=&gt;</span> <span class="punct">"</span><span class="string">John's access secret</span><span class="punct">"</span>
18
17
  <span class="punct">)</span></code></pre>