From 477bd91567577bd0d3d3604e110bf95d5eb5ea96 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Sun, 21 Aug 2011 13:41:20 -0500 Subject: [PATCH] More Maruku #to_markdown fixes. Is there any point to this? What version of Markdown are we targetting, anyway? --- .../maruku/lib/maruku/output/to_markdown.rb | 14 +++++++------- .../maruku/spec/block_docs/abbreviations.md | 4 ++-- .../spec/block_docs/attributes/attributes.md | 11 ++++------- .../maruku/spec/block_docs/blanks_in_code.md | 4 +--- vendor/plugins/maruku/spec/block_docs/code3.md | 2 ++ vendor/plugins/maruku/spec/block_docs/email.md | 15 ++++++++++++--- .../plugins/maruku/spec/block_docs/entities.md | 12 ++++++------ .../plugins/maruku/spec/block_docs/escaping.md | 5 +++-- .../maruku/spec/block_docs/extra_header_id.md | 6 +++--- .../maruku/spec/block_docs/hex_entities.md | 9 +++++---- vendor/plugins/maruku/spec/block_docs/hrule.md | 5 +++++ vendor/plugins/maruku/spec/block_docs/images.md | 16 +++++++++++----- vendor/plugins/maruku/spec/block_docs/lists12.md | 6 +++--- .../plugins/maruku/spec/block_docs/syntax_hl.md | 11 +++++------ 14 files changed, 69 insertions(+), 51 deletions(-) diff --git a/vendor/plugins/maruku/lib/maruku/output/to_markdown.rb b/vendor/plugins/maruku/lib/maruku/output/to_markdown.rb index 76619d62..a24434f5 100644 --- a/vendor/plugins/maruku/lib/maruku/output/to_markdown.rb +++ b/vendor/plugins/maruku/lib/maruku/output/to_markdown.rb @@ -28,7 +28,7 @@ class String # " andrea censi " => [" andrea ", "censi "] def mysplit res = split.map{|x| x+" "} - if self[0] == 32 + if self[0] == ' ' res[0] = " " + res[0] end res @@ -59,7 +59,7 @@ module MaRuKu; module Out; module Markdown end def to_md_code(context) - @raw_code.split("\n").collect { |line| " " + line}.join("\n") + "\n" + @raw_code.split("\n").collect { |line| " " + line}.join("\n") + "\n\n" end def to_md_quote(context) @@ -68,7 +68,7 @@ module MaRuKu; module Out; module Markdown end def to_md_hrule(context) - "* * *" + "* * *\n" end def to_md_emphasis(context) @@ -101,7 +101,7 @@ module MaRuKu; module Out; module Markdown end def to_md_im_link(context) - "[#{children_to_md(context)}](#{@url}#{" #{@title}" if @title})" + "[#{children_to_md(context)}](#{@url}#{" \"#{@title}\"" if @title})" end def to_md_link(context) @@ -109,14 +109,14 @@ module MaRuKu; module Out; module Markdown end def to_md_im_image(context) - "![#{children_to_md(context)}](#{@url}#{" #{@title}" if @title})" + "![#{children_to_md(context)}](#{@url}#{" \"#{@title}\"" if @title})" end def to_md_image(context) "![#{children_to_md(context)}][#{@ref_id}]" end def to_md_ref_definition(context) - "[#{@ref_id}] #{@url}#{" #{@title}" if @title}" + "[#{@ref_id}] #{@url}#{" \"#{@title}\"" if @title}" end def to_md_li_span(context) @@ -130,7 +130,7 @@ module MaRuKu; module Out; module Markdown def to_md_abbr_def(context) "*[#{self.abbr}]: #{self.text}\n" end - + def to_md_ol(context) len = (context[:line_length] || DefaultLineLength) - 2 md = "" diff --git a/vendor/plugins/maruku/spec/block_docs/abbreviations.md b/vendor/plugins/maruku/spec/block_docs/abbreviations.md index 33e33a05..a0c0b5cf 100644 --- a/vendor/plugins/maruku/spec/block_docs/abbreviations.md +++ b/vendor/plugins/maruku/spec/block_docs/abbreviations.md @@ -40,12 +40,12 @@ The HTML specification is maintained by the W3C. Operation Tigra Genesis is going well. *** Output of to_md *** -The HTMLspecification is maintained by +The HTML specification is maintained by the W3C. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium -Operation Tigra Genesisis going well. +Operation Tigra Genesis is going well. *[Tigra Genesis]: *** Output of to_s *** diff --git a/vendor/plugins/maruku/spec/block_docs/attributes/attributes.md b/vendor/plugins/maruku/spec/block_docs/attributes/attributes.md index d2830520..34392d64 100644 --- a/vendor/plugins/maruku/spec/block_docs/attributes/attributes.md +++ b/vendor/plugins/maruku/spec/block_docs/attributes/attributes.md @@ -51,18 +51,15 @@ Paragraph with a. Paragraph with \emph{emphasis} *** Output of to_md *** -## Header with attributes ## {#header1} +## Header with attributes ## -### Header with attributes ### {#header2} +### Header with attributes ### ### Header no attributes ### -{:warn2}Paragraph with a. -{#par1} +Paragraph with a. -Paragraph with *emphasis*{:hello notfound} - {#par2} +Paragraph with *emphasis* -{:hello: .chello} *** Output of to_s *** Header with attributesHeader with attributesHeader no attributesParagraph with a.Paragraph with emphasis diff --git a/vendor/plugins/maruku/spec/block_docs/blanks_in_code.md b/vendor/plugins/maruku/spec/block_docs/blanks_in_code.md index f06edb8a..78fce225 100644 --- a/vendor/plugins/maruku/spec/block_docs/blanks_in_code.md +++ b/vendor/plugins/maruku/spec/block_docs/blanks_in_code.md @@ -74,17 +74,15 @@ This block is composed of three lines: This block is composed of 5 - one four - This block is composed of 2 - two + *** Output of to_s *** This block is composed of three lines:This block is composed of 5This block is composed of 2 diff --git a/vendor/plugins/maruku/spec/block_docs/code3.md b/vendor/plugins/maruku/spec/block_docs/code3.md index d55afa3e..18e34ab2 100644 --- a/vendor/plugins/maruku/spec/block_docs/code3.md +++ b/vendor/plugins/maruku/spec/block_docs/code3.md @@ -63,6 +63,7 @@ This is not code This is code (4 spaces): Code + This is not code Code @@ -70,6 +71,7 @@ This is not code This is code (1 tab): Code + This is not code Code diff --git a/vendor/plugins/maruku/spec/block_docs/email.md b/vendor/plugins/maruku/spec/block_docs/email.md index 70c3063f..d58e579d 100644 --- a/vendor/plugins/maruku/spec/block_docs/email.md +++ b/vendor/plugins/maruku/spec/block_docs/email.md @@ -6,15 +6,24 @@ Write a comment abouth the test here. This is an email address: +Address: *** Output of inspect *** md_el(:document,[ - md_par(["This is an email address: ", md_email("andrea@invalid.it")]) + md_par(["This is an email address: ", md_email("andrea@invalid.it")]), + md_par(["Address: ", md_email("andrea@invalid.it")]) ],{},[]) *** Output of to_html ***

