diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2006-12-29 08:04:39 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2006-12-29 08:04:39 +0000 |
commit | eea359203ac7f861ac9536b39e639f6c65579501 (patch) | |
tree | e0e7e2403e6e9422121a2a5c14afeffbf5cc0d43 | |
parent | 17837b343be94dfa1427786008576646d4a89dcf (diff) | |
download | pandoc-eea359203ac7f861ac9536b39e639f6c65579501.tar.gz |
Reversed changes from r246:
+ Removed invisible anchors in front of header tags in HTML output.
Reason: no way to prevent duplicate ID attributes (which is invalid
HTML), since there might be duplicate header titles. See
http://six.pairlist.net/pipermail/markdown-discuss/2005-January/000975.html.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@306 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | README | 21 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 4 | ||||
-rw-r--r-- | tests/s5.basic.html | 8 | ||||
-rw-r--r-- | tests/s5.fancy.html | 8 | ||||
-rw-r--r-- | tests/s5.fragment.html | 3 | ||||
-rw-r--r-- | tests/s5.inserts.html | 3 | ||||
-rw-r--r-- | tests/writer.html | 29 | ||||
-rw-r--r-- | tests/writer.smart.html | 29 |
8 files changed, 1 insertions, 104 deletions
@@ -298,27 +298,6 @@ markdown test suite, type `make test-markdown`.) [standard markdown]: http://daringfireball.net/projects/markdown/syntax "Markdown syntax description" -Section Headings ----------------- - -Pandoc creates an invisible anchor in front of every HTML section -heading. The ID of this anchor is derived from the section heading -itself: spaces are converted to underscores, and formatting, links, -and other markup are removed. Thus, for example, the source - - ## Aristotle's *De Anima* - -gets converted to HTML as follows: - - <a id="Aristotle's_De_Anima"></a> - <h2>Aristotle's <em>De Anima</em></h2> - -This makes it easy to provide internal links that jump to a particular -place in a document. To provide a link to the heading above, for -example, just insert: - - [Back to Aristotle](#Aristotle's_De_Anima) - Lists ----- diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 7d4e8891f..effede04c 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -228,10 +228,8 @@ blockToHtml options (OrderedList lst) = blockToHtml options HorizontalRule = "<hr />\n" blockToHtml options (Header level lst) = let contents = inlineListToHtml options lst in - let simplify = gsub "<[^>]*>" "" . gsub " " "_" in if ((level > 0) && (level <= 6)) - then "<a id=\"" ++ simplify contents ++ "\"></a>\n" ++ - "<h" ++ (show level) ++ ">" ++ contents ++ + then "<h" ++ (show level) ++ ">" ++ contents ++ "</h" ++ (show level) ++ ">\n" else "<p>" ++ contents ++ "</p>\n" listItemToHtml options list = diff --git a/tests/s5.basic.html b/tests/s5.basic.html index 29934e6c1..ac06eabd0 100644 --- a/tests/s5.basic.html +++ b/tests/s5.basic.html @@ -747,24 +747,18 @@ window.onresize = function(){setTimeout('fontScale()', 50);}</script> <div id="currentSlide"></div> <div id="header"></div> <div id="footer"> -<a id="July_15,_2006"></a> <h1>July 15, 2006</h1> -<a id="My_S5_Document"></a> <h2>My S5 Document</h2> </div> </div> <div class="presentation"> <div class="slide"> -<a id="My_S5_Document"></a> <h1>My S5 Document</h1> -<a id="Sam_Smith,_Jen_Jones"></a> <h3>Sam Smith, Jen Jones</h3> -<a id="July_15,_2006"></a> <h4>July 15, 2006</h4> </div> <div class="slide"> -<a id="First_slide"></a> <h1>First slide</h1> <ul> <li>first bullet</li> @@ -772,7 +766,6 @@ window.onresize = function(){setTimeout('fontScale()', 50);}</script> </ul> </div> <div class="slide"> -<a id="Smarty"></a> <h1>Smarty</h1> <ul class="incremental"> <li>"Hello there"</li> @@ -781,7 +774,6 @@ window.onresize = function(){setTimeout('fontScale()', 50);}</script> </ul> </div> <div class="slide"> -<a id="Math"></a> <h1>Math</h1> <ul> <li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li> diff --git a/tests/s5.fancy.html b/tests/s5.fancy.html index dadb9f7f7..fbf872241 100644 --- a/tests/s5.fancy.html +++ b/tests/s5.fancy.html @@ -1659,24 +1659,18 @@ else <div id="currentSlide"></div> <div id="header"></div> <div id="footer"> -<a id="July_15,_2006"></a> <h1>July 15, 2006</h1> -<a id="My_S5_Document"></a> <h2>My S5 Document</h2> </div> </div> <div class="presentation"> <div class="slide"> -<a id="My_S5_Document"></a> <h1>My S5 Document</h1> -<a id="Sam_Smith,_Jen_Jones"></a> <h3>Sam Smith, Jen Jones</h3> -<a id="July_15,_2006"></a> <h4>July 15, 2006</h4> </div> <div class="slide"> -<a id="First_slide"></a> <h1>First slide</h1> <ul class="incremental"> <li>first bullet</li> @@ -1684,7 +1678,6 @@ else </ul> </div> <div class="slide"> -<a id="Smarty"></a> <h1>Smarty</h1> <ul> <li>“Hello there”</li> @@ -1693,7 +1686,6 @@ else </ul> </div> <div class="slide"> -<a id="Math"></a> <h1>Math</h1> <ul class="incremental"> <li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li> diff --git a/tests/s5.fragment.html b/tests/s5.fragment.html index 240bafb35..370b9c111 100644 --- a/tests/s5.fragment.html +++ b/tests/s5.fragment.html @@ -1,10 +1,8 @@ -<a id="First_slide"></a> <h1>First slide</h1> <ul> <li>first bullet</li> <li>second bullet</li> </ul> -<a id="Smarty"></a> <h1>Smarty</h1> <blockquote> <ul> @@ -13,7 +11,6 @@ <li>And 'ellipses'...</li> </ul> </blockquote> -<a id="Math"></a> <h1>Math</h1> <ul> <li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li> diff --git a/tests/s5.inserts.html b/tests/s5.inserts.html index ba6ae5f48..7be33a2c8 100644 --- a/tests/s5.inserts.html +++ b/tests/s5.inserts.html @@ -13,13 +13,11 @@ STUFF INSERTED <body> STUFF INSERTED <h1 class="title">My S5 Document</h1> -<a id="First_slide"></a> <h1>First slide</h1> <ul> <li>first bullet</li> <li>second bullet</li> </ul> -<a id="Smarty"></a> <h1>Smarty</h1> <blockquote> <ul> @@ -28,7 +26,6 @@ STUFF INSERTED <li>And 'ellipses'...</li> </ul> </blockquote> -<a id="Math"></a> <h1>Math</h1> <ul> <li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li> diff --git a/tests/writer.html b/tests/writer.html index c421d24c4..e4f5c5d0c 100644 --- a/tests/writer.html +++ b/tests/writer.html @@ -12,28 +12,18 @@ <h1 class="title">Pandoc Test Suite</h1> <p>This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.</p> <hr /> -<a id="Headers"></a> <h1>Headers</h1> -<a id="Level_2_with_an_embedded_link"></a> <h2>Level 2 with an <a href="/url">embedded link</a></h2> -<a id="Level_3_with_emphasis"></a> <h3>Level 3 with <em>emphasis</em></h3> -<a id="Level_4"></a> <h4>Level 4</h4> -<a id="Level_5"></a> <h5>Level 5</h5> -<a id="Level_1"></a> <h1>Level 1</h1> -<a id="Level_2_with_emphasis"></a> <h2>Level 2 with <em>emphasis</em></h2> -<a id="Level_3"></a> <h3>Level 3</h3> <p>with no blank line</p> -<a id="Level_2"></a> <h2>Level 2</h2> <p>with no blank line</p> <hr /> -<a id="Paragraphs"></a> <h1>Paragraphs</h1> <p>Here's a regular paragraph.</p> <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p> @@ -41,7 +31,6 @@ <p>There should be a hard line break<br /> here.</p> <hr /> -<a id="Block_Quotes"></a> <h1>Block Quotes</h1> <p>E-mail style:</p> <blockquote> @@ -90,7 +79,6 @@ here.</p> </blockquote> <p>And a following paragraph.</p> <hr /> -<a id="Code_Blocks"></a> <h1>Code Blocks</h1> <p>Code:</p> <pre><code>---- (should be four hyphens) @@ -107,9 +95,7 @@ this code block is indented by one tab These should not be escaped: \$ \\ \> \[ \{ </code></pre> <hr /> -<a id="Lists"></a> <h1>Lists</h1> -<a id="Unordered"></a> <h2>Unordered</h2> <p>Asterisks tight:</p> <ul> @@ -156,7 +142,6 @@ These should not be escaped: \$ \\ \> \[ \{ <li><p>Minus 3</p> </li> </ul> -<a id="Ordered"></a> <h2>Ordered</h2> <p>Tight:</p> <ol> @@ -198,7 +183,6 @@ These should not be escaped: \$ \\ \> \[ \{ <li><p>Item 3.</p> </li> </ol> -<a id="Nested"></a> <h2>Nested</h2> <ul> <li>Tab<ul> @@ -234,7 +218,6 @@ These should not be escaped: \$ \\ \> \[ \{ <li><p>Third</p> </li> </ol> -<a id="Tabs_and_spaces"></a> <h2>Tabs and spaces</h2> <ul> <li><p>this is a list item indented with tabs</p> @@ -249,7 +232,6 @@ These should not be escaped: \$ \\ \> \[ \{ </li> </ul> <hr /> -<a id="HTML_Blocks"></a> <h1>HTML Blocks</h1> <p>Simple block on one line:</p> <div>foo</div> @@ -325,7 +307,6 @@ Blah <hr class="foo" id="bar"> <hr /> -<a id="Inline_Markup"></a> <h1>Inline Markup</h1> <p>This is <em>emphasized</em>, and so <em>is this</em>.</p> <p>This is <strong>strong</strong>, and so <strong>is this</strong>.</p> @@ -336,7 +317,6 @@ Blah <p>So is <strong><em>this</em></strong> word.</p> <p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code><html></code>.</p> <hr /> -<a id="Smart_quotes,_ellipses,_dashes"></a> <h1>Smart quotes, ellipses, dashes</h1> <p>"Hello," said the spider. "'Shelob' is my name."</p> <p>'A', 'B', and 'C' are letters.</p> @@ -347,7 +327,6 @@ Blah <p>Dashes between numbers: 5-7, 255-66, 1987-1999.</p> <p>Ellipses...and. . .and . . . .</p> <hr /> -<a id="LaTeX"></a> <h1>LaTeX</h1> <ul> <li>\cite[22-23]{smith.1899}</li> @@ -373,7 +352,6 @@ Dog & 2 \\ Cat & 1 \\ \hline \end{tabular}</p> <hr /> -<a id="Special_Characters"></a> <h1>Special Characters</h1> <p>Here is some unicode:</p> <ul> @@ -405,9 +383,7 @@ Cat & 1 \\ \hline <p>Plus: +</p> <p>Minus: -</p> <hr /> -<a id="Links"></a> <h1>Links</h1> -<a id="Explicit"></a> <h2>Explicit</h2> <p>Just a <a href="/url/">URL</a>.</p> <p><a href="/url/" title="title">URL and title</a>.</p> @@ -422,7 +398,6 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'Email link'+'<\/'+'a'+'>') // --> </script><noscript>Email link (nobody at nowhere dot net)</noscript></p> <p><a href="">Empty</a>.</p> -<a id="Reference"></a> <h2>Reference</h2> <p>Foo <a href="/url/">bar</a>.</p> <p>Foo <a href="/url/">bar</a>.</p> @@ -437,13 +412,11 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'Email link'+'<\/'+'a'+'>') </code></pre> <p>Foo <a href="/url/" title="Title with "quotes" inside">bar</a>.</p> <p>Foo <a href="/url/" title="Title with "quote" inside">biz</a>.</p> -<a id="With_ampersands"></a> <h2>With ampersands</h2> <p>Here's a <a href="http://example.com/?foo=1&bar=2">link with an ampersand in the URL</a>.</p> <p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&T</a>.</p> <p>Here's an <a href="/script?foo=1&bar=2">inline link</a>.</p> <p>Here's an <a href="/script?foo=1&bar=2">inline link in pointy braces</a>.</p> -<a id="Autolinks"></a> <h2>Autolinks</h2> <p>With an ampersand: <a href="http://example.com/?foo=1&bar=2">http://example.com/?foo=1&bar=2</a></p> <ul> @@ -464,13 +437,11 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+e+'<\/'+'a'+'>'); <pre><code>or here: <http://example.com/> </code></pre> <hr /> -<a id="Images"></a> <h1>Images</h1> <p>From "Voyage dans la Lune" by Georges Melies (1902):</p> <p><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"></p> <p>Here is a movie <img src="movie.jpg" alt="movie"> icon.</p> <hr /> -<a id="Footnotes"></a> <h1>Footnotes</h1> <p>Here is a footnote reference,<sup class="footnoteRef" id="fnref1"><a href="#fn1">1</a></sup> and another.<sup class="footnoteRef" id="fnref2"><a href="#fn2">2</a></sup> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<sup class="footnoteRef" id="fnref3"><a href="#fn3">3</a></sup></p> <blockquote> diff --git a/tests/writer.smart.html b/tests/writer.smart.html index d78ac4561..1c2574966 100644 --- a/tests/writer.smart.html +++ b/tests/writer.smart.html @@ -12,28 +12,18 @@ <h1 class="title">Pandoc Test Suite</h1> <p>This is a set of tests for pandoc. Most of them are adapted from John Gruber’s markdown test suite.</p> <hr /> -<a id="Headers"></a> <h1>Headers</h1> -<a id="Level_2_with_an_embedded_link"></a> <h2>Level 2 with an <a href="/url">embedded link</a></h2> -<a id="Level_3_with_emphasis"></a> <h3>Level 3 with <em>emphasis</em></h3> -<a id="Level_4"></a> <h4>Level 4</h4> -<a id="Level_5"></a> <h5>Level 5</h5> -<a id="Level_1"></a> <h1>Level 1</h1> -<a id="Level_2_with_emphasis"></a> <h2>Level 2 with <em>emphasis</em></h2> -<a id="Level_3"></a> <h3>Level 3</h3> <p>with no blank line</p> -<a id="Level_2"></a> <h2>Level 2</h2> <p>with no blank line</p> <hr /> -<a id="Paragraphs"></a> <h1>Paragraphs</h1> <p>Here’s a regular paragraph.</p> <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p> @@ -41,7 +31,6 @@ <p>There should be a hard line break<br /> here.</p> <hr /> -<a id="Block_Quotes"></a> <h1>Block Quotes</h1> <p>E-mail style:</p> <blockquote> @@ -90,7 +79,6 @@ here.</p> </blockquote> <p>And a following paragraph.</p> <hr /> -<a id="Code_Blocks"></a> <h1>Code Blocks</h1> <p>Code:</p> <pre><code>---- (should be four hyphens) @@ -107,9 +95,7 @@ this code block is indented by one tab These should not be escaped: \$ \\ \> \[ \{ </code></pre> <hr /> -<a id="Lists"></a> <h1>Lists</h1> -<a id="Unordered"></a> <h2>Unordered</h2> <p>Asterisks tight:</p> <ul> @@ -156,7 +142,6 @@ These should not be escaped: \$ \\ \> \[ \{ <li><p>Minus 3</p> </li> </ul> -<a id="Ordered"></a> <h2>Ordered</h2> <p>Tight:</p> <ol> @@ -198,7 +183,6 @@ These should not be escaped: \$ \\ \> \[ \{ <li><p>Item 3.</p> </li> </ol> -<a id="Nested"></a> <h2>Nested</h2> <ul> <li>Tab<ul> @@ -234,7 +218,6 @@ These should not be escaped: \$ \\ \> \[ \{ <li><p>Third</p> </li> </ol> -<a id="Tabs_and_spaces"></a> <h2>Tabs and spaces</h2> <ul> <li><p>this is a list item indented with tabs</p> @@ -249,7 +232,6 @@ These should not be escaped: \$ \\ \> \[ \{ </li> </ul> <hr /> -<a id="HTML_Blocks"></a> <h1>HTML Blocks</h1> <p>Simple block on one line:</p> <div>foo</div> @@ -325,7 +307,6 @@ Blah <hr class="foo" id="bar"> <hr /> -<a id="Inline_Markup"></a> <h1>Inline Markup</h1> <p>This is <em>emphasized</em>, and so <em>is this</em>.</p> <p>This is <strong>strong</strong>, and so <strong>is this</strong>.</p> @@ -336,7 +317,6 @@ Blah <p>So is <strong><em>this</em></strong> word.</p> <p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code><html></code>.</p> <hr /> -<a id="Smart_quotes,_ellipses,_dashes"></a> <h1>Smart quotes, ellipses, dashes</h1> <p>“Hello,” said the spider. “‘Shelob’ is my name.”</p> <p>‘A’, ‘B’, and ‘C’ are letters.</p> @@ -347,7 +327,6 @@ Blah <p>Dashes between numbers: 5–7, 255–66, 1987–1999.</p> <p>Ellipses…and…and … .</p> <hr /> -<a id="LaTeX"></a> <h1>LaTeX</h1> <ul> <li>\cite[22-23]{smith.1899}</li> @@ -373,7 +352,6 @@ Dog & 2 \\ Cat & 1 \\ \hline \end{tabular}</p> <hr /> -<a id="Special_Characters"></a> <h1>Special Characters</h1> <p>Here is some unicode:</p> <ul> @@ -405,9 +383,7 @@ Cat & 1 \\ \hline <p>Plus: +</p> <p>Minus: -</p> <hr /> -<a id="Links"></a> <h1>Links</h1> -<a id="Explicit"></a> <h2>Explicit</h2> <p>Just a <a href="/url/">URL</a>.</p> <p><a href="/url/" title="title">URL and title</a>.</p> @@ -422,7 +398,6 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'Email link'+'<\/'+'a'+'>') // --> </script><noscript>Email link (nobody at nowhere dot net)</noscript></p> <p><a href="">Empty</a>.</p> -<a id="Reference"></a> <h2>Reference</h2> <p>Foo <a href="/url/">bar</a>.</p> <p>Foo <a href="/url/">bar</a>.</p> @@ -437,13 +412,11 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'Email link'+'<\/'+'a'+'>') </code></pre> <p>Foo <a href="/url/" title="Title with "quotes" inside">bar</a>.</p> <p>Foo <a href="/url/" title="Title with "quote" inside">biz</a>.</p> -<a id="With_ampersands"></a> <h2>With ampersands</h2> <p>Here’s a <a href="http://example.com/?foo=1&bar=2">link with an ampersand in the URL</a>.</p> <p>Here’s a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&T</a>.</p> <p>Here’s an <a href="/script?foo=1&bar=2">inline link</a>.</p> <p>Here’s an <a href="/script?foo=1&bar=2">inline link in pointy braces</a>.</p> -<a id="Autolinks"></a> <h2>Autolinks</h2> <p>With an ampersand: <a href="http://example.com/?foo=1&bar=2">http://example.com/?foo=1&bar=2</a></p> <ul> @@ -464,13 +437,11 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+e+'<\/'+'a'+'>'); <pre><code>or here: <http://example.com/> </code></pre> <hr /> -<a id="Images"></a> <h1>Images</h1> <p>From “Voyage dans la Lune” by Georges Melies (1902):</p> <p><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"></p> <p>Here is a movie <img src="movie.jpg" alt="movie"> icon.</p> <hr /> -<a id="Footnotes"></a> <h1>Footnotes</h1> <p>Here is a footnote reference,<sup class="footnoteRef" id="fnref1"><a href="#fn1">1</a></sup> and another.<sup class="footnoteRef" id="fnref2"><a href="#fn2">2</a></sup> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<sup class="footnoteRef" id="fnref3"><a href="#fn3">3</a></sup></p> <blockquote> |