From 030d94e1c3cd4be0ab9d7c16fccfa973cedb5d38 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Thu, 4 Jan 2007 22:52:16 +0000 Subject: Refactored SGML escaping functions and "in tag" functions to Text/Shared/Pandoc. (escapeSGML, stringToSGML, inTag, inTagSimple, inTagIndented, selfClosingTag) These can be used by both the HTML and Docbook writers. git-svn-id: https://pandoc.googlecode.com/svn/trunk@417 788f1e2b-df1e-0410-8736-df70ead52e1b --- tests/s5.basic.html | 2 +- tests/s5.fragment.html | 2 +- tests/s5.inserts.html | 2 +- tests/writer.docbook | 29 +++++++++++++++-------------- tests/writer.html | 48 ++++++++++++++++++++++++------------------------ tests/writer.smart.html | 44 ++++++++++++++++++++++---------------------- 6 files changed, 64 insertions(+), 63 deletions(-) (limited to 'tests') diff --git a/tests/s5.basic.html b/tests/s5.basic.html index ac06eabd0..50ce30968 100644 --- a/tests/s5.basic.html +++ b/tests/s5.basic.html @@ -768,7 +768,7 @@ window.onresize = function(){setTimeout('fontScale()', 50);}

Smarty

diff --git a/tests/s5.fragment.html b/tests/s5.fragment.html index 370b9c111..c40f2514e 100644 --- a/tests/s5.fragment.html +++ b/tests/s5.fragment.html @@ -6,7 +6,7 @@

Smarty

    -
  • "Hello there"
  • +
  • "Hello there"
  • Here's a -- dash
  • And 'ellipses'...
diff --git a/tests/s5.inserts.html b/tests/s5.inserts.html index 7be33a2c8..c7e544409 100644 --- a/tests/s5.inserts.html +++ b/tests/s5.inserts.html @@ -21,7 +21,7 @@ STUFF INSERTED

Smarty

    -
  • "Hello there"
  • +
  • "Hello there"
  • Here's a -- dash
  • And 'ellipses'...
diff --git a/tests/writer.docbook b/tests/writer.docbook index 3cf7b6bcf..150b63bac 100644 --- a/tests/writer.docbook +++ b/tests/writer.docbook @@ -89,7 +89,7 @@ sub status { - print "working"; + print "working"; } @@ -133,7 +133,7 @@ sub status { sub status { - print "working"; + print "working"; }
@@ -177,7 +177,7 @@ sub status { ---- (should be four hyphens) sub status { - print "working"; + print "working"; } this code block is indented by one tab @@ -188,7 +188,7 @@ this code block is indented by one tab this code block is indented by two tabs -These should not be escaped: \$ \\ \> \[ \{ +These should not be escaped: \$ \\ \> \[ \{
@@ -577,15 +577,16 @@ These should not be escaped: \$ \\ \> \[ \{ word. - This is code: >, $, + This is code: >, $, \, \$, - <html>. + <html>.
Smart quotes, ellipses, dashes - "Hello," said the spider. "'Shelob' is my name." + "Hello," said the spider. "'Shelob' is my + name." 'A', 'B', and 'C' are letters. @@ -594,11 +595,11 @@ These should not be escaped: \$ \\ \> \[ \{ 'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.' - 'He said, "I want to go."' Were you alive in the 70's? + 'He said, "I want to go."' Were you alive in the 70's? Here is some quoted 'code' and a - "quoted link". + "quoted link". Some dashes: one---two --- three--four -- five. @@ -672,7 +673,7 @@ These should not be escaped: \$ \\ \> \[ \{ $22,000 is a lot of money. So is $34,000. (It - worked if "lot" is emphasized.) + worked if "lot" is emphasized.) @@ -909,17 +910,17 @@ Cat & 1 \\ \hline
Auto-links should not occur here: - <http://example.com/> + <http://example.com/> -or here: <http://example.com/> +or here: <http://example.com/>
Images - From "Voyage dans la Lune" by Georges Melies (1902): + From "Voyage dans la Lune" by Georges Melies (1902): @@ -963,7 +964,7 @@ or here: <http://example.com/> footnote (as with list items). - { <code> } + { <code> } If you want, you can indent every line, but you can also be lazy diff --git a/tests/writer.html b/tests/writer.html index 191b1982e..8915a172c 100644 --- a/tests/writer.html +++ b/tests/writer.html @@ -39,7 +39,7 @@ here.

Code in a block quote:

sub status {
-    print "working";
+    print "working";
 }
 

A list:

@@ -60,7 +60,7 @@ here.

Example:

sub status {
-    print "working";
+    print "working";
 }
 
@@ -84,7 +84,7 @@ here.

---- (should be four hyphens)
 
 sub status {
-    print "working";
+    print "working";
 }
 
 this code block is indented by one tab
@@ -92,7 +92,7 @@ this code block is indented by one tab
 

And:

    this code block is indented by two tabs
 
-These should not be escaped:  \$ \\ \> \[ \{
+These should not be escaped:  \$ \\ \> \[ \{
 

Lists

@@ -255,12 +255,12 @@ These should not be escaped: \$ \\ \> \[ \{
foo

This should be a code block, though:

-
<div>
+
<div>
     foo
-</div>
+</div>
 

As should this:

-
<div>foo</div>
+
<div>foo</div>
 

Now, nested:

@@ -281,12 +281,12 @@ Blah This is another comment. -->

Code block:

-
<!-- Comment -->
+
<!-- Comment -->
 

Just plain comment, with trailing spaces on the line:

Code:

-
<hr />
+
<hr />
 

Hr's:


@@ -315,14 +315,14 @@ Blah

So is this word.

This is strong and em.

So is this word.

-

This is code: >, $, \, \$, <html>.

+

This is code: >, $, \, \$, <html>.


Smart quotes, ellipses, dashes

-

"Hello," said the spider. "'Shelob' is my name."

+

"Hello," said the spider. "'Shelob' is my name."

'A', 'B', and 'C' are letters.

'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'

-

'He said, "I want to go."' Were you alive in the 70's?

-

Here is some quoted 'code' and a "quoted link".

+

'He said, "I want to go."' Were you alive in the 70's?

+

Here is some quoted 'code' and a "quoted link".

Some dashes: one---two --- three--four -- five.

Dashes between numbers: 5-7, 255-66, 1987-1999.

Ellipses...and. . .and . . . .

@@ -342,7 +342,7 @@ Blah

These shouldn't be math:

  • To get the famous equation, write $e = mc^2$.
  • -
  • $22,000 is a lot of money. So is $34,000. (It worked if "lot" is emphasized.)
  • +
  • $22,000 is a lot of money. So is $34,000. (It worked if "lot" is emphasized.)
  • Escaped $: $73 this should be emphasized 23$.

Here's a LaTeX table:

@@ -355,11 +355,11 @@ Cat & 1 \\ \hline

Special Characters

Here is some unicode:

    -
  • I hat: Î
  • -
  • o umlaut: ö
  • -
  • section: §
  • -
  • set membership: ∈
  • -
  • copyright: ©
  • +
  • I hat: Î
  • +
  • o umlaut: ö
  • +
  • section: §
  • +
  • set membership: ∈
  • +
  • copyright: ©

AT&T has an ampersand in their name.

AT&T is another way to write it.

@@ -414,7 +414,7 @@ document.write(''+'Email link'+'<\/'+'a'+'>')

Foo biz.

With ampersands

Here's a link with an ampersand in the URL.

-

Here's a link with an amersand in the link text: AT&T.

+

Here's a link with an amersand in the link text: AT&T.

Here's an inline link.

Here's an inline link in pointy braces.

Autolinks

@@ -433,12 +433,12 @@ document.write(''+e+'<\/'+'a'+'>');

Blockquoted: http://example.com/

-

Auto-links should not occur here: <http://example.com/>

-
or here: <http://example.com/>
+

Auto-links should not occur here: <http://example.com/>

+
or here: <http://example.com/>
 

Images

-

From "Voyage dans la Lune" by Georges Melies (1902):

+

From "Voyage dans la Lune" by Georges Melies (1902):

lalune

Here is a movie movie icon.


@@ -458,7 +458,7 @@ document.write(''+e+'<\/'+'a'+'>');
  • Here's the long note. This one contains multiple blocks.

    Subsequent blocks are indented to show that they belong to the footnote (as with list items).

    -
      { <code> }
    +
      { <code> }
     

    If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.

  • diff --git a/tests/writer.smart.html b/tests/writer.smart.html index c14a6de54..14b70e2fe 100644 --- a/tests/writer.smart.html +++ b/tests/writer.smart.html @@ -39,7 +39,7 @@ here.

    Code in a block quote:

    sub status {
    -    print "working";
    +    print "working";
     }
     

    A list:

    @@ -60,7 +60,7 @@ here.

    Example:

    sub status {
    -    print "working";
    +    print "working";
     }
     
    @@ -84,7 +84,7 @@ here.

    ---- (should be four hyphens)
     
     sub status {
    -    print "working";
    +    print "working";
     }
     
     this code block is indented by one tab
    @@ -92,7 +92,7 @@ this code block is indented by one tab
     

    And:

        this code block is indented by two tabs
     
    -These should not be escaped:  \$ \\ \> \[ \{
    +These should not be escaped:  \$ \\ \> \[ \{
     

    Lists

    @@ -255,12 +255,12 @@ These should not be escaped: \$ \\ \> \[ \{
    foo

    This should be a code block, though:

    -
    <div>
    +
    <div>
         foo
    -</div>
    +</div>
     

    As should this:

    -
    <div>foo</div>
    +
    <div>foo</div>
     

    Now, nested:

    @@ -281,12 +281,12 @@ Blah This is another comment. -->

    Code block:

    -
    <!-- Comment -->
    +
    <!-- Comment -->
     

    Just plain comment, with trailing spaces on the line:

    Code:

    -
    <hr />
    +
    <hr />
     

    Hr’s:


    @@ -315,7 +315,7 @@ Blah

    So is this word.

    This is strong and em.

    So is this word.

    -

    This is code: >, $, \, \$, <html>.

    +

    This is code: >, $, \, \$, <html>.


    Smart quotes, ellipses, dashes

    “Hello,” said the spider. “‘Shelob’ is my name.”

    @@ -355,11 +355,11 @@ Cat & 1 \\ \hline

    Special Characters

    Here is some unicode:

      -
    • I hat: Î
    • -
    • o umlaut: ö
    • -
    • section: §
    • -
    • set membership: ∈
    • -
    • copyright: ©
    • +
    • I hat: Î
    • +
    • o umlaut: ö
    • +
    • section: §
    • +
    • set membership: ∈
    • +
    • copyright: ©

    AT&T has an ampersand in their name.

    AT&T is another way to write it.

    @@ -389,7 +389,7 @@ Cat & 1 \\ \hline

    URL and title.

    URL and title.

    URL and title.

    -

    URL and title

    +

    URL and title

    URL and title