This is an email address: andrea@invalid.it

+ +

Address: andrea@invalid.it

*** Output of to_latex *** This is an email address: \href{mailto:andrea@invalid.it}{andrea\char64invalid\char46it} + +Address: \href{mailto:andrea@invalid.it}{andrea\char64invalid\char46it} *** Output of to_md *** -This is an email address: -*** Output of to_s *** This is an email address: + + +Address: +*** Output of to_s *** +This is an email address: Address: diff --git a/vendor/plugins/maruku/spec/block_docs/entities.md b/vendor/plugins/maruku/spec/block_docs/entities.md index 1a8707f0..2ac4f377 100644 --- a/vendor/plugins/maruku/spec/block_docs/entities.md +++ b/vendor/plugins/maruku/spec/block_docs/entities.md @@ -19,7 +19,7 @@ The following should not be translated: © -It should read just like this: `©`. +It should read like this: `©`. *** Output of inspect *** @@ -44,7 +44,7 @@ md_el(:document,[ ]), md_par(["The following should not be translated:"]), md_el(:code,[],{:raw_code=>"©"},[]), - md_par(["It should read just like this: ", md_code("©"), "."]) + md_par(["It should read like this: ", md_code("©"), "."]) ],{},[]) *** Output of to_html ***

Maruku translates HTML entities to the equivalent in LaTeX:

@@ -60,7 +60,7 @@ md_el(:document,[
©
-

It should read just like this: ©.

+

It should read like this: ©.

*** Output of to_latex *** Maruku translates HTML entities to the equivalent in \LaTeX\xspace : @@ -79,7 +79,7 @@ Entity-substitution does not happen in code blocks or inline code. The following should not be translated: \begin{verbatim}©\end{verbatim} -It should read just like this: {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char38copy\char59}}. +It should read like this: {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char38copy\char59}}. *** Output of to_md *** Maruku translates HTML entities to the equivalent in LaTeX: @@ -99,6 +99,6 @@ The following should not be translated: © -It should read just like this: `©`. +It should read like this: `©`. *** Output of to_s *** -Maruku translates HTML entities to the equivalent in LaTeX:EntityResultabEntity-substitution does not happen in code blocks or inline code.The following should not be translated:It should read just like this: . +Maruku translates HTML entities to the equivalent in LaTeX:EntityResultabEntity-substitution does not happen in code blocks or inline code.The following should not be translated:It should read like this: . diff --git a/vendor/plugins/maruku/spec/block_docs/escaping.md b/vendor/plugins/maruku/spec/block_docs/escaping.md index a067569c..cc508d4f 100644 --- a/vendor/plugins/maruku/spec/block_docs/escaping.md +++ b/vendor/plugins/maruku/spec/block_docs/escaping.md @@ -55,8 +55,9 @@ End of {\colorbox[rgb]{1.00,0.93,1.00}{\tt paragraph~}} Hello: ! \! \` \{ \} \[ \] \( \) \# \. \! * \* * -Ora, *emphasis*, **bold**, * <- due asterischi-> * , un underscore-> _ , _emphasis_, - incre*dible*e! +Ora, *emphasis*, **bold**, * <- due +asterischi-> * , un underscore-> _ , +*emphasis*, incre*dible*e! This is ``Code with a special: -> ` <- ``(after) diff --git a/vendor/plugins/maruku/spec/block_docs/extra_header_id.md b/vendor/plugins/maruku/spec/block_docs/extra_header_id.md index 088098de..97cc086e 100644 --- a/vendor/plugins/maruku/spec/block_docs/extra_header_id.md +++ b/vendor/plugins/maruku/spec/block_docs/extra_header_id.md @@ -53,11 +53,11 @@ Then you can create links to different parts of the same document like this: \hyperlink{header1}{Link back to header 1}, \hyperlink{header2}{Link back to header 2}, \hyperlink{header3}{Link back to header 3} *** Output of to_md *** -# Header 1 # {#header1} +# Header 1 # -## Header 2 ## {#header2} +## Header 2 ## -### Header 3 ### {#header3} +### Header 3 ### Then you can create links to different parts of the same document like this: diff --git a/vendor/plugins/maruku/spec/block_docs/hex_entities.md b/vendor/plugins/maruku/spec/block_docs/hex_entities.md index 9de0bbd4..537a6683 100644 --- a/vendor/plugins/maruku/spec/block_docs/hex_entities.md +++ b/vendor/plugins/maruku/spec/block_docs/hex_entities.md @@ -29,9 +29,10 @@ md_el(:document,[ Examples of numeric character references include \copyright{} or \copyright{} for the copyright symbol, $A${} or $A${} for the Greek capital letter alpha, and or for the Arabic letter alef. *** Output of to_md *** Examples of numeric character -references include &169;or &169;for the -copyright symbol, &913;or &913;for the -Greek capital letter alpha, and &1575; -or &1575;for the Arabic letter alef. +references include &169; or &169; for +the copyright symbol, &913; or &913; +for the Greek capital letter alpha, +and &1575; or &1575; for the Arabic +letter alef. *** Output of to_s *** Examples of numeric character references include or for the copyright symbol, or for the Greek capital letter alpha, and or for the Arabic letter alef. diff --git a/vendor/plugins/maruku/spec/block_docs/hrule.md b/vendor/plugins/maruku/spec/block_docs/hrule.md index e4cad07e..8cc1f19d 100644 --- a/vendor/plugins/maruku/spec/block_docs/hrule.md +++ b/vendor/plugins/maruku/spec/block_docs/hrule.md @@ -35,5 +35,10 @@ md_el(:document,[ \vspace{.5em} \hrule \vspace{.5em} *** Output of to_md *** +* * * +* * * +* * * +* * * +* * * *** Output of to_s *** diff --git a/vendor/plugins/maruku/spec/block_docs/images.md b/vendor/plugins/maruku/spec/block_docs/images.md index d142bd58..3fb25f8a 100644 --- a/vendor/plugins/maruku/spec/block_docs/images.md +++ b/vendor/plugins/maruku/spec/block_docs/images.md @@ -72,15 +72,21 @@ I'{}ll say it one more time: this page does not use This is double size: *** Output of to_md *** -This page does not utilize ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss) +This page does not utilize +![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss) -Please mouseover to see the title: ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss "Title ok!") +Please mouseover to see the title: +![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss "Title ok!") -Please mouseover to see the title: ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss 'Title ok!') +Please mouseover to see the title: +![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss "Title ok!") -I'll say it one more time: this page does not use ![Cascading Style Sheets] [css] +I'll say it one more time: this +page does not use +![Cascading Style Sheets][css] -This is double size: ![Cascading Style Sheets] [css2] +This is double size: +![Cascading Style Sheets][css2] [css]: http://jigsaw.w3.org/css-validator/images/vcss "Optional title attribute" diff --git a/vendor/plugins/maruku/spec/block_docs/lists12.md b/vendor/plugins/maruku/spec/block_docs/lists12.md index bbad0e35..fb74a1cb 100644 --- a/vendor/plugins/maruku/spec/block_docs/lists12.md +++ b/vendor/plugins/maruku/spec/block_docs/lists12.md @@ -33,9 +33,9 @@ md_el(:document,[ \end{itemize} *** Output of to_md *** -- -- -- +- A +- ? +- B *** Output of to_s *** A?B diff --git a/vendor/plugins/maruku/spec/block_docs/syntax_hl.md b/vendor/plugins/maruku/spec/block_docs/syntax_hl.md index fb32146d..7e6bfe8e 100644 --- a/vendor/plugins/maruku/spec/block_docs/syntax_hl.md +++ b/vendor/plugins/maruku/spec/block_docs/syntax_hl.md @@ -47,15 +47,14 @@ This is ruby code: *** Output of to_md *** This is ruby code: - require 'maruku' - - puts Maruku.new($stdin).to_html + require 'maruku' + + puts Maruku.new($stdin).to_html This is ruby code: - require 'maruku' -{: lang=ruby html_use_syntax} + require 'maruku' - puts Maruku.new($stdin).to_html + puts Maruku.new($stdin).to_html *** Output of to_s *** This is ruby code:This is ruby code: