diff options
| author | beatrice <beatrice@dangofactory.net> | 2026-11-22 20:01:35 +0900 |
|---|---|---|
| committer | beatrice <beatrice@dangofactory.net> | 2026-11-22 20:01:35 +0900 |
| commit | 6e93939f2b885f1f53836fa3e19b398a5ebbdf40 (patch) | |
| tree | 5fde91edefd5452acabd3e09426a5a47f232a64c | |
| download | Text-Markdown-master.tar.gz Text-Markdown-master.zip | |
Import Text-Markdown-1.000031.tar.gzHEADlocal/Text-Markdownmaster
398 files changed, 14235 insertions, 0 deletions
@@ -0,0 +1,238 @@ +This file documents the revision history for Perl extension Text::Markdown. + +1.0.31 2010-03-20T23:06:04 + - Fix installation of the Markdown.pl script. + +1.0.30 2010-01-18T12:19:49 + - Removed File::Slurp dependency (v. 9999.13 fails tests on + Strawberry 5.10.1) (dandv) + +1.0.29 2009-10-28T15:19:26 + - Note Test::Differences is needed for tests to run (RT#50918) + - Change build_requires to test_requires in Makefile.PL where + appropriate. + +1.0.28 2009-10-27T14:28:12 + - Fix MANIFEST.skip to avoid extraneous crap in the distribution. + +1.0.27 2009-10-25T19:13:47 + - Change to perl style version numbers (from 3 part versions) to + avoid depndency confusion with Text::MultiMarkdown + +1.0.26 2009-10-04T00:37:00 + - Minor POD changes (typos, wrapping) + - Added note about and test for output always ending in exactly one newline (dandv) + - Fix RT#48943 + tests (genehack) + - Support for optionally interpreting markdown in HTML block elements + using the markdown="1" attribute (GitHub issue #1; dandv) + +1.0.25 2009-08-25T09:31:30 + - Remove MultiMarkdown from the Text::Markdown distribution + - Change repository and bugtracker metadata to github. + - Update File::Slurp dependency, fixing RT#43888. + +1.0.24 2008-11-16T14:33:30 + - Add trust_list_start_value patch from Ricardo Signes (RT#40814) + to enable <li value='X'> output for list numbering. + This feature is disabled by default. + +1.0.23 2008-11-02T18:24:30 + - Ship a release with the correct contents so that the tests pass. + +1.0.22 2008-10-23T18:24:44 + - RT#37909 - Fix + in email addresses. + - RT#40303 - Fix use in Mason by adding "use re 'eval'" to both files. + - Add SVN repository to Makefile.PL + - Remove META.yml from source control so it is regenerated + automatically. + +1.0.21 2008-07-24T08:33:00 + - Fix hard tabs in Changelog + - Add unit test for core dumps issue from RT#36203 + - Fix POD spelling. + - Fix warning from RT#34856. + - Add test for another tab width issue (related to <hr> generation) + from RT#37769. Fix this issue. + - More test additions and more splitting the test suites into MDTest + modules. + +1.0.20 2008-07-11T23:30:00 + - Update README.txt + - Allow scripts to be used on multiple input files at once (processing + in command line order) + - Update footnote behavior of Text::MutltiMarkdown to be consistent + with the latest version of MultiMarkdown + - Added tests for the new footnote functionality. + - Added tests for all the MDTest corner cases brought up on the list. + Noted why / how I differ from original Markdown. + - Moved all the document tests to MDTest format. I have made MDTest + test suites for Text::Markdown and Text::MultiMarkdown, containing + **only** the bug fixes and behavior changes I've made, I've imported + the Markdown test suite from MDTest1.1, and the MultiMarkdown test + suite. + - RT#36537 doc patch to add POD to the scripts from Debian's Gunnar + Wolf. + - Mutilate the list processing somewhat to reduce the compilation + of recursive regexes, and so stop perl (<5.10) crapping itself + on lots of input. This isn't the full fix - really shouldn't be + using recursive regexes at all. RT#37297 + +1.0.19 2008-04-22T18:34:00 + - Remove auto_install from Makefile.PL, this is a deprecated feature + and it shouldn't be being used at all. + +1.0.18 2008-04-20T18:54:50 + - Clean up local stuff for settings. + - Do a little cleanup of intialisation (more needed) + - Remove copy pasted regexes from Text::MultiMarkdown + - Fix bug with line breaks in links - http://bugs.debian.org/459885, + thanks to patches and test input / output provided by Adeodato Simó. + (See t/37anchormultilinebugs.t) + - Incorperated MDTest1.1's tests, and made most of the Text-Markdown + and Text-MultiMarkdown tests in MDTest format. + - Add and document an accessor for the parsed markdown URLs. + - Fix html4tags option in Markdown.pl and MultiMarkdown.pl + +1.0.17 2008-03-17T01:54:00 + - Add Markdown.pl and MultiMarkdown.pl, which work the same way as the + original Markdown.pl. These scripts *are not* installed by default, + but you will be prompted to install them when you run Makefile.PL + + - Make _DeTab significantly quicker. Text::Balanced is still the main + performance sore point however. :( + + - Re-organise the module code so that Text::Markdown is a standalone + module which does not require Text::MultiMarkdown. + Text::MultiMarkdown now inherits from Text::Markdown and adds the + additional MultiMarkdown functionality. This is a *large* change to + the module's internals, but is much more in the spirit of the + original Markdown project (and should silence most complaints about + how the code works, and possible even stop John Gruber hating my + guts). + + If you were using Text::Markdown previously, but relying on an + implicit MultiMarkdown feature, this *could be a breaking change*. + + Detailed description of any possible user visible changes below: + + - Text::Markdown will no longer supports the additional attribute + specification for images and links feature, which was not in + original Markdown, but were previously supported after + the code merge of Text::Markdown and Text::MultiMarkdown. + + If you are relying on this features, it is recommended that you + use Text::MultiMarkdown (configured as you prefer), as this is + not a supported feature in the original Markdown. + + - Text::MultiMarkdown has changed the order of attributes in image + tags, the id attribute is moved from the first to the last + attribute (barring user supplied attributes). An example of the + expected change is included below: + + Old output: <img id="image" src="http://path.to/image" alt="image" title="Image title" width="40px" height="400px" /> + + New output: <img src="http://path.to/image" alt="image" title="Image title" id="image" width="40px" height="400px" /> + + This is due to the code re-organisation, moving the id attribute + around shouldn't affect anything that isn't relying on the + attribute ordering (which is meant to be unimportant in HTML), and + allows for simplification of the unified code. + +1.0.16 2008-02-25T14:24:00 + - Fix bugs with tab_width in constructor / as an option. + - Fix bugs with tab width in pre/code blocks. + +1.0.15 2008-02-23T11:13:07 + - Start using ShipIt to package the distribution. + +1.0.14 2008-02-21T22:41:33 + - Fix a bug in the packaging of the last version. + - Add links to other implementations and some notes about them. + - Add a (failing) unit test for some unexpected behavior reported on + the list. + +1.0.13 2008-02-19T23:54:33 + - Due to the UFT8 support this module no longer works on perl < + 5.8, note this in the Makefile.PL and modules. + - I managed to ship a module without Makefile.PL, WTF? Really + need to start using ShipIt. + +1.0.12 2008-02-18T22:00:00 + - Text::Markdown - borgborgborgborgborg. + - Added additional POD documentation. + - Cleaned up some tests, and some additional test cases. + - Options to turn off all the extra features introduced in + MultiMarkdown. + +1.0.11 2008-01-24T00:12:00 + - Fix syntax error in one of the tests. Note to self - just fixing + that warning in the test case, then shipping without retesting, NOT + SMART! + +1.0.10 2008-01-23T15:40:00 + - Fix bug with links processing in HTML blocks. + +1.0.9 2008-01-22T20:28:00 + - Ship non-broken dist at CPAN (oops, rushing!) + +1.0.8 2008-01-22T19:20:00 + - Do not encode amps or angle brackets in HTML comments + test case. + - Do not emit title attribute in <img> tags unless we have contents + for it. This was a 'feature' of original Markdown where I've decided + to go with what php-markdown does (tests updated). + - Added php-markdown tests (most/all of the regular tests pass except + the email obfu one). + - Added php-markdown extra tests (all fail). + - Added python markdown tests (mostly pass, but marked broken). + - Add a way of stopping inline HTML blocks from suppressing markdown + processing. Feature request from #catalyst-dev + + +1.0.7 2008-01-07T16:31:00 + - Encode isn't in core in all perls, add it to Makefile.PL + +1.0.6 2008-01-06T13:36:00 + - Merge latest Markdown test suite I can find, and make it all pass, + pulling in code from Markdown 1.0.2b8. Things fixed: + - Inline HTML + - Lists + - Metadata skipping by leading line breaks + - 3rd form of links + - Implement features to suppress id attributes in <img> and <hX> tags + to be able to act more like original Markdown - now almost ready to + steal Text::Markdown (would want to turn off tables / citations and + bibliography for that) + - Move almost all the global variables into instance data. + - Fix unicode issues from CPAN.org's RT#27482 + - Remove call to srand, it's not smart to do this more than once. + +1.0.5 2008-01-04T18:07:57 + - Add Markdown and MultiMarkdown test suites. + - Fix a big bug introduced in 1.0.4 in citations + - Fix footnotes (and other small things) to match the test suite + +1.0.4 2008-01-02T02:03:50 + - Refactor so that the processor instance has the same set of + persistent options as on the ->markdown method itself. + - Change all functions to be instance methods, moved a chunk of the + global data to the instance. The rest will follow shortly. + - The test suite now tests a reasonable set of the Markdown and + MultiMarkdown syntaxes. + - All known options and metadata keys have been documented. + +1.0.3 2007-11-24T20:22:00 + - way to keep me accountable, CPANTESTERS! Maybe I shouldn't have + Test::Pod::Coverage enabled unless it actually checks out. Added some + fairly useless stubbed METHODS to POD and moved POD around a bit. + +1.0.2 2007-11-24T14:00:00 + - move to Module::Install and clean various things up, mostly to make + CPANTS happy. + +1.0.1 2006-10-20T00:00:00 + - include patch from Uwe Voelker to allow setting of options in + markdown(); also added a test case from Uwe. Thanks, Uwe! + Also updated changelog references in POD somewhat. + +1.0.0 2006-08-22T00:00:00 + - first release diff --git a/License.text b/License.text new file mode 100644 index 0000000..6d76506 --- /dev/null +++ b/License.text @@ -0,0 +1,30 @@ +Copyright (c) 2004, John Gruber +<http://daringfireball.net/> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name "Markdown" nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +This software is provided by the copyright holders and contributors "as +is" and any express or implied warranties, including, but not limited +to, the implied warranties of merchantability and fitness for a +particular purpose are disclaimed. In no event shall the copyright owner +or contributors be liable for any direct, indirect, incidental, special, +exemplary, or consequential damages (including, but not limited to, +procurement of substitute goods or services; loss of use, data, or +profits; or business interruption) however caused and on any theory of +liability, whether in contract, strict liability, or tort (including +negligence or otherwise) arising in any way out of the use of this +software, even if advised of the possibility of such damage. diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..75e2bcd --- /dev/null +++ b/MANIFEST @@ -0,0 +1,398 @@ +Changes +inc/Module/Install.pm +inc/Module/Install/Base.pm +inc/Module/Install/Can.pm +inc/Module/Install/CheckConflicts.pm +inc/Module/Install/Fetch.pm +inc/Module/Install/Makefile.pm +inc/Module/Install/Metadata.pm +inc/Module/Install/Scripts.pm +inc/Module/Install/Win32.pm +inc/Module/Install/WriteAll.pm +lib/Text/Markdown.pm +License.text +Makefile.PL +MANIFEST This list of files +META.yml +README +Readme.text +script/Markdown.pl +t/02pod.t +t/03podcoverage.t +t/04ensure_1_newline_before_EOF.t +t/05markdown_in_divs.t +t/19exporter-markdown.t +t/21fulldocs-text-markdown.t +t/23fulldocs-markdown.t +t/25fulldocs-phpmarkdown.t +t/31angleedgecase.t +t/32tabwidth.t +t/33spaceinlinksandimages.t +t/34commandlinemarkdown.t +t/37anchormultilinebugs.t +t/40trustliststart.t +t/code-hr.t +t/docs-maruku-unittest/abbreviations.html +t/docs-maruku-unittest/abbreviations.text +t/docs-maruku-unittest/alt.html +t/docs-maruku-unittest/alt.text +t/docs-maruku-unittest/blank.html +t/docs-maruku-unittest/blank.text +t/docs-maruku-unittest/blanks_in_code.html +t/docs-maruku-unittest/blanks_in_code.text +t/docs-maruku-unittest/bug_def.html +t/docs-maruku-unittest/bug_def.text +t/docs-maruku-unittest/bug_table.html +t/docs-maruku-unittest/bug_table.text +t/docs-maruku-unittest/code.html +t/docs-maruku-unittest/code.text +t/docs-maruku-unittest/code2.html +t/docs-maruku-unittest/code2.text +t/docs-maruku-unittest/code3.html +t/docs-maruku-unittest/code3.text +t/docs-maruku-unittest/convert.pl +t/docs-maruku-unittest/data_loss.html +t/docs-maruku-unittest/data_loss.text +t/docs-maruku-unittest/easy.html +t/docs-maruku-unittest/easy.text +t/docs-maruku-unittest/email.html +t/docs-maruku-unittest/email.text +t/docs-maruku-unittest/entities.html +t/docs-maruku-unittest/entities.text +t/docs-maruku-unittest/escaping.html +t/docs-maruku-unittest/escaping.text +t/docs-maruku-unittest/extra_dl.html +t/docs-maruku-unittest/extra_dl.text +t/docs-maruku-unittest/extra_header_id.html +t/docs-maruku-unittest/extra_header_id.text +t/docs-maruku-unittest/extra_table1.html +t/docs-maruku-unittest/extra_table1.text +t/docs-maruku-unittest/footnotes.html +t/docs-maruku-unittest/footnotes.text +t/docs-maruku-unittest/headers.html +t/docs-maruku-unittest/headers.text +t/docs-maruku-unittest/hex_entities.html +t/docs-maruku-unittest/hex_entities.text +t/docs-maruku-unittest/hrule.html +t/docs-maruku-unittest/hrule.text +t/docs-maruku-unittest/html2.html +t/docs-maruku-unittest/html2.text +t/docs-maruku-unittest/html3.html +t/docs-maruku-unittest/html3.text +t/docs-maruku-unittest/html4.html +t/docs-maruku-unittest/html4.text +t/docs-maruku-unittest/html5.html +t/docs-maruku-unittest/html5.text +t/docs-maruku-unittest/ie.html +t/docs-maruku-unittest/ie.text +t/docs-maruku-unittest/images.html +t/docs-maruku-unittest/images.text +t/docs-maruku-unittest/images2.html +t/docs-maruku-unittest/images2.text +t/docs-maruku-unittest/inline_html.html +t/docs-maruku-unittest/inline_html.text +t/docs-maruku-unittest/inline_html2.html +t/docs-maruku-unittest/inline_html2.text +t/docs-maruku-unittest/links.html +t/docs-maruku-unittest/links.text +t/docs-maruku-unittest/list1.html +t/docs-maruku-unittest/list1.text +t/docs-maruku-unittest/list2.html +t/docs-maruku-unittest/list2.text +t/docs-maruku-unittest/list3.html +t/docs-maruku-unittest/list3.text +t/docs-maruku-unittest/list4.html +t/docs-maruku-unittest/list4.text +t/docs-maruku-unittest/lists.html +t/docs-maruku-unittest/lists.text +t/docs-maruku-unittest/lists11.html +t/docs-maruku-unittest/lists11.text +t/docs-maruku-unittest/lists6.html +t/docs-maruku-unittest/lists6.text +t/docs-maruku-unittest/lists7.html +t/docs-maruku-unittest/lists7.text +t/docs-maruku-unittest/lists7b.html +t/docs-maruku-unittest/lists7b.text +t/docs-maruku-unittest/lists8.html +t/docs-maruku-unittest/lists8.text +t/docs-maruku-unittest/lists9.html +t/docs-maruku-unittest/lists9.text +t/docs-maruku-unittest/lists_after_paragraph.html +t/docs-maruku-unittest/lists_after_paragraph.text +t/docs-maruku-unittest/lists_ol.html +t/docs-maruku-unittest/lists_ol.text +t/docs-maruku-unittest/loss.html +t/docs-maruku-unittest/loss.text +t/docs-maruku-unittest/misc_sw.html +t/docs-maruku-unittest/misc_sw.text +t/docs-maruku-unittest/olist.html +t/docs-maruku-unittest/olist.text +t/docs-maruku-unittest/one.html +t/docs-maruku-unittest/one.text +t/docs-maruku-unittest/paragraph.html +t/docs-maruku-unittest/paragraph.text +t/docs-maruku-unittest/paragraphs.html +t/docs-maruku-unittest/paragraphs.text +t/docs-maruku-unittest/smartypants.html +t/docs-maruku-unittest/smartypants.text +t/docs-maruku-unittest/syntax_hl.html +t/docs-maruku-unittest/syntax_hl.text +t/docs-maruku-unittest/table_attributes.html +t/docs-maruku-unittest/table_attributes.text +t/docs-maruku-unittest/test.html +t/docs-maruku-unittest/test.text +t/docs-maruku-unittest/wrapping.html +t/docs-maruku-unittest/wrapping.text +t/docs-maruku-unittest/xml.html +t/docs-maruku-unittest/xml.text +t/docs-maruku-unittest/xml2.html +t/docs-maruku-unittest/xml2.text +t/docs-maruku-unittest/xml3.html +t/docs-maruku-unittest/xml3.text +t/docs-maruku-unittest/xml_instruction.html +t/docs-maruku-unittest/xml_instruction.text +t/docs-php-markdown-extra/Abbr.html +t/docs-php-markdown-extra/Abbr.text +t/docs-php-markdown-extra/Definition_Lists.html +t/docs-php-markdown-extra/Definition_Lists.text +t/docs-php-markdown-extra/Emphasis.html +t/docs-php-markdown-extra/Emphasis.text +t/docs-php-markdown-extra/Footnotes.html +t/docs-php-markdown-extra/Footnotes.text +t/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.html +t/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.text +t/docs-php-markdown-extra/Tables.html +t/docs-php-markdown-extra/Tables.text +t/docs-php-markdown-todo/Email_auto_links.html +t/docs-php-markdown-todo/Email_auto_links.text +t/docs-php-markdown-todo/Emphasis.html +t/docs-php-markdown-todo/Emphasis.text +t/docs-php-markdown-todo/Inline_HTML_(Span).html +t/docs-php-markdown-todo/Inline_HTML_(Span).text +t/docs-php-markdown-todo/Ins_and_del.text +t/docs-php-markdown-todo/Ins_and_del.xhtml +t/docs-php-markdown-todo/Links_inline_style.html +t/docs-php-markdown-todo/Links_inline_style.text +t/docs-php-markdown-todo/Nesting.html +t/docs-php-markdown-todo/Nesting.text +t/docs-php-markdown-todo/Parens_in_URL.html +t/docs-php-markdown-todo/Parens_in_URL.text +t/docs-php-markdown/Backslash_escapes.html +t/docs-php-markdown/Backslash_escapes.text +t/docs-php-markdown/Code_block_in_a_list_item.html +t/docs-php-markdown/Code_block_in_a_list_item.text +t/docs-php-markdown/Code_Spans.html +t/docs-php-markdown/Code_Spans.text +t/docs-php-markdown/Headers.html +t/docs-php-markdown/Headers.text +t/docs-php-markdown/Images_(Untitled).html +t/docs-php-markdown/Images_(Untitled).text +t/docs-php-markdown/Inline_HTML_(Simple).html +t/docs-php-markdown/Inline_HTML_(Simple).text +t/docs-php-markdown/Inline_HTML_comments.html +t/docs-php-markdown/Inline_HTML_comments.text +t/docs-php-markdown/PHP-Specific_Bugs.html +t/docs-php-markdown/PHP-Specific_Bugs.text +t/docs-php-markdown/Tight_blocks.html +t/docs-php-markdown/Tight_blocks.text +t/docs-pythonmarkdown2-tm-cases-pass/auto_link.html +t/docs-pythonmarkdown2-tm-cases-pass/auto_link.text +t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.html +t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.opts +t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.text +t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.html +t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.opts +t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.text +t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.html +t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.opts +t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.text +t/docs-pythonmarkdown2-tm-cases-pass/blockquote.html +t/docs-pythonmarkdown2-tm-cases-pass/blockquote.text +t/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.html +t/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.text +t/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.html +t/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.text +t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.html +t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.opts +t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.text +t/docs-pythonmarkdown2-tm-cases-pass/codeblock.html +t/docs-pythonmarkdown2-tm-cases-pass/codeblock.text +t/docs-pythonmarkdown2-tm-cases-pass/codespans.html +t/docs-pythonmarkdown2-tm-cases-pass/codespans.text +t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.html +t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.opts +t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.text +t/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.html +t/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.text +t/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.html +t/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.text +t/docs-pythonmarkdown2-tm-cases-pass/emphasis.html +t/docs-pythonmarkdown2-tm-cases-pass/emphasis.text +t/docs-pythonmarkdown2-tm-cases-pass/escapes.html +t/docs-pythonmarkdown2-tm-cases-pass/escapes.text +t/docs-pythonmarkdown2-tm-cases-pass/footnotes.html +t/docs-pythonmarkdown2-tm-cases-pass/footnotes.opts +t/docs-pythonmarkdown2-tm-cases-pass/footnotes.text +t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.html +t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.opts +t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.text +t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.html +t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.opts +t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.text +t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.html +t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.opts +t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.text +t/docs-pythonmarkdown2-tm-cases-pass/header.html +t/docs-pythonmarkdown2-tm-cases-pass/header.text +t/docs-pythonmarkdown2-tm-cases-pass/hr.html +t/docs-pythonmarkdown2-tm-cases-pass/hr.text +t/docs-pythonmarkdown2-tm-cases-pass/img_in_link.html +t/docs-pythonmarkdown2-tm-cases-pass/img_in_link.text +t/docs-pythonmarkdown2-tm-cases-pass/inline_links.html +t/docs-pythonmarkdown2-tm-cases-pass/inline_links.text +t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.html +t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.opts +t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.text +t/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.html +t/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.text +t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.html +t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.opts +t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.text +t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.html +t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.opts +t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.text +t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.html +t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.opts +t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.text +t/docs-pythonmarkdown2-tm-cases-pass/lists.html +t/docs-pythonmarkdown2-tm-cases-pass/lists.text +t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.html +t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.opts +t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.text +t/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.html +t/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.text +t/docs-pythonmarkdown2-tm-cases-pass/nested_list.html +t/docs-pythonmarkdown2-tm-cases-pass/nested_list.text +t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.html +t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.opts +t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.text +t/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.html +t/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.text +t/docs-pythonmarkdown2-tm-cases-pass/raw_html.html +t/docs-pythonmarkdown2-tm-cases-pass/raw_html.text +t/docs-pythonmarkdown2-tm-cases-pass/ref_links.html +t/docs-pythonmarkdown2-tm-cases-pass/ref_links.text +t/docs-pythonmarkdown2-tm-cases-pass/sublist-para.html +t/docs-pythonmarkdown2-tm-cases-pass/sublist-para.text +t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.html +t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.opts +t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.text +t/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.html +t/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.text +t/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.html +t/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.text +t/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.text +t/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.xhtml +t/Markdown-from-MDTest1.1.mdtest/Auto_links.text +t/Markdown-from-MDTest1.1.mdtest/Auto_links.xhtml +t/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.text +t/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.xhtml +t/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.text +t/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.xhtml +t/Markdown-from-MDTest1.1.mdtest/Code_Blocks.text +t/Markdown-from-MDTest1.1.mdtest/Code_Blocks.xhtml +t/Markdown-from-MDTest1.1.mdtest/Code_Spans.text +t/Markdown-from-MDTest1.1.mdtest/Code_Spans.xhtml +t/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.text +t/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.xhtml +t/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.text +t/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.xhtml +t/Markdown-from-MDTest1.1.mdtest/Images.text +t/Markdown-from-MDTest1.1.mdtest/Images.xhtml +t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).text +t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).xhtml +t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).html +t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).text +t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.html +t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.text +t/Markdown-from-MDTest1.1.mdtest/Links_inline_style.text +t/Markdown-from-MDTest1.1.mdtest/Links_inline_style.xhtml +t/Markdown-from-MDTest1.1.mdtest/Links_reference_style.text +t/Markdown-from-MDTest1.1.mdtest/Links_reference_style.xhtml +t/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.text +t/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.xhtml +t/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.text +t/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.xhtml +t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.text +t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.xhtml +t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.text +t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.xhtml +t/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.text +t/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.xhtml +t/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.text +t/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.xhtml +t/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.text +t/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.xhtml +t/Markdown-from-MDTest1.1.mdtest/Tabs.text +t/Markdown-from-MDTest1.1.mdtest/Tabs.xhtml +t/Markdown-from-MDTest1.1.mdtest/Tidyness.text +t/Markdown-from-MDTest1.1.mdtest/Tidyness.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Headers.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Headers.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).html +t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).text +t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).text +t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.html +t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.text +t/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.text +t/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.xhtml +t/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.text +t/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.xhtml +t/rt37909.t +t/rt48943.t +t/Text-Markdown.mdtest/CoreDumps5.8.text +t/Text-Markdown.mdtest/CoreDumps5.8.xhtml +t/Text-Markdown.mdtest/Emphasis.text +t/Text-Markdown.mdtest/Emphasis.xhtml +t/Text-Markdown.mdtest/HTML-Comment-encoding.text +t/Text-Markdown.mdtest/HTML-Comment-encoding.xhtml +t/Text-Markdown.mdtest/HTML5-attributes.html +t/Text-Markdown.mdtest/HTML5-attributes.text +t/Text-Markdown.mdtest/Links_brackets.text +t/Text-Markdown.mdtest/Links_brackets.xhtml +t/Text-Markdown.mdtest/Links_multiline_bugs_1.html +t/Text-Markdown.mdtest/Links_multiline_bugs_1.text +t/Text-Markdown.mdtest/Links_multiline_bugs_2.html +t/Text-Markdown.mdtest/Links_multiline_bugs_2.text +t/Text-Markdown.mdtest/Links_reference_style.text +t/Text-Markdown.mdtest/Links_reference_style.xhtml +t/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.text +t/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.xhtml +t/Text-Markdown.mdtest/PHP-ASP_tags.text +t/Text-Markdown.mdtest/PHP-ASP_tags.xhtml +t/Text-Markdown.mdtest/Unicode.text +t/Text-Markdown.mdtest/Unicode.xhtml +Todo diff --git a/META.yml b/META.yml new file mode 100644 index 0000000..3741e79 --- /dev/null +++ b/META.yml @@ -0,0 +1,34 @@ +--- +abstract: 'Convert Markdown syntax to (X)HTML' +author: + - 'Tomas Doran <bobtfish@bobtfish.net>' +build_requires: + ExtUtils::MakeMaker: 6.42 + FindBin: 0 + List::MoreUtils: 0 + Test::Differences: 0 + Test::Exception: 0 + Test::More: 0.42 +configure_requires: + ExtUtils::MakeMaker: 6.42 +distribution_type: module +generated_by: 'Module::Install version 0.910' +license: bsd +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: Text-Markdown +no_index: + directory: + - inc + - t +requires: + Digest::MD5: 0 + Encode: 0 + Text::Balanced: 0 + perl: 5.8.0 +resources: + bugtracker: http://github.com/bobtfish/text-markdown/issues + license: http://opensource.org/licenses/bsd-license.php + repository: http://github.com/bobtfish/text-markdown/ +version: 1.000031 diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..9c8f66f --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,37 @@ +# Load the Module::Install bundled in ./inc/ +use inc::Module::Install; + +# Define metadata +name 'Text-Markdown'; +author 'Tomas Doran <bobtfish@bobtfish.net>'; +license 'bsd'; +all_from 'lib/Text/Markdown.pm'; + +resources bugtracker => 'http://github.com/bobtfish/text-markdown/issues'; +resources repository => 'http://github.com/bobtfish/text-markdown/'; + +# Specific dependencies +perl_version '5.008'; +requires 'Digest::MD5' => undef; +requires 'Text::Balanced' => undef; +requires 'Encode' => undef; +test_requires 'Test::More' => '0.42'; +test_requires 'Test::Exception' => undef; +test_requires 'List::MoreUtils' => undef; +test_requires 'Test::Differences' => undef; +test_requires 'FindBin' => undef; + +if ($Module::Install::AUTHOR) { + system("pod2text lib/Text/Markdown.pm > README") + and die $!; + require Module::Install::CheckConflicts; +} + +check_conflicts( + 'Text::MultiMarkdown' => '1.0.27', +); + +install_script 'script/Markdown.pl'; + +WriteAll; + @@ -0,0 +1,232 @@ +NAME + Text::Markdown - Convert Markdown syntax to (X)HTML + +SYNOPSIS + use Text::Markdown 'markdown'; + my $html = markdown($text); + + use Text::Markdown 'markdown'; + my $html = markdown( $text, { + empty_element_suffix => '>', + tab_width => 2, + } ); + + use Text::Markdown; + my $m = Text::Markdown->new; + my $html = $m->markdown($text); + + use Text::Markdown; + my $m = Text::MultiMarkdown->new( + empty_element_suffix => '>', + tab_width => 2, + ); + my $html = $m->markdown( $text ); + +DESCRIPTION + Markdown is a text-to-HTML filter; it translates an easy-to-read / + easy-to-write structured text format into HTML. Markdown's text format + is most similar to that of plain text email, and supports features such + as headers, *emphasis*, code blocks, blockquotes, and links. + + Markdown's syntax is designed not as a generic markup language, but + specifically to serve as a front-end to (X)HTML. You can use span-level + HTML tags anywhere in a Markdown document, and you can use block level + HTML tags (like <div> and <table> as well). + +SYNTAX + This module implements the 'original' Markdown markdown syntax from: + + http://daringfireball.net/projects/markdown/ + + Note that Text::Markdown ensures that the output always ends with one + newline. The fact that multiple newlines are collapsed into one makes + sense, because this is the behavior of HTML towards whispace. The fact + that there's always a newline at the end makes sense again, given that + the output will always be nested in a block-level element (as opposed to + an inline element). That block element can be a "<p>" (most often), or a + "<table>". + + Markdown is not interpreted in HTML block-level elements, in order for + chunks of pasted HTML (e.g. JavaScript widgets, web counters) to not be + magically (mis)interpreted. For selective processing of Markdown in + some, but not other, HTML block elements, add a "markdown" attribute to + the block element and set its value to 1, "on" or "yes": + + <div markdown="1" class="navbar"> + * Home + * About + * Contact + <div> + + The extra "markdown" attribute will be stripped when generating the + output. + +OPTIONS + Text::Markdown supports a number of options to its processor which + control the behaviour of the output document. + + These options can be supplied to the constructor, or in a hash within + individual calls to the "markdown" method. See the SYNOPSIS for examples + of both styles. + + The options for the processor are: + + empty_element_suffix + This option controls the end of empty element tags: + + '/>' for XHTML (default) + '>' for HTML + + tab_width + Controls indent width in the generated markup. Defaults to 4. + + trust_list_start_value + If true, ordered lists will use the first number as the starting + point for numbering. This will let you pick up where you left off by + writing: + + 1. foo + 2. bar + + some paragraph + + 3. baz + 6. quux + + (Note that in the above, quux will be numbered 4.) + +METHODS + new + A simple constructor, see the SYNTAX and OPTIONS sections for more + information. + + markdown + The main function as far as the outside world is concerned. See the + SYNOPSIS for details on use. + + urls + Returns a reference to a hash with the key being the markdown reference + and the value being the URL. + + Useful for building scripts which preprocess a list of links before the + main content. See t/05options.t for an example of this hashref being + passed back into the markdown method to create links. + +OTHER IMPLEMENTATIONS + Markdown has been re-implemented in a number of languages, and with a + number of additions. + + Those that I have found are listed below: + + C - <http://www.pell.portland.or.us/~orc/Code/discount> + Discount - Original Markdown, but in C. Fastest implementation + available, and passes MDTest. Adds its own set of custom features. + + python - <http://www.freewisdom.org/projects/python-markdown/> + Python Markdown which is mostly compatible with the original, with + an interesting extension API. + + ruby (maruku) - <http://maruku.rubyforge.org/> + One of the nicest implementations out there. Builds a parse tree + internally so very flexible. + + php - <http://michelf.com/projects/php-markdown/> + A direct port of Markdown.pl, also has a separately maintained + 'extra' version, which adds a number of features that were borrowed + by MultiMarkdown. + + lua - <http://www.frykholm.se/files/markdown.lua> + Port to lua. Simple and lightweight (as lua is). + + haskell - <http://johnmacfarlane.net/pandoc/> + Pandoc is a more general library, supporting Markdown, + reStructuredText, LaTeX and more. + + javascript - <http://www.attacklab.net/showdown-gui.html> + Direct(ish) port of Markdown.pl to JavaScript + +BUGS + To file bug reports or feature requests please send email to: + + bug-Text-Markdown@rt.cpan.org + + Please include with your report: (1) the example input; (2) the output + you expected; (3) the output Markdown actually produced. + +VERSION HISTORY + See the Changes file for detailed release notes for this version. + +AUTHOR + John Gruber + http://daringfireball.net/ + + PHP port and other contributions by Michel Fortin + http://michelf.com/ + + MultiMarkdown changes by Fletcher Penney + http://fletcher.freeshell.org/ + + CPAN Module Text::MultiMarkdown (based on Text::Markdown by Sebastian + Riedel) originally by Darren Kulp (http://kulp.ch/) + + Support for markdown="1" by Dan Dascalescu (http://dandascalescu.com) + + This module is maintained by: Tomas Doran http://www.bobtfish.net/ + +THIS DISTRIBUTION + Please note that this distribution is a fork of John Gruber's original + Markdown project, and it *is not* in any way blessed by him. + + Whilst this code aims to be compatible with the original Markdown.pl + (and incorporates and passes the Markdown test suite) whilst fixing a + number of bugs in the original - there may be differences between the + behaviour of this module and Markdown.pl. If you find any differences + where you believe Text::Markdown behaves contrary to the Markdown spec, + please report them as bugs. + + Text::Markdown *does not* extend the markdown dialect in any way from + that which is documented at daringfireball. If you want additional + features, you should look at Text::MultiMarkdown. + +SOURCE CODE + You can find the source code repository for Text::Markdown and + Text::MultiMarkdown on GitHub at + <http://github.com/bobtfish/text-markdown>. + +COPYRIGHT AND LICENSE + Original Code Copyright (c) 2003-2004 John Gruber + <http://daringfireball.net/> All rights reserved. + + MultiMarkdown changes Copyright (c) 2005-2006 Fletcher T. Penney + <http://fletcher.freeshell.org/> All rights reserved. + + Text::MultiMarkdown changes Copyright (c) 2006-2009 Darren Kulp + <http://kulp.ch> and Tomas Doran <http://www.bobtfish.net> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name "Markdown" nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + + This software is provided by the copyright holders and contributors "as + is" and any express or implied warranties, including, but not limited + to, the implied warranties of merchantability and fitness for a + particular purpose are disclaimed. In no event shall the copyright owner + or contributors be liable for any direct, indirect, incidental, special, + exemplary, or consequential damages (including, but not limited to, + procurement of substitute goods or services; loss of use, data, or + profits; or business interruption) however caused and on any theory of + liability, whether in contract, strict liability, or tort (including + negligence or otherwise) arising in any way out of the use of this + software, even if advised of the possibility of such damage. + diff --git a/Readme.text b/Readme.text new file mode 100644 index 0000000..1ce7e5a --- /dev/null +++ b/Readme.text @@ -0,0 +1,348 @@ +# WARNING + +This Readme is from the original version of Markdown; not all of the +information contained herein is applicable to Test::Markdown the CPAN +module that includes this file. See the module's POD and the README file for +more information. + +Markdown +======== + +Version 1.0.1 - Tue 14 Dec 2004 + +by John Gruber +<http://daringfireball.net/> + + +Introduction +------------ + +Markdown is a text-to-HTML conversion tool for web writers. Markdown +allows you to write using an easy-to-read, easy-to-write plain text +format, then convert it to structurally valid XHTML (or HTML). + +Thus, "Markdown" is two things: a plain text markup syntax, and a +software tool, written in Perl, that converts the plain text markup +to HTML. + +Markdown works both as a Movable Type plug-in and as a standalone Perl +script -- which means it can also be used as a text filter in BBEdit +(or any other application that supporst filters written in Perl). + +Full documentation of Markdown's syntax and configuration options is +available on the web: <http://daringfireball.net/projects/markdown/>. +(Note: this readme file is formatted in Markdown.) + + + +Installation and Requirements +----------------------------- + +Markdown requires Perl 5.6.0 or later. Welcome to the 21st Century. +Markdown also requires the standard Perl library module `Digest::MD5`. + + +### Movable Type ### + +Markdown works with Movable Type version 2.6 or later (including +MT 3.0 or later). + +1. Copy the "Markdown.pl" file into your Movable Type "plugins" + directory. The "plugins" directory should be in the same directory + as "mt.cgi"; if the "plugins" directory doesn't already exist, use + your FTP program to create it. Your installation should look like + this: + + (mt home)/plugins/Markdown.pl + +2. Once installed, Markdown will appear as an option in Movable Type's + Text Formatting pop-up menu. This is selectable on a per-post basis. + Markdown translates your posts to HTML when you publish; the posts + themselves are stored in your MT database in Markdown format. + +3. If you also install SmartyPants 1.5 (or later), Markdown will offer + a second text formatting option: "Markdown with SmartyPants". This + option is the same as the regular "Markdown" formatter, except that + automatically uses SmartyPants to create typographically correct + curly quotes, em-dashes, and ellipses. See the SmartyPants web page + for more information: <http://daringfireball.net/projects/smartypants/> + +4. To make Markdown (or "Markdown with SmartyPants") your default + text formatting option for new posts, go to Weblog Config -> + Preferences. + +Note that by default, Markdown produces XHTML output. To configure +Markdown to produce HTML 4 output, see "Configuration", below. + + +### Blosxom ### + +Markdown works with Blosxom version 2.x. + +1. Rename the "Markdown.pl" plug-in to "Markdown" (case is + important). Movable Type requires plug-ins to have a ".pl" + extension; Blosxom forbids it. + +2. Copy the "Markdown" plug-in file to your Blosxom plug-ins folder. + If you're not sure where your Blosxom plug-ins folder is, see the + Blosxom documentation for information. + +3. That's it. The entries in your weblog will now automatically be + processed by Markdown. + +4. If you'd like to apply Markdown formatting only to certain posts, + rather than all of them, see Jason Clark's instructions for using + Markdown in conjunction with Blosxom's Meta plugin: + + <http://jclark.org/weblog/WebDev/Blosxom/Markdown.html> + + +### BBEdit ### + +Markdown works with BBEdit 6.1 or later on Mac OS X. (It also works +with BBEdit 5.1 or later and MacPerl 5.6.1 on Mac OS 8.6 or later.) + +1. Copy the "Markdown.pl" file to appropriate filters folder in your + "BBEdit Support" folder. On Mac OS X, this should be: + + BBEdit Support/Unix Support/Unix Filters/ + + See the BBEdit documentation for more details on the location of + these folders. + + You can rename "Markdown.pl" to whatever you wish. + +2. That's it. To use Markdown, select some text in a BBEdit document, + then choose Markdown from the Filters sub-menu in the "#!" menu, or + the Filters floating palette + + + +Configuration +------------- + +By default, Markdown produces XHTML output for tags with empty elements. +E.g.: + + <br /> + +Markdown can be configured to produce HTML-style tags; e.g.: + + <br> + + +### Movable Type ### + +You need to use a special `MTMarkdownOptions` container tag in each +Movable Type template where you want HTML 4-style output: + + <MTMarkdownOptions output='html4'> + ... put your entry content here ... + </MTMarkdownOptions> + +The easiest way to use MTMarkdownOptions is probably to put the +opening tag right after your `<body>` tag, and the closing tag right +before `</body>`. + +To suppress Markdown processing in a particular template, i.e. to +publish the raw Markdown-formatted text without translation into +(X)HTML, set the `output` attribute to 'raw': + + <MTMarkdownOptions output='raw'> + ... put your entry content here ... + </MTMarkdownOptions> + + +### Command-Line ### + +Use the `--html4tags` command-line switch to produce HTML output from a +Unix-style command line. E.g.: + + % perl Markdown.pl --html4tags foo.text + +Type `perldoc Markdown.pl`, or read the POD documentation within the +Markdown.pl source code for more information. + + + +Bugs +---- + +To file bug reports or feature requests please send email to: +<markdown@daringfireball.net>. + + + +Version History +--------------- + +1.0.1 (14 Dec 2004): + ++ Changed the syntax rules for code blocks and spans. Previously, + backslash escapes for special Markdown characters were processed + everywhere other than within inline HTML tags. Now, the contents + of code blocks and spans are no longer processed for backslash + escapes. This means that code blocks and spans are now treated + literally, with no special rules to worry about regarding + backslashes. + + **NOTE**: This changes the syntax from all previous versions of + Markdown. Code blocks and spans involving backslash characters + will now generate different output than before. + ++ Tweaked the rules for link definitions so that they must occur + within three spaces of the left margin. Thus if you indent a link + definition by four spaces or a tab, it will now be a code block. + + [a]: /url/ "Indented 3 spaces, this is a link def" + + [b]: /url/ "Indented 4 spaces, this is a code block" + + **IMPORTANT**: This may affect existing Markdown content if it + contains link definitions indented by 4 or more spaces. + ++ Added `>`, `+`, and `-` to the list of backslash-escapable + characters. These should have been done when these characters + were added as unordered list item markers. + ++ Trailing spaces and tabs following HTML comments and `<hr/>` tags + are now ignored. + ++ Inline links using `<` and `>` URL delimiters weren't working: + + like [this](<http://example.com/>) + ++ Added a bit of tolerance for trailing spaces and tabs after + Markdown hr's. + ++ Fixed bug where auto-links were being processed within code spans: + + like this: `<http://example.com/>` + ++ Sort-of fixed a bug where lines in the middle of hard-wrapped + paragraphs, which lines look like the start of a list item, + would accidentally trigger the creation of a list. E.g. a + paragraph that looked like this: + + I recommend upgrading to version + 8. Oops, now this line is treated + as a sub-list. + + This is fixed for top-level lists, but it can still happen for + sub-lists. E.g., the following list item will not be parsed + properly: + + + I recommend upgrading to version + 8. Oops, now this line is treated + as a sub-list. + + Given Markdown's list-creation rules, I'm not sure this can + be fixed. + ++ Standalone HTML comments are now handled; previously, they'd get + wrapped in a spurious `<p>` tag. + ++ Fix for horizontal rules preceded by 2 or 3 spaces. + ++ `<hr>` HTML tags in must occur within three spaces of left + margin. (With 4 spaces or a tab, they should be code blocks, but + weren't before this fix.) + ++ Capitalized "With" in "Markdown With SmartyPants" for + consistency with the same string label in SmartyPants.pl. + (This fix is specific to the MT plug-in interface.) + ++ Auto-linked email address can now optionally contain + a 'mailto:' protocol. I.e. these are equivalent: + + <mailto:user@example.com> + <user@example.com> + ++ Fixed annoying bug where nested lists would wind up with + spurious (and invalid) `<p>` tags. + ++ You can now write empty links: + + [like this]() + + and they'll be turned into anchor tags with empty href attributes. + This should have worked before, but didn't. + ++ `***this***` and `___this___` are now turned into + + <strong><em>this</em></strong> + + Instead of + + <strong><em>this</strong></em> + + which isn't valid. (Thanks to Michel Fortin for the fix.) + ++ Added a new substitution in `_EncodeCode()`: s/\$/$/g; This + is only for the benefit of Blosxom users, because Blosxom + (sometimes?) interpolates Perl scalars in your article bodies. + ++ Fixed problem for links defined with urls that include parens, e.g.: + + [1]: http://sources.wikipedia.org/wiki/Middle_East_Policy_(Chomsky) + + "Chomsky" was being erroneously treated as the URL's title. + ++ At some point during 1.0's beta cycle, I changed every sub's + argument fetching from this idiom: + + my $text = shift; + + to: + + my $text = shift || return ''; + + The idea was to keep Markdown from doing any work in a sub + if the input was empty. This introduced a bug, though: + if the input to any function was the single-character string + "0", it would also evaluate as false and return immediately. + How silly. Now fixed. + + + +Donations +--------- + +Donations to support Markdown's development are happily accepted. See: +<http://daringfireball.net/projects/markdown/> for details. + + + +Copyright and License +--------------------- + +Copyright (c) 2003-2004 John Gruber +<http://daringfireball.net/> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name "Markdown" nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +This software is provided by the copyright holders and contributors "as +is" and any express or implied warranties, including, but not limited +to, the implied warranties of merchantability and fitness for a +particular purpose are disclaimed. In no event shall the copyright owner +or contributors be liable for any direct, indirect, incidental, special, +exemplary, or consequential damages (including, but not limited to, +procurement of substitute goods or services; loss of use, data, or +profits; or business interruption) however caused and on any theory of +liability, whether in contract, strict liability, or tort (including +negligence or otherwise) arising in any way out of the use of this +software, even if advised of the possibility of such damage. @@ -0,0 +1,42 @@ +Todo pre 1.0.23: + . Tests for $footnote =~ s/^glossary:\s*//i + . Tests for $footnote_closing_tag + . Add an option to Text::Markdown to have original brand markdown style + emphasis within words support. + . Re-merge Movable Type and Bloxom compatibility to the scripts, and add + tests. + . Need a dingus, write a small / demo app then ask the catalyst guys to + host? + . Re-write this Todo list. + +Todo pre 1.0.24: + . Make Markdown.pl and MultiMarkdown.pl warn if unexpected options are + used, and also have docs on what options are available. Expose the other + module options in the scripts. + . http://rt.cpan.org/Ticket/Display.html?id=33443 + . More tests in t/15inlinehtmldoesnoturnoffmarkdown.t, I bet turning this + feature on breaks things. + . Document the markdown (and multimarkdown) syntaxes in the module + properly. + +Todo pre 1.0.25: + . Fix the list bug (see t/17ulolreportedonlist.t and Markdown mailing + list) This probably involves the first draught of the new parser... + . Text::Balanced is the slowest thing ever. + The syntax guide looks like this: + 49.4 0.569 0.568 113 0.0050 0.0050 Text::Balanced::_match_tagged + 18.1 0.209 0.791 3 0.0696 0.2637 Text::MultiMarkdown::_HashHTMLBlocks + +Todo pre 1.0.26: + . Have a look at extra features in + http://code.google.com/p/python-markdown2/wiki/Extras and put anything + we consider useful on the roadmap. + . Integrate maruku (ruby port) test cases properly, and go looking for + more. + . Make a Text::Markdown::Extra with the Markdown extra features? + +Todo pre 1.1: + . Build a parse tree when parsing (which can be returned), rather than just + using strings. This would make the output format much more flexible, and + would remove a load of nasty hacks which escape, then un-escape things + again whist processing.. diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm new file mode 100644 index 0000000..51eda5d --- /dev/null +++ b/inc/Module/Install.pm @@ -0,0 +1,430 @@ +#line 1 +package Module::Install; + +# For any maintainers: +# The load order for Module::Install is a bit magic. +# It goes something like this... +# +# IF ( host has Module::Install installed, creating author mode ) { +# 1. Makefile.PL calls "use inc::Module::Install" +# 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install +# 3. The installed version of inc::Module::Install loads +# 4. inc::Module::Install calls "require Module::Install" +# 5. The ./inc/ version of Module::Install loads +# } ELSE { +# 1. Makefile.PL calls "use inc::Module::Install" +# 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install +# 3. The ./inc/ version of Module::Install loads +# } + +use 5.005; +use strict 'vars'; + +use vars qw{$VERSION $MAIN}; +BEGIN { + # All Module::Install core packages now require synchronised versions. + # This will be used to ensure we don't accidentally load old or + # different versions of modules. + # This is not enforced yet, but will be some time in the next few + # releases once we can make sure it won't clash with custom + # Module::Install extensions. + $VERSION = '0.91'; + + # Storage for the pseudo-singleton + $MAIN = undef; + + *inc::Module::Install::VERSION = *VERSION; + @inc::Module::Install::ISA = __PACKAGE__; + +} + + + + + +# Whether or not inc::Module::Install is actually loaded, the +# $INC{inc/Module/Install.pm} is what will still get set as long as +# the caller loaded module this in the documented manner. +# If not set, the caller may NOT have loaded the bundled version, and thus +# they may not have a MI version that works with the Makefile.PL. This would +# result in false errors or unexpected behaviour. And we don't want that. +my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; +unless ( $INC{$file} ) { die <<"END_DIE" } + +Please invoke ${\__PACKAGE__} with: + + use inc::${\__PACKAGE__}; + +not: + + use ${\__PACKAGE__}; + +END_DIE + + + + + +# If the script that is loading Module::Install is from the future, +# then make will detect this and cause it to re-run over and over +# again. This is bad. Rather than taking action to touch it (which +# is unreliable on some platforms and requires write permissions) +# for now we should catch this and refuse to run. +if ( -f $0 ) { + my $s = (stat($0))[9]; + + # If the modification time is only slightly in the future, + # sleep briefly to remove the problem. + my $a = $s - time; + if ( $a > 0 and $a < 5 ) { sleep 5 } + + # Too far in the future, throw an error. + my $t = time; + if ( $s > $t ) { die <<"END_DIE" } + +Your installer $0 has a modification time in the future ($s > $t). + +This is known to create infinite loops in make. + +Please correct this, then run $0 again. + +END_DIE +} + + + + + +# Build.PL was formerly supported, but no longer is due to excessive +# difficulty in implementing every single feature twice. +if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" } + +Module::Install no longer supports Build.PL. + +It was impossible to maintain duel backends, and has been deprecated. + +Please remove all Build.PL files and only use the Makefile.PL installer. + +END_DIE + + + + + +# To save some more typing in Module::Install installers, every... +# use inc::Module::Install +# ...also acts as an implicit use strict. +$^H |= strict::bits(qw(refs subs vars)); + + + + + +use Cwd (); +use File::Find (); +use File::Path (); +use FindBin; + +sub autoload { + my $self = shift; + my $who = $self->_caller; + my $cwd = Cwd::cwd(); + my $sym = "${who}::AUTOLOAD"; + $sym->{$cwd} = sub { + my $pwd = Cwd::cwd(); + if ( my $code = $sym->{$pwd} ) { + # Delegate back to parent dirs + goto &$code unless $cwd eq $pwd; + } + $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; + my $method = $1; + if ( uc($method) eq $method ) { + # Do nothing + return; + } elsif ( $method =~ /^_/ and $self->can($method) ) { + # Dispatch to the root M:I class + return $self->$method(@_); + } + + # Dispatch to the appropriate plugin + unshift @_, ( $self, $1 ); + goto &{$self->can('call')}; + }; +} + +sub import { + my $class = shift; + my $self = $class->new(@_); + my $who = $self->_caller; + + unless ( -f $self->{file} ) { + require "$self->{path}/$self->{dispatch}.pm"; + File::Path::mkpath("$self->{prefix}/$self->{author}"); + $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); + $self->{admin}->init; + @_ = ($class, _self => $self); + goto &{"$self->{name}::import"}; + } + + *{"${who}::AUTOLOAD"} = $self->autoload; + $self->preload; + + # Unregister loader and worker packages so subdirs can use them again + delete $INC{"$self->{file}"}; + delete $INC{"$self->{path}.pm"}; + + # Save to the singleton + $MAIN = $self; + + return 1; +} + +sub preload { + my $self = shift; + unless ( $self->{extensions} ) { + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ); + } + + my @exts = @{$self->{extensions}}; + unless ( @exts ) { + @exts = $self->{admin}->load_all_extensions; + } + + my %seen; + foreach my $obj ( @exts ) { + while (my ($method, $glob) = each %{ref($obj) . '::'}) { + next unless $obj->can($method); + next if $method =~ /^_/; + next if $method eq uc($method); + $seen{$method}++; + } + } + + my $who = $self->_caller; + foreach my $name ( sort keys %seen ) { + *{"${who}::$name"} = sub { + ${"${who}::AUTOLOAD"} = "${who}::$name"; + goto &{"${who}::AUTOLOAD"}; + }; + } +} + +sub new { + my ($class, %args) = @_; + + # ignore the prefix on extension modules built from top level. + my $base_path = Cwd::abs_path($FindBin::Bin); + unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { + delete $args{prefix}; + } + + return $args{_self} if $args{_self}; + + $args{dispatch} ||= 'Admin'; + $args{prefix} ||= 'inc'; + $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); + $args{bundle} ||= 'inc/BUNDLES'; + $args{base} ||= $base_path; + $class =~ s/^\Q$args{prefix}\E:://; + $args{name} ||= $class; + $args{version} ||= $class->VERSION; + unless ( $args{path} ) { + $args{path} = $args{name}; + $args{path} =~ s!::!/!g; + } + $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + $args{wrote} = 0; + + bless( \%args, $class ); +} + +sub call { + my ($self, $method) = @_; + my $obj = $self->load($method) or return; + splice(@_, 0, 2, $obj); + goto &{$obj->can($method)}; +} + +sub load { + my ($self, $method) = @_; + + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ) unless $self->{extensions}; + + foreach my $obj (@{$self->{extensions}}) { + return $obj if $obj->can($method); + } + + my $admin = $self->{admin} or die <<"END_DIE"; +The '$method' method does not exist in the '$self->{prefix}' path! +Please remove the '$self->{prefix}' directory and run $0 again to load it. +END_DIE + + my $obj = $admin->load($method, 1); + push @{$self->{extensions}}, $obj; + + $obj; +} + +sub load_extensions { + my ($self, $path, $top) = @_; + + unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) { + unshift @INC, $self->{prefix}; + } + + foreach my $rv ( $self->find_extensions($path) ) { + my ($file, $pkg) = @{$rv}; + next if $self->{pathnames}{$pkg}; + + local $@; + my $new = eval { require $file; $pkg->can('new') }; + unless ( $new ) { + warn $@ if $@; + next; + } + $self->{pathnames}{$pkg} = delete $INC{$file}; + push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); + } + + $self->{extensions} ||= []; +} + +sub find_extensions { + my ($self, $path) = @_; + + my @found; + File::Find::find( sub { + my $file = $File::Find::name; + return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; + my $subpath = $1; + return if lc($subpath) eq lc($self->{dispatch}); + + $file = "$self->{path}/$subpath.pm"; + my $pkg = "$self->{name}::$subpath"; + $pkg =~ s!/!::!g; + + # If we have a mixed-case package name, assume case has been preserved + # correctly. Otherwise, root through the file to locate the case-preserved + # version of the package name. + if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { + my $content = Module::Install::_read($subpath . '.pm'); + my $in_pod = 0; + foreach ( split //, $content ) { + $in_pod = 1 if /^=\w/; + $in_pod = 0 if /^=cut/; + next if ($in_pod || /^=cut/); # skip pod text + next if /^\s*#/; # and comments + if ( m/^\s*package\s+($pkg)\s*;/i ) { + $pkg = $1; + last; + } + } + } + + push @found, [ $file, $pkg ]; + }, $path ) if -d $path; + + @found; +} + + + + + +##################################################################### +# Common Utility Functions + +sub _caller { + my $depth = 0; + my $call = caller($depth); + while ( $call eq __PACKAGE__ ) { + $depth++; + $call = caller($depth); + } + return $call; +} + +sub _read { + local *FH; + if ( $] >= 5.006 ) { + open( FH, '<', $_[0] ) or die "open($_[0]): $!"; + } else { + open( FH, "< $_[0]" ) or die "open($_[0]): $!"; + } + my $string = do { local $/; <FH> }; + close FH or die "close($_[0]): $!"; + return $string; +} + +sub _readperl { + my $string = Module::Install::_read($_[0]); + $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; + $string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s; + $string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg; + return $string; +} + +sub _readpod { + my $string = Module::Install::_read($_[0]); + $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; + return $string if $_[0] =~ /\.pod\z/; + $string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg; + $string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg; + $string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg; + $string =~ s/^\n+//s; + return $string; +} + +sub _write { + local *FH; + if ( $] >= 5.006 ) { + open( FH, '>', $_[0] ) or die "open($_[0]): $!"; + } else { + open( FH, "> $_[0]" ) or die "open($_[0]): $!"; + } + foreach ( 1 .. $#_ ) { + print FH $_[$_] or die "print($_[0]): $!"; + } + close FH or die "close($_[0]): $!"; +} + +# _version is for processing module versions (eg, 1.03_05) not +# Perl versions (eg, 5.8.1). +sub _version ($) { + my $s = shift || 0; + my $d =()= $s =~ /(\.)/g; + if ( $d >= 2 ) { + # Normalise multipart versions + $s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg; + } + $s =~ s/^(\d+)\.?//; + my $l = $1 || 0; + my @v = map { + $_ . '0' x (3 - length $_) + } $s =~ /(\d{1,3})\D?/g; + $l = $l . '.' . join '', @v if @v; + return $l + 0; +} + +sub _cmp ($$) { + _version($_[0]) <=> _version($_[1]); +} + +# Cloned from Params::Util::_CLASS +sub _CLASS ($) { + ( + defined $_[0] + and + ! ref $_[0] + and + $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s + ) ? $_[0] : undef; +} + +1; + +# Copyright 2008 - 2009 Adam Kennedy. diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm new file mode 100644 index 0000000..e990eda --- /dev/null +++ b/inc/Module/Install/Base.pm @@ -0,0 +1,78 @@ +#line 1 +package Module::Install::Base; + +use strict 'vars'; +use vars qw{$VERSION}; +BEGIN { + $VERSION = '0.91'; +} + +# Suspend handler for "redefined" warnings +BEGIN { +# my $w = $SIG{__WARN__}; +# $SIG{__WARN__} = sub { $w }; +} + +#line 42 + +sub new { + my $class = shift; + unless ( defined &{"${class}::call"} ) { + *{"${class}::call"} = sub { shift->_top->call(@_) }; + } + unless ( defined &{"${class}::load"} ) { + *{"${class}::load"} = sub { shift->_top->load(@_) }; + } + bless { @_ }, $class; +} + +#line 61 + +sub AUTOLOAD { + local $@; + my $func = eval { shift->_top->autoload } or return; + goto &$func; +} + +#line 75 + +sub _top { + $_[0]->{_top}; +} + +#line 90 + +sub admin { + $_[0]->_top->{admin} + or + Module::Install::Base::FakeAdmin->new; +} + +#line 106 + +sub is_admin { + $_[0]->admin->VERSION; +} + +sub DESTROY {} + +package Module::Install::Base::FakeAdmin; + +my $fake; + +sub new { + $fake ||= bless(\@_, $_[0]); +} + +sub AUTOLOAD {} + +sub DESTROY {} + +# Restore warning handler +BEGIN { +# $SIG{__WARN__} = $SIG{__WARN__}->(); +} + +1; + +#line 154 diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm new file mode 100644 index 0000000..e65e4f6 --- /dev/null +++ b/inc/Module/Install/Can.pm @@ -0,0 +1,81 @@ +#line 1 +package Module::Install::Can; + +use strict; +use Config (); +use File::Spec (); +use ExtUtils::MakeMaker (); +use Module::Install::Base (); + +use vars qw{$VERSION @ISA $ISCORE}; +BEGIN { + $VERSION = '0.91'; + @ISA = 'Module::Install::Base'; + $ISCORE = 1; +} + +# check if we can load some module +### Upgrade this to not have to load the module if possible +sub can_use { + my ($self, $mod, $ver) = @_; + $mod =~ s{::|\\}{/}g; + $mod .= '.pm' unless $mod =~ /\.pm$/i; + + my $pkg = $mod; + $pkg =~ s{/}{::}g; + $pkg =~ s{\.pm$}{}i; + + local $@; + eval { require $mod; $pkg->VERSION($ver || 0); 1 }; +} + +# check if we can run some command +sub can_run { + my ($self, $cmd) = @_; + + my $_cmd = $cmd; + return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd)); + + for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { + next if $dir eq ''; + my $abs = File::Spec->catfile($dir, $_[1]); + return $abs if (-x $abs or $abs = MM->maybe_command($abs)); + } + + return; +} + +# can we locate a (the) C compiler +sub can_cc { + my $self = shift; + my @chunks = split(/ /, $Config::Config{cc}) or return; + + # $Config{cc} may contain args; try to find out the program part + while (@chunks) { + return $self->can_run("@chunks") || (pop(@chunks), next); + } + + return; +} + +# Fix Cygwin bug on maybe_command(); +if ( $^O eq 'cygwin' ) { + require ExtUtils::MM_Cygwin; + require ExtUtils::MM_Win32; + if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) { + *ExtUtils::MM_Cygwin::maybe_command = sub { + my ($self, $file) = @_; + if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) { + ExtUtils::MM_Win32->maybe_command($file); + } else { + ExtUtils::MM_Unix->maybe_command($file); + } + } + } +} + +1; + +__END__ + +#line 156 diff --git a/inc/Module/Install/CheckConflicts.pm b/inc/Module/Install/CheckConflicts.pm new file mode 100644 index 0000000..53e993b --- /dev/null +++ b/inc/Module/Install/CheckConflicts.pm @@ -0,0 +1,67 @@ +#line 1 +use strict; +use warnings; + +package Module::Install::CheckConflicts; + +use base 'Module::Install::Base'; + +BEGIN { + our $VERSION = '0.02'; + our $ISCORE = 1; +} + +sub check_conflicts { + my $self = shift; + # Deal with the fact that prompt_script calls us with just the script + # name by totally ignoring it. HACK! + my %conflicts = @_ unless scalar(@_) == 1; + my %conflicts_found; + for my $mod (sort keys %conflicts) { + next unless $self->can_use($mod); + + my $installed = $mod->VERSION; + next unless $installed le $conflicts{$mod}; + + $conflicts_found{$mod} = $installed; + } + + return unless scalar keys %conflicts_found; + + my $dist = $self->name; + + print <<"EOM"; + +*** + WARNING: + + This version of ${dist} conflicts with + the version of some modules you have installed. + + You will need to upgrade these modules after + installing this version of ${dist}. + + List of the conflicting modules and their installed + versions: + +EOM + + for my $mod (sort keys %conflicts_found) { + print sprintf(" %s : %s (<= %s)\n", + $mod, $conflicts_found{$mod}, $conflicts{$mod}, + ); + } + + print "\n***\n"; + + return if $ENV{PERL_MM_USE_DEFAULT}; + return unless -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)); + + sleep 4; +} + +1; + +__END__ + +#line 124 diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm new file mode 100644 index 0000000..05f2079 --- /dev/null +++ b/inc/Module/Install/Fetch.pm @@ -0,0 +1,93 @@ +#line 1 +package Module::Install::Fetch; + +use strict; +use Module::Install::Base (); + +use vars qw{$VERSION @ISA $ISCORE}; +BEGIN { + $VERSION = '0.91'; + @ISA = 'Module::Install::Base'; + $ISCORE = 1; +} + +sub get_file { + my ($self, %args) = @_; + my ($scheme, $host, $path, $file) = + $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return; + + if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) { + $args{url} = $args{ftp_url} + or (warn("LWP support unavailable!\n"), return); + ($scheme, $host, $path, $file) = + $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return; + } + + $|++; + print "Fetching '$file' from $host... "; + + unless (eval { require Socket; Socket::inet_aton($host) }) { + warn "'$host' resolve failed!\n"; + return; + } + + return unless $scheme eq 'ftp' or $scheme eq 'http'; + + require Cwd; + my $dir = Cwd::getcwd(); + chdir $args{local_dir} or return if exists $args{local_dir}; + + if (eval { require LWP::Simple; 1 }) { + LWP::Simple::mirror($args{url}, $file); + } + elsif (eval { require Net::FTP; 1 }) { eval { + # use Net::FTP to get past firewall + my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600); + $ftp->login("anonymous", 'anonymous@example.com'); + $ftp->cwd($path); + $ftp->binary; + $ftp->get($file) or (warn("$!\n"), return); + $ftp->quit; + } } + elsif (my $ftp = $self->can_run('ftp')) { eval { + # no Net::FTP, fallback to ftp.exe + require FileHandle; + my $fh = FileHandle->new; + + local $SIG{CHLD} = 'IGNORE'; + unless ($fh->open("|$ftp -n")) { + warn "Couldn't open ftp: $!\n"; + chdir $dir; return; + } + + my @dialog = split(/\n/, <<"END_FTP"); +open $host +user anonymous anonymous\@example.com +cd $path +binary +get $file $file +quit +END_FTP + foreach (@dialog) { $fh->print("$_\n") } + $fh->close; + } } + else { + warn "No working 'ftp' program available!\n"; + chdir $dir; return; + } + + unless (-f $file) { + warn "Fetching failed: $@\n"; + chdir $dir; return; + } + + return if exists $args{size} and -s $file != $args{size}; + system($args{run}) if exists $args{run}; + unlink($file) if $args{remove}; + + print(((!exists $args{check_for} or -e $args{check_for}) + ? "done!" : "failed! ($!)"), "\n"); + chdir $dir; return !$?; +} + +1; diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm new file mode 100644 index 0000000..98779db --- /dev/null +++ b/inc/Module/Install/Makefile.pm @@ -0,0 +1,268 @@ +#line 1 +package Module::Install::Makefile; + +use strict 'vars'; +use ExtUtils::MakeMaker (); +use Module::Install::Base (); + +use vars qw{$VERSION @ISA $ISCORE}; +BEGIN { + $VERSION = '0.91'; + @ISA = 'Module::Install::Base'; + $ISCORE = 1; +} + +sub Makefile { $_[0] } + +my %seen = (); + +sub prompt { + shift; + + # Infinite loop protection + my @c = caller(); + if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) { + die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])"; + } + + # In automated testing, always use defaults + if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) { + local $ENV{PERL_MM_USE_DEFAULT} = 1; + goto &ExtUtils::MakeMaker::prompt; + } else { + goto &ExtUtils::MakeMaker::prompt; + } +} + +sub makemaker_args { + my $self = shift; + my $args = ( $self->{makemaker_args} ||= {} ); + %$args = ( %$args, @_ ); + return $args; +} + +# For mm args that take multiple space-seperated args, +# append an argument to the current list. +sub makemaker_append { + my $self = sShift; + my $name = shift; + my $args = $self->makemaker_args; + $args->{name} = defined $args->{$name} + ? join( ' ', $args->{name}, @_ ) + : join( ' ', @_ ); +} + +sub build_subdirs { + my $self = shift; + my $subdirs = $self->makemaker_args->{DIR} ||= []; + for my $subdir (@_) { + push @$subdirs, $subdir; + } +} + +sub clean_files { + my $self = shift; + my $clean = $self->makemaker_args->{clean} ||= {}; + %$clean = ( + %$clean, + FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), + ); +} + +sub realclean_files { + my $self = shift; + my $realclean = $self->makemaker_args->{realclean} ||= {}; + %$realclean = ( + %$realclean, + FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), + ); +} + +sub libs { + my $self = shift; + my $libs = ref $_[0] ? shift : [ shift ]; + $self->makemaker_args( LIBS => $libs ); +} + +sub inc { + my $self = shift; + $self->makemaker_args( INC => shift ); +} + +my %test_dir = (); + +sub _wanted_t { + /\.t$/ and -f $_ and $test_dir{$File::Find::dir} = 1; +} + +sub tests_recursive { + my $self = shift; + if ( $self->tests ) { + die "tests_recursive will not work if tests are already defined"; + } + my $dir = shift || 't'; + unless ( -d $dir ) { + die "tests_recursive dir '$dir' does not exist"; + } + %test_dir = (); + require File::Find; + File::Find::find( \&_wanted_t, $dir ); + $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir ); +} + +sub write { + my $self = shift; + die "&Makefile->write() takes no arguments\n" if @_; + + # Check the current Perl version + my $perl_version = $self->perl_version; + if ( $perl_version ) { + eval "use $perl_version; 1" + or die "ERROR: perl: Version $] is installed, " + . "but we need version >= $perl_version"; + } + + # Make sure we have a new enough MakeMaker + require ExtUtils::MakeMaker; + + if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) { + # MakeMaker can complain about module versions that include + # an underscore, even though its own version may contain one! + # Hence the funny regexp to get rid of it. See RT #35800 + # for details. + $self->build_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ ); + $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ ); + } else { + # Allow legacy-compatibility with 5.005 by depending on the + # most recent EU:MM that supported 5.005. + $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 ); + $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 ); + } + + # Generate the MakeMaker params + my $args = $self->makemaker_args; + $args->{DISTNAME} = $self->name; + $args->{NAME} = $self->module_name || $self->name; + $args->{VERSION} = $self->version; + $args->{NAME} =~ s/-/::/g; + if ( $self->tests ) { + $args->{test} = { TESTS => $self->tests }; + } + if ( $] >= 5.005 ) { + $args->{ABSTRACT} = $self->abstract; + $args->{AUTHOR} = $self->author; + } + if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) { + $args->{NO_META} = 1; + } + if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) { + $args->{SIGN} = 1; + } + unless ( $self->is_admin ) { + delete $args->{SIGN}; + } + + # Merge both kinds of requires into prereq_pm + my $prereq = ($args->{PREREQ_PM} ||= {}); + %$prereq = ( %$prereq, + map { @$_ } + map { @$_ } + grep $_, + ($self->configure_requires, $self->build_requires, $self->requires) + ); + + # Remove any reference to perl, PREREQ_PM doesn't support it + delete $args->{PREREQ_PM}->{perl}; + + # merge both kinds of requires into prereq_pm + my $subdirs = ($args->{DIR} ||= []); + if ($self->bundles) { + foreach my $bundle (@{ $self->bundles }) { + my ($file, $dir) = @$bundle; + push @$subdirs, $dir if -d $dir; + delete $prereq->{$file}; + } + } + + if ( my $perl_version = $self->perl_version ) { + eval "use $perl_version; 1" + or die "ERROR: perl: Version $] is installed, " + . "but we need version >= $perl_version"; + } + + $args->{INSTALLDIRS} = $self->installdirs; + + my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args; + + my $user_preop = delete $args{dist}->{PREOP}; + if (my $preop = $self->admin->preop($user_preop)) { + foreach my $key ( keys %$preop ) { + $args{dist}->{$key} = $preop->{$key}; + } + } + + my $mm = ExtUtils::MakeMaker::WriteMakefile(%args); + $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile'); +} + +sub fix_up_makefile { + my $self = shift; + my $makefile_name = shift; + my $top_class = ref($self->_top) || ''; + my $top_version = $self->_top->VERSION || ''; + + my $preamble = $self->preamble + ? "# Preamble by $top_class $top_version\n" + . $self->preamble + : ''; + my $postamble = "# Postamble by $top_class $top_version\n" + . ($self->postamble || ''); + + local *MAKEFILE; + open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; + my $makefile = do { local $/; <MAKEFILE> }; + close MAKEFILE or die $!; + + $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; + $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; + $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; + $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; + $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; + + # Module::Install will never be used to build the Core Perl + # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks + # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist + $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m; + #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; + + # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. + $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; + + # XXX - This is currently unused; not sure if it breaks other MM-users + # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; + + open MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; + print MAKEFILE "$preamble$makefile$postamble" or die $!; + close MAKEFILE or die $!; + + 1; +} + +sub preamble { + my ($self, $text) = @_; + $self->{preamble} = $text . $self->{preamble} if defined $text; + $self->{preamble}; +} + +sub postamble { + my ($self, $text) = @_; + $self->{postamble} ||= $self->admin->postamble; + $self->{postamble} .= $text if defined $text; + $self->{postamble} +} + +1; + +__END__ + +#line 394 diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm new file mode 100644 index 0000000..653193d --- /dev/null +++ b/inc/Module/Install/Metadata.pm @@ -0,0 +1,624 @@ +#line 1 +package Module::Install::Metadata; + +use strict 'vars'; +use Module::Install::Base (); + +use vars qw{$VERSION @ISA $ISCORE}; +BEGIN { + $VERSION = '0.91'; + @ISA = 'Module::Install::Base'; + $ISCORE = 1; +} + +my @boolean_keys = qw{ + sign +}; + +my @scalar_keys = qw{ + name + module_name + abstract + author + version + distribution_type + tests + installdirs +}; + +my @tuple_keys = qw{ + configure_requires + build_requires + requires + recommends + bundles + resources +}; + +my @resource_keys = qw{ + homepage + bugtracker + repository +}; + +my @array_keys = qw{ + keywords +}; + +sub Meta { shift } +sub Meta_BooleanKeys { @boolean_keys } +sub Meta_ScalarKeys { @scalar_keys } +sub Meta_TupleKeys { @tuple_keys } +sub Meta_ResourceKeys { @resource_keys } +sub Meta_ArrayKeys { @array_keys } + +foreach my $key ( @boolean_keys ) { + *$key = sub { + my $self = shift; + if ( defined wantarray and not @_ ) { + return $self->{values}->{$key}; + } + $self->{values}->{$key} = ( @_ ? $_[0] : 1 ); + return $self; + }; +} + +foreach my $key ( @scalar_keys ) { + *$key = sub { + my $self = shift; + return $self->{values}->{$key} if defined wantarray and !@_; + $self->{values}->{$key} = shift; + return $self; + }; +} + +foreach my $key ( @array_keys ) { + *$key = sub { + my $self = shift; + return $self->{values}->{$key} if defined wantarray and !@_; + $self->{values}->{$key} ||= []; + push @{$self->{values}->{$key}}, @_; + return $self; + }; +} + +foreach my $key ( @resource_keys ) { + *$key = sub { + my $self = shift; + unless ( @_ ) { + return () unless $self->{values}->{resources}; + return map { $_->[1] } + grep { $_->[0] eq $key } + @{ $self->{values}->{resources} }; + } + return $self->{values}->{resources}->{$key} unless @_; + my $uri = shift or die( + "Did not provide a value to $key()" + ); + $self->resources( $key => $uri ); + return 1; + }; +} + +foreach my $key ( grep { $_ ne "resources" } @tuple_keys) { + *$key = sub { + my $self = shift; + return $self->{values}->{$key} unless @_; + my @added; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @added, [ $module, $version ]; + } + push @{ $self->{values}->{$key} }, @added; + return map {@$_} @added; + }; +} + +# Resource handling +my %lc_resource = map { $_ => 1 } qw{ + homepage + license + bugtracker + repository +}; + +sub resources { + my $self = shift; + while ( @_ ) { + my $name = shift or last; + my $value = shift or next; + if ( $name eq lc $name and ! $lc_resource{$name} ) { + die("Unsupported reserved lowercase resource '$name'"); + } + $self->{values}->{resources} ||= []; + push @{ $self->{values}->{resources} }, [ $name, $value ]; + } + $self->{values}->{resources}; +} + +# Aliases for build_requires that will have alternative +# meanings in some future version of META.yml. +sub test_requires { shift->build_requires(@_) } +sub install_requires { shift->build_requires(@_) } + +# Aliases for installdirs options +sub install_as_core { $_[0]->installdirs('perl') } +sub install_as_cpan { $_[0]->installdirs('site') } +sub install_as_site { $_[0]->installdirs('site') } +sub install_as_vendor { $_[0]->installdirs('vendor') } + +sub dynamic_config { + my $self = shift; + unless ( @_ ) { + warn "You MUST provide an explicit true/false value to dynamic_config\n"; + return $self; + } + $self->{values}->{dynamic_config} = $_[0] ? 1 : 0; + return 1; +} + +sub perl_version { + my $self = shift; + return $self->{values}->{perl_version} unless @_; + my $version = shift or die( + "Did not provide a value to perl_version()" + ); + + # Normalize the version + $version = $self->_perl_version($version); + + # We don't support the reall old versions + unless ( $version >= 5.005 ) { + die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n"; + } + + $self->{values}->{perl_version} = $version; +} + +#Stolen from M::B +my %license_urls = ( + perl => 'http://dev.perl.org/licenses/', + apache => 'http://apache.org/licenses/LICENSE-2.0', + artistic => 'http://opensource.org/licenses/artistic-license.php', + artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php', + lgpl => 'http://opensource.org/licenses/lgpl-license.php', + lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php', + lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html', + bsd => 'http://opensource.org/licenses/bsd-license.php', + gpl => 'http://opensource.org/licenses/gpl-license.php', + gpl2 => 'http://opensource.org/licenses/gpl-2.0.php', + gpl3 => 'http://opensource.org/licenses/gpl-3.0.html', + mit => 'http://opensource.org/licenses/mit-license.php', + mozilla => 'http://opensource.org/licenses/mozilla1.1.php', + open_source => undef, + unrestricted => undef, + restrictive => undef, + unknown => undef, +); + +sub license { + my $self = shift; + return $self->{values}->{license} unless @_; + my $license = shift or die( + 'Did not provide a value to license()' + ); + $self->{values}->{license} = $license; + + # Automatically fill in license URLs + if ( $license_urls{$license} ) { + $self->resources( license => $license_urls{$license} ); + } + + return 1; +} + +sub all_from { + my ( $self, $file ) = @_; + + unless ( defined($file) ) { + my $name = $self->name or die( + "all_from called with no args without setting name() first" + ); + $file = join('/', 'lib', split(/-/, $name)) . '.pm'; + $file =~ s{.*/}{} unless -e $file; + unless ( -e $file ) { + die("all_from cannot find $file from $name"); + } + } + unless ( -f $file ) { + die("The path '$file' does not exist, or is not a file"); + } + + # Some methods pull from POD instead of code. + # If there is a matching .pod, use that instead + my $pod = $file; + $pod =~ s/\.pm$/.pod/i; + $pod = $file unless -e $pod; + + # Pull the different values + $self->name_from($file) unless $self->name; + $self->version_from($file) unless $self->version; + $self->perl_version_from($file) unless $self->perl_version; + $self->author_from($pod) unless $self->author; + $self->license_from($pod) unless $self->license; + $self->abstract_from($pod) unless $self->abstract; + + return 1; +} + +sub provides { + my $self = shift; + my $provides = ( $self->{values}->{provides} ||= {} ); + %$provides = (%$provides, @_) if @_; + return $provides; +} + +sub auto_provides { + my $self = shift; + return $self unless $self->is_admin; + unless (-e 'MANIFEST') { + warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; + return $self; + } + # Avoid spurious warnings as we are not checking manifest here. + local $SIG{__WARN__} = sub {1}; + require ExtUtils::Manifest; + local *ExtUtils::Manifest::manicheck = sub { return }; + + require Module::Build; + my $build = Module::Build->new( + dist_name => $self->name, + dist_version => $self->version, + license => $self->license, + ); + $self->provides( %{ $build->find_dist_packages || {} } ); +} + +sub feature { + my $self = shift; + my $name = shift; + my $features = ( $self->{values}->{features} ||= [] ); + my $mods; + + if ( @_ == 1 and ref( $_[0] ) ) { + # The user used ->feature like ->features by passing in the second + # argument as a reference. Accomodate for that. + $mods = $_[0]; + } else { + $mods = \@_; + } + + my $count = 0; + push @$features, ( + $name => [ + map { + ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ + } @$mods + ] + ); + + return @$features; +} + +sub features { + my $self = shift; + while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { + $self->feature( $name, @$mods ); + } + return $self->{values}->{features} + ? @{ $self->{values}->{features} } + : (); +} + +sub no_index { + my $self = shift; + my $type = shift; + push @{ $self->{values}->{no_index}->{$type} }, @_ if $type; + return $self->{values}->{no_index}; +} + +sub read { + my $self = shift; + $self->include_deps( 'YAML::Tiny', 0 ); + + require YAML::Tiny; + my $data = YAML::Tiny::LoadFile('META.yml'); + + # Call methods explicitly in case user has already set some values. + while ( my ( $key, $value ) = each %$data ) { + next unless $self->can($key); + if ( ref $value eq 'HASH' ) { + while ( my ( $module, $version ) = each %$value ) { + $self->can($key)->($self, $module => $version ); + } + } else { + $self->can($key)->($self, $value); + } + } + return $self; +} + +sub write { + my $self = shift; + return $self unless $self->is_admin; + $self->admin->write_meta; + return $self; +} + +sub version_from { + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->version( ExtUtils::MM_Unix->parse_version($file) ); +} + +sub abstract_from { + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->abstract( + bless( + { DISTNAME => $self->name }, + 'ExtUtils::MM_Unix' + )->parse_abstract($file) + ); +} + +# Add both distribution and module name +sub name_from { + my ($self, $file) = @_; + if ( + Module::Install::_read($file) =~ m/ + ^ \s* + package \s* + ([\w:]+) + \s* ; + /ixms + ) { + my ($name, $module_name) = ($1, $1); + $name =~ s{::}{-}g; + $self->name($name); + unless ( $self->module_name ) { + $self->module_name($module_name); + } + } else { + die("Cannot determine name from $file\n"); + } +} + +sub perl_version_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ + (?:use|require) \s* + v? + ([\d_\.]+) + \s* ; + /ixms + ) { + my $perl_version = $1; + $perl_version =~ s{_}{}g; + $self->perl_version($perl_version); + } else { + warn "Cannot determine perl version info from $_[0]\n"; + return; + } +} + +sub author_from { + my $self = shift; + my $content = Module::Install::_read($_[0]); + if ($content =~ m/ + =head \d \s+ (?:authors?)\b \s* + ([^\n]*) + | + =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* + .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* + ([^\n]*) + /ixms) { + my $author = $1 || $2; + $author =~ s{E<lt>}{<}g; + $author =~ s{E<gt>}{>}g; + $self->author($author); + } else { + warn "Cannot determine author info from $_[0]\n"; + } +} + +sub license_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ( + =head \d \s+ + (?:licen[cs]e|licensing|copyright|legal)\b + .*? + ) + (=head\\d.*|=cut.*|) + \z + /ixms ) { + my $license_text = $1; + my @phrases = ( + 'under the same (?:terms|license) as (?:perl|the perl programming language) itself' => 'perl', 1, + 'GNU general public license' => 'gpl', 1, + 'GNU public license' => 'gpl', 1, + 'GNU lesser general public license' => 'lgpl', 1, + 'GNU lesser public license' => 'lgpl', 1, + 'GNU library general public license' => 'lgpl', 1, + 'GNU library public license' => 'lgpl', 1, + 'BSD license' => 'bsd', 1, + 'Artistic license' => 'artistic', 1, + 'GPL' => 'gpl', 1, + 'LGPL' => 'lgpl', 1, + 'BSD' => 'bsd', 1, + 'Artistic' => 'artistic', 1, + 'MIT' => 'mit', 1, + 'proprietary' => 'proprietary', 0, + ); + while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { + $pattern =~ s{\s+}{\\s+}g; + if ( $license_text =~ /\b$pattern\b/i ) { + $self->license($license); + return 1; + } + } + } + + warn "Cannot determine license info from $_[0]\n"; + return 'unknown'; +} + +sub _extract_bugtracker { + my @links = $_[0] =~ m#L<(\Qhttp://rt.cpan.org/\E[^>]+)>#g; + my %links; + @links{@links}=(); + @links=keys %links; + return @links; +} + +sub bugtracker_from { + my $self = shift; + my $content = Module::Install::_read($_[0]); + my @links = _extract_bugtracker($content); + unless ( @links ) { + warn "Cannot determine bugtracker info from $_[0]\n"; + return 0; + } + if ( @links > 1 ) { + warn "Found more than on rt.cpan.org link in $_[0]\n"; + return 0; + } + + # Set the bugtracker + bugtracker( $links[0] ); + return 1; +} + +sub requires_from { + my $self = shift; + my $content = Module::Install::_readperl($_[0]); + my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; + while ( @requires ) { + my $module = shift @requires; + my $version = shift @requires; + $self->requires( $module => $version ); + } +} + +sub test_requires_from { + my $self = shift; + my $content = Module::Install::_readperl($_[0]); + my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; + while ( @requires ) { + my $module = shift @requires; + my $version = shift @requires; + $self->test_requires( $module => $version ); + } +} + +# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to +# numbers (eg, 5.006001 or 5.008009). +# Also, convert double-part versions (eg, 5.8) +sub _perl_version { + my $v = $_[-1]; + $v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e; + $v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e; + $v =~ s/(\.\d\d\d)000$/$1/; + $v =~ s/_.+$//; + if ( ref($v) ) { + # Numify + $v = $v + 0; + } + return $v; +} + + + + + +###################################################################### +# MYMETA Support + +sub WriteMyMeta { + die "WriteMyMeta has been deprecated"; +} + +sub write_mymeta_yaml { + my $self = shift; + + # We need YAML::Tiny to write the MYMETA.yml file + unless ( eval { require YAML::Tiny; 1; } ) { + return 1; + } + + # Generate the data + my $meta = $self->_write_mymeta_data or return 1; + + # Save as the MYMETA.yml file + print "Writing MYMETA.yml\n"; + YAML::Tiny::DumpFile('MYMETA.yml', $meta); +} + +sub write_mymeta_json { + my $self = shift; + + # We need JSON to write the MYMETA.json file + unless ( eval { require JSON; 1; } ) { + return 1; + } + + # Generate the data + my $meta = $self->_write_mymeta_data or return 1; + + # Save as the MYMETA.yml file + print "Writing MYMETA.json\n"; + Module::Install::_write( + 'MYMETA.json', + JSON->new->pretty(1)->canonical->encode($meta), + ); +} + +sub _write_mymeta_data { + my $self = shift; + + # If there's no existing META.yml there is nothing we can do + return undef unless -f 'META.yml'; + + # We need Parse::CPAN::Meta to load the file + unless ( eval { require Parse::CPAN::Meta; 1; } ) { + return undef; + } + + # Merge the perl version into the dependencies + my $val = $self->Meta->{values}; + my $perl = delete $val->{perl_version}; + if ( $perl ) { + $val->{requires} ||= []; + my $requires = $val->{requires}; + + # Canonize to three-dot version after Perl 5.6 + if ( $perl >= 5.006 ) { + $perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e + } + unshift @$requires, [ perl => $perl ]; + } + + # Load the advisory META.yml file + my @yaml = Parse::CPAN::Meta::LoadFile('META.yml'); + my $meta = $yaml[0]; + + # Overwrite the non-configure dependency hashs + delete $meta->{requires}; + delete $meta->{build_requires}; + delete $meta->{recommends}; + if ( exists $val->{requires} ) { + $meta->{requires} = { map { @$_ } @{ $val->{requires} } }; + } + if ( exists $val->{build_requires} ) { + $meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } }; + } + + return $meta; +} + +1; diff --git a/inc/Module/Install/Scripts.pm b/inc/Module/Install/Scripts.pm new file mode 100644 index 0000000..a1001f5 --- /dev/null +++ b/inc/Module/Install/Scripts.pm @@ -0,0 +1,29 @@ +#line 1 +package Module::Install::Scripts; + +use strict 'vars'; +use Module::Install::Base (); + +use vars qw{$VERSION @ISA $ISCORE}; +BEGIN { + $VERSION = '0.91'; + @ISA = 'Module::Install::Base'; + $ISCORE = 1; +} + +sub install_script { + my $self = shift; + my $args = $self->makemaker_args; + my $exe = $args->{EXE_FILES} ||= []; + foreach ( @_ ) { + if ( -f $_ ) { + push @$exe, $_; + } elsif ( -d 'script' and -f "script/$_" ) { + push @$exe, "script/$_"; + } else { + die("Cannot find script '$_'"); + } + } +} + +1; diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm new file mode 100644 index 0000000..f2f99df --- /dev/null +++ b/inc/Module/Install/Win32.pm @@ -0,0 +1,64 @@ +#line 1 +package Module::Install::Win32; + +use strict; +use Module::Install::Base (); + +use vars qw{$VERSION @ISA $ISCORE}; +BEGIN { + $VERSION = '0.91'; + @ISA = 'Module::Install::Base'; + $ISCORE = 1; +} + +# determine if the user needs nmake, and download it if needed +sub check_nmake { + my $self = shift; + $self->load('can_run'); + $self->load('get_file'); + + require Config; + return unless ( + $^O eq 'MSWin32' and + $Config::Config{make} and + $Config::Config{make} =~ /^nmake\b/i and + ! $self->can_run('nmake') + ); + + print "The required 'nmake' executable not found, fetching it...\n"; + + require File::Basename; + my $rv = $self->get_file( + url => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe', + ftp_url => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe', + local_dir => File::Basename::dirname($^X), + size => 51928, + run => 'Nmake15.exe /o > nul', + check_for => 'Nmake.exe', + remove => 1, + ); + + die <<'END_MESSAGE' unless $rv; + +------------------------------------------------------------------------------- + +Since you are using Microsoft Windows, you will need the 'nmake' utility +before installation. It's available at: + + http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe + or + ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe + +Please download the file manually, save it to a directory in %PATH% (e.g. +C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to +that directory, and run "Nmake15.exe" from there; that will create the +'nmake.exe' file needed by this module. + +You may then resume the installation process described in README. + +------------------------------------------------------------------------------- +END_MESSAGE + +} + +1; diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm new file mode 100644 index 0000000..12471e5 --- /dev/null +++ b/inc/Module/Install/WriteAll.pm @@ -0,0 +1,60 @@ +#line 1 +package Module::Install::WriteAll; + +use strict; +use Module::Install::Base (); + +use vars qw{$VERSION @ISA $ISCORE}; +BEGIN { + $VERSION = '0.91';; + @ISA = qw{Module::Install::Base}; + $ISCORE = 1; +} + +sub WriteAll { + my $self = shift; + my %args = ( + meta => 1, + sign => 0, + inline => 0, + check_nmake => 1, + @_, + ); + + $self->sign(1) if $args{sign}; + $self->admin->WriteAll(%args) if $self->is_admin; + + $self->check_nmake if $args{check_nmake}; + unless ( $self->makemaker_args->{PL_FILES} ) { + $self->makemaker_args( PL_FILES => {} ); + } + + # Until ExtUtils::MakeMaker support MYMETA.yml, make sure + # we clean it up properly ourself. + $self->realclean_files('MYMETA.yml'); + + if ( $args{inline} ) { + $self->Inline->write; + } else { + $self->Makefile->write; + } + + # The Makefile write process adds a couple of dependencies, + # so write the META.yml files after the Makefile. + if ( $args{meta} ) { + $self->Meta->write; + } + + # Experimental support for MYMETA + if ( $ENV{X_MYMETA} ) { + if ( $ENV{X_MYMETA} eq 'JSON' ) { + $self->Meta->write_mymeta_json; + } else { + $self->Meta->write_mymeta_yaml; + } + } + + return 1; +} + +1; diff --git a/lib/Text/Markdown.pm b/lib/Text/Markdown.pm new file mode 100644 index 0000000..1c1f93e --- /dev/null +++ b/lib/Text/Markdown.pm @@ -0,0 +1,1739 @@ +package Text::Markdown; +require 5.008_000; +use strict; +use warnings; +use re 'eval'; + +use Digest::MD5 qw(md5_hex); +use Encode qw(); +use Carp qw(croak); +use base 'Exporter'; + +our $VERSION = '1.000031'; # 1.0.31 +$VERSION = eval $VERSION; +our @EXPORT_OK = qw(markdown); + +=head1 NAME + +Text::Markdown - Convert Markdown syntax to (X)HTML + +=head1 SYNOPSIS + + use Text::Markdown 'markdown'; + my $html = markdown($text); + + use Text::Markdown 'markdown'; + my $html = markdown( $text, { + empty_element_suffix => '>', + tab_width => 2, + } ); + + use Text::Markdown; + my $m = Text::Markdown->new; + my $html = $m->markdown($text); + + use Text::Markdown; + my $m = Text::MultiMarkdown->new( + empty_element_suffix => '>', + tab_width => 2, + ); + my $html = $m->markdown( $text ); + +=head1 DESCRIPTION + +Markdown is a text-to-HTML filter; it translates an easy-to-read / +easy-to-write structured text format into HTML. Markdown's text format +is most similar to that of plain text email, and supports features such +as headers, *emphasis*, code blocks, blockquotes, and links. + +Markdown's syntax is designed not as a generic markup language, but +specifically to serve as a front-end to (X)HTML. You can use span-level +HTML tags anywhere in a Markdown document, and you can use block level +HTML tags (like <div> and <table> as well). + +=head1 SYNTAX + +This module implements the 'original' Markdown markdown syntax from: + + http://daringfireball.net/projects/markdown/ + +Note that L<Text::Markdown> ensures that the output always ends with +B<one> newline. The fact that multiple newlines are collapsed into one +makes sense, because this is the behavior of HTML towards whispace. The +fact that there's always a newline at the end makes sense again, given +that the output will always be nested in a B<block>-level element (as +opposed to an inline element). That block element can be a C<< <p> >> +(most often), or a C<< <table> >>. + +Markdown is B<not> interpreted in HTML block-level elements, in order for +chunks of pasted HTML (e.g. JavaScript widgets, web counters) to not be +magically (mis)interpreted. For selective processing of Markdown in some, +but not other, HTML block elements, add a C<markdown> attribute to the block +element and set its value to C<1>, C<on> or C<yes>: + + <div markdown="1" class="navbar"> + * Home + * About + * Contact + <div> + +The extra C<markdown> attribute will be stripped when generating the output. + +=head1 OPTIONS + +Text::Markdown supports a number of options to its processor which control +the behaviour of the output document. + +These options can be supplied to the constructor, or in a hash within +individual calls to the L</markdown> method. See the SYNOPSIS for examples +of both styles. + +The options for the processor are: + +=over + +=item empty_element_suffix + +This option controls the end of empty element tags: + + '/>' for XHTML (default) + '>' for HTML + +=item tab_width + +Controls indent width in the generated markup. Defaults to 4. + +=item trust_list_start_value + +If true, ordered lists will use the first number as the starting point for +numbering. This will let you pick up where you left off by writing: + + 1. foo + 2. bar + + some paragraph + + 3. baz + 6. quux + +(Note that in the above, quux will be numbered 4.) + +=back + +=cut + +# Regex to match balanced [brackets]. See Friedl's +# "Mastering Regular Expressions", 2nd Ed., pp. 328-331. +our ($g_nested_brackets, $g_nested_parens); +$g_nested_brackets = qr{ + (?> # Atomic matching + [^\[\]]+ # Anything other than brackets + | + \[ + (??{ $g_nested_brackets }) # Recursive set of nested brackets + \] + )* +}x; +# Doesn't allow for whitespace, because we're using it to match URLs: +$g_nested_parens = qr{ + (?> # Atomic matching + [^()\s]+ # Anything other than parens or whitespace + | + \( + (??{ $g_nested_parens }) # Recursive set of nested brackets + \) + )* +}x; + +# Table of hash values for escaped characters: +our %g_escape_table; +foreach my $char (split //, '\\`*_{}[]()>#+-.!') { + $g_escape_table{$char} = md5_hex($char); +} + +=head1 METHODS + +=head2 new + +A simple constructor, see the SYNTAX and OPTIONS sections for more information. + +=cut + +sub new { + my ($class, %p) = @_; + + $p{base_url} ||= ''; # This is the base URL to be used for WikiLinks + + $p{tab_width} = 4 unless (defined $p{tab_width} and $p{tab_width} =~ m/^\d+$/); + + $p{empty_element_suffix} ||= ' />'; # Change to ">" for HTML output + + $p{trust_list_start_value} = $p{trust_list_start_value} ? 1 : 0; + + my $self = { params => \%p }; + bless $self, ref($class) || $class; + return $self; +} + +=head2 markdown + +The main function as far as the outside world is concerned. See the SYNOPSIS +for details on use. + +=cut + +sub markdown { + my ( $self, $text, $options ) = @_; + + # Detect functional mode, and create an instance for this run + unless (ref $self) { + if ( $self ne __PACKAGE__ ) { + my $ob = __PACKAGE__->new(); + # $self is text, $text is options + return $ob->markdown($self, $text); + } + else { + croak('Calling ' . $self . '->markdown (as a class method) is not supported.'); + } + } + + $options ||= {}; + + %$self = (%{ $self->{params} }, %$options, params => $self->{params}); + + $self->_CleanUpRunData($options); + + return $self->_Markdown($text); +} + +sub _CleanUpRunData { + my ($self, $options) = @_; + # Clear the global hashes. If we don't clear these, you get conflicts + # from other articles when generating a page which contains more than + # one article (e.g. an index page that shows the N most recent + # articles). + $self->{_urls} = $options->{urls} ? $options->{urls} : {}; # FIXME - document passing this option (tested in 05options.t). + $self->{_titles} = {}; + $self->{_html_blocks} = {}; + # Used to track when we're inside an ordered or unordered list + # (see _ProcessListItems() for details) + $self->{_list_level} = 0; + +} + +sub _Markdown { +# +# Main function. The order in which other subs are called here is +# essential. Link and image substitutions need to happen before +# _EscapeSpecialChars(), so that any *'s or _'s in the <a> +# and <img> tags get encoded. +# + my ($self, $text, $options) = @_; + + $text = $self->_CleanUpDoc($text); + + # Turn block-level HTML elements into hash entries, and interpret markdown in them if they have a 'markdown="1"' attribute + $text = $self->_HashHTMLBlocks($text, {interpret_markdown_on_attribute => 1}); + + $text = $self->_StripLinkDefinitions($text); + + $text = $self->_RunBlockGamut($text, {wrap_in_p_tags => 1}); + + $text = $self->_UnescapeSpecialChars($text); + + $text = $self->_ConvertCopyright($text); + + return $text . "\n"; +} + +=head2 urls + +Returns a reference to a hash with the key being the markdown reference +and the value being the URL. + +Useful for building scripts which preprocess a list of links before the +main content. See F<t/05options.t> for an example of this hashref being +passed back into the markdown method to create links. + +=cut + +sub urls { + my ( $self ) = @_; + + return $self->{_urls}; +} + +sub _CleanUpDoc { + my ($self, $text) = @_; + + # Standardize line endings: + $text =~ s{\r\n}{\n}g; # DOS to Unix + $text =~ s{\r}{\n}g; # Mac to Unix + + # Make sure $text ends with a couple of newlines: + $text .= "\n\n"; + + # Convert all tabs to spaces. + $text = $self->_Detab($text); + + # Strip any lines consisting only of spaces and tabs. + # This makes subsequent regexen easier to write, because we can + # match consecutive blank lines with /\n+/ instead of something + # contorted like /[ \t]*\n+/ . + $text =~ s/^[ \t]+$//mg; + + return $text; +} + +sub _StripLinkDefinitions { +# +# Strips link definitions from text, stores the URLs and titles in +# hash references. +# + my ($self, $text) = @_; + my $less_than_tab = $self->{tab_width} - 1; + + # Link defs are in the form: ^[id]: url "optional title" + while ($text =~ s{ + ^[ ]{0,$less_than_tab}\[(.+)\]: # id = \$1 + [ \t]* + \n? # maybe *one* newline + [ \t]* + <?(\S+?)>? # url = \$2 + [ \t]* + \n? # maybe one newline + [ \t]* + (?: + (?<=\s) # lookbehind for whitespace + ["(] + (.+?) # title = \$3 + [")] + [ \t]* + )? # title is optional + (?:\n+|\Z) + }{}omx) { + $self->{_urls}{lc $1} = $self->_EncodeAmpsAndAngles( $2 ); # Link IDs are case-insensitive + if ($3) { + $self->{_titles}{lc $1} = $3; + $self->{_titles}{lc $1} =~ s/"/"/g; + } + + } + + return $text; +} + +sub _md5_utf8 { + # Internal function used to safely MD5sum chunks of the input, which might be Unicode in Perl's internal representation. + my $input = shift; + return unless defined $input; + if (Encode::is_utf8 $input) { + return md5_hex(Encode::encode('utf8', $input)); + } + else { + return md5_hex($input); + } +} + +sub _HashHTMLBlocks { + my ($self, $text, $options) = @_; + my $less_than_tab = $self->{tab_width} - 1; + + # Hashify HTML blocks (protect from further interpretation by encoding to an md5): + # We only want to do this for block-level HTML tags, such as headers, + # lists, and tables. That's because we still want to wrap <p>s around + # "paragraphs" that are wrapped in non-block-level tags, such as anchors, + # phrase emphasis, and spans. The list of tags we're looking for is + # hard-coded: + my $block_tags = qr{ + (?: + p | div | h[1-6] | blockquote | pre | table | + dl | ol | ul | script | noscript | form | + fieldset | iframe | math | ins | del + ) + }x; + + my $tag_attrs = qr{ + (?: # Match one attr name/value pair + \s+ # There needs to be at least some whitespace + # before each attribute name. + [\w.:_-]+ # Attribute name + \s*=\s* + (?: + ".+?" # "Attribute value" + | + '.+?' # 'Attribute value' + | + [^\s]+? # AttributeValue (HTML5) + ) + )* # Zero or more + }x; + + my $empty_tag = qr{< \w+ $tag_attrs \s* />}oxms; + my $open_tag = qr{< $block_tags $tag_attrs \s* >}oxms; + my $close_tag = undef; # let Text::Balanced handle this + my $prefix_pattern = undef; # Text::Balanced + my $markdown_attr = qr{ \s* markdown \s* = \s* (['"]) (.*?) \1 }xs; + + use Text::Balanced qw(gen_extract_tagged); + my $extract_block = gen_extract_tagged($open_tag, $close_tag, $prefix_pattern, { ignore => [$empty_tag] }); + + my @chunks; + # parse each line, looking for block-level HTML tags + while ($text =~ s{^(([ ]{0,$less_than_tab}<)?.*\n)}{}m) { + my $cur_line = $1; + if (defined $2) { + # current line could be start of code block + + my ($tag, $remainder, $prefix, $opening_tag, $text_in_tag, $closing_tag) = $extract_block->($cur_line . $text); + if ($tag) { + if ($options->{interpret_markdown_on_attribute} and $opening_tag =~ s/$markdown_attr//i) { + my $markdown = $2; + if ($markdown =~ /^(1|on|yes)$/) { + # interpret markdown and reconstruct $tag to include the interpreted $text_in_tag + my $wrap_in_p_tags = $opening_tag =~ /^<(div|iframe)/; + $tag = $prefix . $opening_tag . "\n" + . $self->_RunBlockGamut($text_in_tag, {wrap_in_p_tags => $wrap_in_p_tags}) + . "\n" . $closing_tag + ; + } else { + # just remove the markdown="0" attribute + $tag = $prefix . $opening_tag . $text_in_tag . $closing_tag; + } + } + my $key = _md5_utf8($tag); + $self->{_html_blocks}{$key} = $tag; + push @chunks, "\n\n" . $key . "\n\n"; + $text = $remainder; + } + else { + # No tag match, so toss $cur_line into @chunks + push @chunks, $cur_line; + } + } + else { + # current line could NOT be start of code block + push @chunks, $cur_line; + } + + } + push @chunks, $text; # whatever is left + + $text = join '', @chunks; + + return $text; +} + +sub _HashHR { + my ($self, $text) = @_; + my $less_than_tab = $self->{tab_width} - 1; + + $text =~ s{ + (?: + (?<=\n\n) # Starting after a blank line + | # or + \A\n? # the beginning of the doc + ) + ( # save in $1 + [ ]{0,$less_than_tab} + <(hr) # start tag = $2 + \b # word break + ([^<>])*? # + /?> # the matching end tag + [ \t]* + (?=\n{2,}|\Z) # followed by a blank line or end of document + ) + }{ + my $key = _md5_utf8($1); + $self->{_html_blocks}{$key} = $1; + "\n\n" . $key . "\n\n"; + }egx; + + return $text; +} + +sub _HashHTMLComments { + my ($self, $text) = @_; + my $less_than_tab = $self->{tab_width} - 1; + + # Special case for standalone HTML comments: + $text =~ s{ + (?: + (?<=\n\n) # Starting after a blank line + | # or + \A\n? # the beginning of the doc + ) + ( # save in $1 + [ ]{0,$less_than_tab} + (?s: + <! + (--.*?--\s*)+ + > + ) + [ \t]* + (?=\n{2,}|\Z) # followed by a blank line or end of document + ) + }{ + my $key = _md5_utf8($1); + $self->{_html_blocks}{$key} = $1; + "\n\n" . $key . "\n\n"; + }egx; + + return $text; +} + +sub _HashPHPASPBlocks { + my ($self, $text) = @_; + my $less_than_tab = $self->{tab_width} - 1; + + # PHP and ASP-style processor instructions (<?…?> and <%…%>) + $text =~ s{ + (?: + (?<=\n\n) # Starting after a blank line + | # or + \A\n? # the beginning of the doc + ) + ( # save in $1 + [ ]{0,$less_than_tab} + (?s: + <([?%]) # $2 + .*? + \2> + ) + [ \t]* + (?=\n{2,}|\Z) # followed by a blank line or end of document + ) + }{ + my $key = _md5_utf8($1); + $self->{_html_blocks}{$key} = $1; + "\n\n" . $key . "\n\n"; + }egx; + return $text; +} + +sub _RunBlockGamut { +# +# These are all the transformations that form block-level +# tags like paragraphs, headers, and list items. +# + my ($self, $text, $options) = @_; + + # Do headers first, as these populate cross-refs + $text = $self->_DoHeaders($text); + + # Do Horizontal Rules: + my $less_than_tab = $self->{tab_width} - 1; + $text =~ s{^[ ]{0,$less_than_tab}(\*[ ]?){3,}[ \t]*$}{\n<hr$self->{empty_element_suffix}\n}gmx; + $text =~ s{^[ ]{0,$less_than_tab}(-[ ]?){3,}[ \t]*$}{\n<hr$self->{empty_element_suffix}\n}gmx; + $text =~ s{^[ ]{0,$less_than_tab}(_[ ]?){3,}[ \t]*$}{\n<hr$self->{empty_element_suffix}\n}gmx; + + $text = $self->_DoLists($text); + + $text = $self->_DoCodeBlocks($text); + + $text = $self->_DoBlockQuotes($text); + + # We already ran _HashHTMLBlocks() before, in Markdown(), but that + # was to escape raw HTML in the original Markdown source. This time, + # we're escaping the markup we've just created, so that we don't wrap + # <p> tags around block-level tags. + $text = $self->_HashHTMLBlocks($text); + + # Special case just for <hr />. It was easier to make a special case than + # to make the other regex more complicated. + $text = $self->_HashHR($text); + + $text = $self->_HashHTMLComments($text); + + $text = $self->_HashPHPASPBlocks($text); + + $text = $self->_FormParagraphs($text, {wrap_in_p_tags => $options->{wrap_in_p_tags}}); + + return $text; +} + +sub _RunSpanGamut { +# +# These are all the transformations that occur *within* block-level +# tags like paragraphs, headers, and list items. +# + my ($self, $text) = @_; + + $text = $self->_DoCodeSpans($text); + $text = $self->_EscapeSpecialCharsWithinTagAttributes($text); + $text = $self->_EscapeSpecialChars($text); + + # Process anchor and image tags. Images must come first, + # because ![foo][f] looks like an anchor. + $text = $self->_DoImages($text); + $text = $self->_DoAnchors($text); + + # Make links out of things like `<http://example.com/>` + # Must come after _DoAnchors(), because you can use < and > + # delimiters in inline links like [this](<url>). + $text = $self->_DoAutoLinks($text); + + $text = $self->_EncodeAmpsAndAngles($text); + + $text = $self->_DoItalicsAndBold($text); + + # FIXME - Is hard coding space here sane, or does this want to be related to tab width? + # Do hard breaks: + $text =~ s/ {2,}\n/ <br$self->{empty_element_suffix}\n/g; + + return $text; +} + +sub _EscapeSpecialChars { + my ($self, $text) = @_; + my $tokens ||= $self->_TokenizeHTML($text); + + $text = ''; # rebuild $text from the tokens +# my $in_pre = 0; # Keep track of when we're inside <pre> or <code> tags. +# my $tags_to_skip = qr!<(/?)(?:pre|code|kbd|script|math)[\s>]!; + + foreach my $cur_token (@$tokens) { + if ($cur_token->[0] eq "tag") { + # Within tags, encode * and _ so they don't conflict + # with their use in Markdown for italics and strong. + # We're replacing each such character with its + # corresponding MD5 checksum value; this is likely + # overkill, but it should prevent us from colliding + # with the escape values by accident. + $cur_token->[1] =~ s! \* !$g_escape_table{'*'}!ogx; + $cur_token->[1] =~ s! _ !$g_escape_table{'_'}!ogx; + $text .= $cur_token->[1]; + } else { + my $t = $cur_token->[1]; + $t = $self->_EncodeBackslashEscapes($t); + $text .= $t; + } + } + return $text; +} + +sub _EscapeSpecialCharsWithinTagAttributes { +# +# Within tags -- meaning between < and > -- encode [\ ` * _] so they +# don't conflict with their use in Markdown for code, italics and strong. +# We're replacing each such character with its corresponding MD5 checksum +# value; this is likely overkill, but it should prevent us from colliding +# with the escape values by accident. +# + my ($self, $text) = @_; + my $tokens ||= $self->_TokenizeHTML($text); + $text = ''; # rebuild $text from the tokens + + foreach my $cur_token (@$tokens) { + if ($cur_token->[0] eq "tag") { + $cur_token->[1] =~ s! \\ !$g_escape_table{'\\'}!gox; + $cur_token->[1] =~ s{ (?<=.)</?code>(?=.) }{$g_escape_table{'`'}}gox; + $cur_token->[1] =~ s! \* !$g_escape_table{'*'}!gox; + $cur_token->[1] =~ s! _ !$g_escape_table{'_'}!gox; + } + $text .= $cur_token->[1]; + } + return $text; +} + +sub _DoAnchors { +# +# Turn Markdown link shortcuts into XHTML <a> tags. +# + my ($self, $text) = @_; + + # + # First, handle reference-style links: [link text] [id] + # + $text =~ s{ + ( # wrap whole match in $1 + \[ + ($g_nested_brackets) # link text = $2 + \] + + [ ]? # one optional space + (?:\n[ ]*)? # one optional newline followed by spaces + + \[ + (.*?) # id = $3 + \] + ) + }{ + my $whole_match = $1; + my $link_text = $2; + my $link_id = lc $3; + + if ($link_id eq "") { + $link_id = lc $link_text; # for shortcut links like [this][]. + } + + $link_id =~ s{[ ]*\n}{ }g; # turn embedded newlines into spaces + + $self->_GenerateAnchor($whole_match, $link_text, $link_id); + }xsge; + + # + # Next, inline-style links: [link text](url "optional title") + # + $text =~ s{ + ( # wrap whole match in $1 + \[ + ($g_nested_brackets) # link text = $2 + \] + \( # literal paren + [ \t]* + ($g_nested_parens) # href = $3 + [ \t]* + ( # $4 + (['"]) # quote char = $5 + (.*?) # Title = $6 + \5 # matching quote + [ \t]* # ignore any spaces/tabs between closing quote and ) + )? # title is optional + \) + ) + }{ + my $result; + my $whole_match = $1; + my $link_text = $2; + my $url = $3; + my $title = $6; + + $self->_GenerateAnchor($whole_match, $link_text, undef, $url, $title); + }xsge; + + # + # Last, handle reference-style shortcuts: [link text] + # These must come last in case you've also got [link test][1] + # or [link test](/foo) + # + $text =~ s{ + ( # wrap whole match in $1 + \[ + ([^\[\]]+) # link text = $2; can't contain '[' or ']' + \] + ) + }{ + my $result; + my $whole_match = $1; + my $link_text = $2; + (my $link_id = lc $2) =~ s{[ ]*\n}{ }g; # lower-case and turn embedded newlines into spaces + + $self->_GenerateAnchor($whole_match, $link_text, $link_id); + }xsge; + + return $text; +} + +sub _GenerateAnchor { + # FIXME - Fugly, change to named params? + my ($self, $whole_match, $link_text, $link_id, $url, $title, $attributes) = @_; + + my $result; + + $attributes = '' unless defined $attributes; + + if ( !defined $url && defined $self->{_urls}{$link_id}) { + $url = $self->{_urls}{$link_id}; + } + + if (!defined $url) { + return $whole_match; + } + + $url =~ s! \* !$g_escape_table{'*'}!gox; # We've got to encode these to avoid + $url =~ s! _ !$g_escape_table{'_'}!gox; # conflicting with italics/bold. + $url =~ s{^<(.*)>$}{$1}; # Remove <>'s surrounding URL, if present + + $result = qq{<a href="$url"}; + + if ( !defined $title && defined $link_id && defined $self->{_titles}{$link_id} ) { + $title = $self->{_titles}{$link_id}; + } + + if ( defined $title ) { + $title =~ s/"/"/g; + $title =~ s! \* !$g_escape_table{'*'}!gox; + $title =~ s! _ !$g_escape_table{'_'}!gox; + $result .= qq{ title="$title"}; + } + + $result .= "$attributes>$link_text</a>"; + + return $result; +} + +sub _DoImages { +# +# Turn Markdown image shortcuts into <img> tags. +# + my ($self, $text) = @_; + + # + # First, handle reference-style labeled images: ![alt text][id] + # + $text =~ s{ + ( # wrap whole match in $1 + !\[ + (.*?) # alt text = $2 + \] + + [ ]? # one optional space + (?:\n[ ]*)? # one optional newline followed by spaces + + \[ + (.*?) # id = $3 + \] + + ) + }{ + my $result; + my $whole_match = $1; + my $alt_text = $2; + my $link_id = lc $3; + + if ($link_id eq '') { + $link_id = lc $alt_text; # for shortcut links like ![this][]. + } + + $self->_GenerateImage($whole_match, $alt_text, $link_id); + }xsge; + + # + # Next, handle inline images:  + # Don't forget: encode * and _ + + $text =~ s{ + ( # wrap whole match in $1 + !\[ + (.*?) # alt text = $2 + \] + \( # literal paren + [ \t]* + ($g_nested_parens) # src url - href = $3 + [ \t]* + ( # $4 + (['"]) # quote char = $5 + (.*?) # title = $6 + \5 # matching quote + [ \t]* + )? # title is optional + \) + ) + }{ + my $result; + my $whole_match = $1; + my $alt_text = $2; + my $url = $3; + my $title = ''; + if (defined($6)) { + $title = $6; + } + + $self->_GenerateImage($whole_match, $alt_text, undef, $url, $title); + }xsge; + + return $text; +} + +sub _GenerateImage { + # FIXME - Fugly, change to named params? + my ($self, $whole_match, $alt_text, $link_id, $url, $title, $attributes) = @_; + + my $result; + + $attributes = '' unless defined $attributes; + + $alt_text ||= ''; + $alt_text =~ s/"/"/g; + # FIXME - how about > + + if ( !defined $url && defined $self->{_urls}{$link_id}) { + $url = $self->{_urls}{$link_id}; + } + + # If there's no such link ID, leave intact: + return $whole_match unless defined $url; + + $url =~ s! \* !$g_escape_table{'*'}!ogx; # We've got to encode these to avoid + $url =~ s! _ !$g_escape_table{'_'}!ogx; # conflicting with italics/bold. + $url =~ s{^<(.*)>$}{$1}; # Remove <>'s surrounding URL, if present + + if (!defined $title && length $link_id && defined $self->{_titles}{$link_id} && length $self->{_titles}{$link_id}) { + $title = $self->{_titles}{$link_id}; + } + + $result = qq{<img src="$url" alt="$alt_text"}; + if (defined $title && length $title) { + $title =~ s! \* !$g_escape_table{'*'}!ogx; + $title =~ s! _ !$g_escape_table{'_'}!ogx; + $title =~ s/"/"/g; + $result .= qq{ title="$title"}; + } + $result .= $attributes . $self->{empty_element_suffix}; + + return $result; +} + +sub _DoHeaders { + my ($self, $text) = @_; + + # Setext-style headers: + # Header 1 + # ======== + # + # Header 2 + # -------- + # + $text =~ s{ ^(.+)[ \t]*\n=+[ \t]*\n+ }{ + $self->_GenerateHeader('1', $1); + }egmx; + + $text =~ s{ ^(.+)[ \t]*\n-+[ \t]*\n+ }{ + $self->_GenerateHeader('2', $1); + }egmx; + + + # atx-style headers: + # # Header 1 + # ## Header 2 + # ## Header 2 with closing hashes ## + # ... + # ###### Header 6 + # + my $l; + $text =~ s{ + ^(\#{1,6}) # $1 = string of #'s + [ \t]* + (.+?) # $2 = Header text + [ \t]* + \#* # optional closing #'s (not counted) + \n+ + }{ + my $h_level = length($1); + $self->_GenerateHeader($h_level, $2); + }egmx; + + return $text; +} + +sub _GenerateHeader { + my ($self, $level, $id) = @_; + + return "<h$level>" . $self->_RunSpanGamut($id) . "</h$level>\n\n"; +} + +sub _DoLists { +# +# Form HTML ordered (numbered) and unordered (bulleted) lists. +# + my ($self, $text) = @_; + my $less_than_tab = $self->{tab_width} - 1; + + # Re-usable patterns to match list item bullets and number markers: + my $marker_ul = qr/[*+-]/; + my $marker_ol = qr/\d+[.]/; + my $marker_any = qr/(?:$marker_ul|$marker_ol)/; + + # Re-usable pattern to match any entirel ul or ol list: + my $whole_list = qr{ + ( # $1 = whole list + ( # $2 + [ ]{0,$less_than_tab} + (${marker_any}) # $3 = first list item marker + [ \t]+ + ) + (?s:.+?) + ( # $4 + \z + | + \n{2,} + (?=\S) + (?! # Negative lookahead for another list item marker + [ \t]* + ${marker_any}[ \t]+ + ) + ) + ) + }mx; + + # We use a different prefix before nested lists than top-level lists. + # See extended comment in _ProcessListItems(). + # + # Note: There's a bit of duplication here. My original implementation + # created a scalar regex pattern as the conditional result of the test on + # $self->{_list_level}, and then only ran the $text =~ s{...}{...}egmx + # substitution once, using the scalar as the pattern. This worked, + # everywhere except when running under MT on my hosting account at Pair + # Networks. There, this caused all rebuilds to be killed by the reaper (or + # perhaps they crashed, but that seems incredibly unlikely given that the + # same script on the same server ran fine *except* under MT. I've spent + # more time trying to figure out why this is happening than I'd like to + # admit. My only guess, backed up by the fact that this workaround works, + # is that Perl optimizes the substition when it can figure out that the + # pattern will never change, and when this optimization isn't on, we run + # afoul of the reaper. Thus, the slightly redundant code to that uses two + # static s/// patterns rather than one conditional pattern. + + if ($self->{_list_level}) { + $text =~ s{ + ^ + $whole_list + }{ + my $list = $1; + my $marker = $3; + my $list_type = ($marker =~ m/$marker_ul/) ? "ul" : "ol"; + # Turn double returns into triple returns, so that we can make a + # paragraph for the last item in a list, if necessary: + $list =~ s/\n{2,}/\n\n\n/g; + my $result = ( $list_type eq 'ul' ) ? + $self->_ProcessListItemsUL($list, $marker_ul) + : $self->_ProcessListItemsOL($list, $marker_ol); + + $result = $self->_MakeList($list_type, $result, $marker); + $result; + }egmx; + } + else { + $text =~ s{ + (?:(?<=\n\n)|\A\n?) + $whole_list + }{ + my $list = $1; + my $marker = $3; + my $list_type = ($marker =~ m/$marker_ul/) ? "ul" : "ol"; + # Turn double returns into triple returns, so that we can make a + # paragraph for the last item in a list, if necessary: + $list =~ s/\n{2,}/\n\n\n/g; + my $result = ( $list_type eq 'ul' ) ? + $self->_ProcessListItemsUL($list, $marker_ul) + : $self->_ProcessListItemsOL($list, $marker_ol); + $result = $self->_MakeList($list_type, $result, $marker); + $result; + }egmx; + } + + + return $text; +} + +sub _MakeList { + my ($self, $list_type, $content, $marker) = @_; + + if ($list_type eq 'ol' and $self->{trust_list_start_value}) { + my ($num) = $marker =~ /^(\d+)[.]/; + return "<ol start='$num'>\n" . $content . "</ol>\n"; + } + + return "<$list_type>\n" . $content . "</$list_type>\n"; +} + +sub _ProcessListItemsOL { +# +# Process the contents of a single ordered list, splitting it +# into individual list items. +# + + my ($self, $list_str, $marker_any) = @_; + + + # The $self->{_list_level} global keeps track of when we're inside a list. + # Each time we enter a list, we increment it; when we leave a list, + # we decrement. If it's zero, we're not in a list anymore. + # + # We do this because when we're not inside a list, we want to treat + # something like this: + # + # I recommend upgrading to version + # 8. Oops, now this line is treated + # as a sub-list. + # + # As a single paragraph, despite the fact that the second line starts + # with a digit-period-space sequence. + # + # Whereas when we're inside a list (or sub-list), that line will be + # treated as the start of a sub-list. What a kludge, huh? This is + # an aspect of Markdown's syntax that's hard to parse perfectly + # without resorting to mind-reading. Perhaps the solution is to + # change the syntax rules such that sub-lists must start with a + # starting cardinal number; e.g. "1." or "a.". + + $self->{_list_level}++; + + # trim trailing blank lines: + $list_str =~ s/\n{2,}\z/\n/; + + + $list_str =~ s{ + (\n)? # leading line = $1 + (^[ \t]*) # leading whitespace = $2 + ($marker_any) [ \t]+ # list marker = $3 + ((?s:.+?) # list item text = $4 + (\n{1,2})) + (?= \n* (\z | \2 ($marker_any) [ \t]+)) + }{ + my $item = $4; + my $leading_line = $1; + my $leading_space = $2; + + if ($leading_line or ($item =~ m/\n{2,}/)) { + $item = $self->_RunBlockGamut($self->_Outdent($item), {wrap_in_p_tags => 1}); + } + else { + # Recursion for sub-lists: + $item = $self->_DoLists($self->_Outdent($item)); + chomp $item; + $item = $self->_RunSpanGamut($item); + } + + "<li>" . $item . "</li>\n"; + }egmxo; + + $self->{_list_level}--; + return $list_str; +} + +sub _ProcessListItemsUL { +# +# Process the contents of a single unordered list, splitting it +# into individual list items. +# + + my ($self, $list_str, $marker_any) = @_; + + + # The $self->{_list_level} global keeps track of when we're inside a list. + # Each time we enter a list, we increment it; when we leave a list, + # we decrement. If it's zero, we're not in a list anymore. + # + # We do this because when we're not inside a list, we want to treat + # something like this: + # + # I recommend upgrading to version + # 8. Oops, now this line is treated + # as a sub-list. + # + # As a single paragraph, despite the fact that the second line starts + # with a digit-period-space sequence. + # + # Whereas when we're inside a list (or sub-list), that line will be + # treated as the start of a sub-list. What a kludge, huh? This is + # an aspect of Markdown's syntax that's hard to parse perfectly + # without resorting to mind-reading. Perhaps the solution is to + # change the syntax rules such that sub-lists must start with a + # starting cardinal number; e.g. "1." or "a.". + + $self->{_list_level}++; + + # trim trailing blank lines: + $list_str =~ s/\n{2,}\z/\n/; + + + $list_str =~ s{ + (\n)? # leading line = $1 + (^[ \t]*) # leading whitespace = $2 + ($marker_any) [ \t]+ # list marker = $3 + ((?s:.+?) # list item text = $4 + (\n{1,2})) + (?= \n* (\z | \2 ($marker_any) [ \t]+)) + }{ + my $item = $4; + my $leading_line = $1; + my $leading_space = $2; + + if ($leading_line or ($item =~ m/\n{2,}/)) { + $item = $self->_RunBlockGamut($self->_Outdent($item), {wrap_in_p_tags => 1}); + } + else { + # Recursion for sub-lists: + $item = $self->_DoLists($self->_Outdent($item)); + chomp $item; + $item = $self->_RunSpanGamut($item); + } + + "<li>" . $item . "</li>\n"; + }egmxo; + + $self->{_list_level}--; + return $list_str; +} + +sub _DoCodeBlocks { +# +# Process Markdown code blocks (indented with 4 spaces or 1 tab): +# * outdent the spaces/tab +# * encode <, >, & into HTML entities +# * escape Markdown special characters into MD5 hashes +# * trim leading and trailing newlines +# + + my ($self, $text) = @_; + + $text =~ s{ + (?:\n\n|\A) + ( # $1 = the code block -- one or more lines, starting with a space/tab + (?: + (?:[ ]{$self->{tab_width}} | \t) # Lines must start with a tab or a tab-width of spaces + .*\n+ + )+ + ) + ((?=^[ ]{0,$self->{tab_width}}\S)|\Z) # Lookahead for non-space at line-start, or end of doc + }{ + my $codeblock = $1; + my $result; # return value + + $codeblock = $self->_EncodeCode($self->_Outdent($codeblock)); + $codeblock = $self->_Detab($codeblock); + $codeblock =~ s/\A\n+//; # trim leading newlines + $codeblock =~ s/\n+\z//; # trim trailing newlines + + $result = "\n\n<pre><code>" . $codeblock . "\n</code></pre>\n\n"; + + $result; + }egmx; + + return $text; +} + +sub _DoCodeSpans { +# +# * Backtick quotes are used for <code></code> spans. +# +# * You can use multiple backticks as the delimiters if you want to +# include literal backticks in the code span. So, this input: +# +# Just type ``foo `bar` baz`` at the prompt. +# +# Will translate to: +# +# <p>Just type <code>foo `bar` baz</code> at the prompt.</p> +# +# There's no arbitrary limit to the number of backticks you +# can use as delimters. If you need three consecutive backticks +# in your code, use four for delimiters, etc. +# +# * You can use spaces to get literal backticks at the edges: +# +# ... type `` `bar` `` ... +# +# Turns to: +# +# ... type <code>`bar`</code> ... +# + + my ($self, $text) = @_; + + $text =~ s@ + (?<!\\) # Character before opening ` can't be a backslash + (`+) # $1 = Opening run of ` + (.+?) # $2 = The code block + (?<!`) + \1 # Matching closer + (?!`) + @ + my $c = "$2"; + $c =~ s/^[ \t]*//g; # leading whitespace + $c =~ s/[ \t]*$//g; # trailing whitespace + $c = $self->_EncodeCode($c); + "<code>$c</code>"; + @egsx; + + return $text; +} + +sub _EncodeCode { +# +# Encode/escape certain characters inside Markdown code runs. +# The point is that in code, these characters are literals, +# and lose their special Markdown meanings. +# + my $self = shift; + local $_ = shift; + + # Encode all ampersands; HTML entities are not + # entities within a Markdown code span. + s/&/&/g; + + # Encode $'s, but only if we're running under Blosxom. + # (Blosxom interpolates Perl variables in article bodies.) + { + no warnings 'once'; + if (defined($blosxom::version)) { + s/\$/$/g; + } + } + + + # Do the angle bracket song and dance: + s! < !<!gx; + s! > !>!gx; + + # Now, escape characters that are magic in Markdown: + s! \* !$g_escape_table{'*'}!ogx; + s! _ !$g_escape_table{'_'}!ogx; + s! { !$g_escape_table{'{'}!ogx; + s! } !$g_escape_table{'}'}!ogx; + s! \[ !$g_escape_table{'['}!ogx; + s! \] !$g_escape_table{']'}!ogx; + s! \\ !$g_escape_table{'\\'}!ogx; + + return $_; +} + +sub _DoItalicsAndBold { + my ($self, $text) = @_; + + # Handle at beginning of lines: + $text =~ s{ ^(\*\*|__) (?=\S) (.+?[*_]*) (?<=\S) \1 } + {<strong>$2</strong>}gsx; + + $text =~ s{ ^(\*|_) (?=\S) (.+?) (?<=\S) \1 } + {<em>$2</em>}gsx; + + # <strong> must go first: + $text =~ s{ (?<=\W) (\*\*|__) (?=\S) (.+?[*_]*) (?<=\S) \1 } + {<strong>$2</strong>}gsx; + + $text =~ s{ (?<=\W) (\*|_) (?=\S) (.+?) (?<=\S) \1 } + {<em>$2</em>}gsx; + + # And now, a second pass to catch nested strong and emphasis special cases + $text =~ s{ (?<=\W) (\*\*|__) (?=\S) (.+?[*_]*) (?<=\S) \1 } + {<strong>$2</strong>}gsx; + + $text =~ s{ (?<=\W) (\*|_) (?=\S) (.+?) (?<=\S) \1 } + {<em>$2</em>}gsx; + + return $text; +} + +sub _DoBlockQuotes { + my ($self, $text) = @_; + + $text =~ s{ + ( # Wrap whole match in $1 + ( + ^[ \t]*>[ \t]? # '>' at the start of a line + .+\n # rest of the first line + (.+\n)* # subsequent consecutive lines + \n* # blanks + )+ + ) + }{ + my $bq = $1; + $bq =~ s/^[ \t]*>[ \t]?//gm; # trim one level of quoting + $bq =~ s/^[ \t]+$//mg; # trim whitespace-only lines + $bq = $self->_RunBlockGamut($bq, {wrap_in_p_tags => 1}); # recurse + + $bq =~ s/^/ /mg; + # These leading spaces screw with <pre> content, so we need to fix that: + $bq =~ s{ + (\s*<pre>.+?</pre>) + }{ + my $pre = $1; + $pre =~ s/^ //mg; + $pre; + }egsx; + + "<blockquote>\n$bq\n</blockquote>\n\n"; + }egmx; + + + return $text; +} + +sub _FormParagraphs { +# +# Params: +# $text - string to process with html <p> tags +# + my ($self, $text, $options) = @_; + + # Strip leading and trailing lines: + $text =~ s/\A\n+//; + $text =~ s/\n+\z//; + + my @grafs = split(/\n{2,}/, $text); + + # + # Wrap <p> tags. + # + foreach (@grafs) { + unless (defined( $self->{_html_blocks}{$_} )) { + $_ = $self->_RunSpanGamut($_); + if ($options->{wrap_in_p_tags}) { + s/^([ \t]*)/<p>/; + $_ .= "</p>"; + } + } + } + + # + # Unhashify HTML blocks + # + foreach (@grafs) { + if (defined( $self->{_html_blocks}{$_} )) { + $_ = $self->{_html_blocks}{$_}; + } + } + + return join "\n\n", @grafs; +} + +sub _EncodeAmpsAndAngles { +# Smart processing for ampersands and angle brackets that need to be encoded. + + my ($self, $text) = @_; + return '' if (!defined $text or !length $text); + + # Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: + # http://bumppo.net/projects/amputator/ + $text =~ s/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/&/g; + + # Encode naked <'s + $text =~ s{<(?![a-z/?\$!])}{<}gi; + + # And >'s - added by Fletcher Penney +# $text =~ s{>(?![a-z/?\$!])}{>}gi; +# Causes problems... + + # Remove encoding inside comments + $text =~ s{ + (?<=<!--) # Begin comment + (.*?) # Anything inside + (?=-->) # End comments + }{ + my $t = $1; + $t =~ s/&/&/g; + $t =~ s/</</g; + $t; + }egsx; + + return $text; +} + +sub _EncodeBackslashEscapes { +# +# Parameter: String. +# Returns: The string, with after processing the following backslash +# escape sequences. +# + my $self = shift; + local $_ = shift; + + s! \\\\ !$g_escape_table{'\\'}!ogx; # Must process escaped backslashes first. + s! \\` !$g_escape_table{'`'}!ogx; + s! \\\* !$g_escape_table{'*'}!ogx; + s! \\_ !$g_escape_table{'_'}!ogx; + s! \\\{ !$g_escape_table{'{'}!ogx; + s! \\\} !$g_escape_table{'}'}!ogx; + s! \\\[ !$g_escape_table{'['}!ogx; + s! \\\] !$g_escape_table{']'}!ogx; + s! \\\( !$g_escape_table{'('}!ogx; + s! \\\) !$g_escape_table{')'}!ogx; + s! \\> !$g_escape_table{'>'}!ogx; + s! \\\# !$g_escape_table{'#'}!ogx; + s! \\\+ !$g_escape_table{'+'}!ogx; + s! \\\- !$g_escape_table{'-'}!ogx; + s! \\\. !$g_escape_table{'.'}!ogx; + s{ \\! }{$g_escape_table{'!'}}ogx; + + return $_; +} + +sub _DoAutoLinks { + my ($self, $text) = @_; + + $text =~ s{<((https?|ftp):[^'">\s]+)>}{<a href="$1">$1</a>}gi; + + # Email addresses: <address@domain.foo> + $text =~ s{ + < + (?:mailto:)? + ( + [-.\w\+]+ + \@ + [-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+ + ) + > + }{ + $self->_EncodeEmailAddress( $self->_UnescapeSpecialChars($1) ); + }egix; + + return $text; +} + +sub _EncodeEmailAddress { +# +# Input: an email address, e.g. "foo@example.com" +# +# Output: the email address as a mailto link, with each character +# of the address encoded as either a decimal or hex entity, in +# the hopes of foiling most address harvesting spam bots. E.g.: +# +# <a href="mailto:foo@e +# xample.com">foo +# @example.com</a> +# +# Based on a filter by Matthew Wickline, posted to the BBEdit-Talk +# mailing list: <http://tinyurl.com/yu7ue> +# + + my ($self, $addr) = @_; + + my @encode = ( + sub { '&#' . ord(shift) . ';' }, + sub { '&#x' . sprintf( "%X", ord(shift) ) . ';' }, + sub { shift }, + ); + + $addr = "mailto:" . $addr; + + $addr =~ s{(.)}{ + my $char = $1; + if ( $char eq '@' ) { + # this *must* be encoded. I insist. + $char = $encode[int rand 1]->($char); + } + elsif ( $char ne ':' ) { + # leave ':' alone (to spot mailto: later) + my $r = rand; + # roughly 10% raw, 45% hex, 45% dec + $char = ( + $r > .9 ? $encode[2]->($char) : + $r < .45 ? $encode[1]->($char) : + $encode[0]->($char) + ); + } + $char; + }gex; + + $addr = qq{<a href="$addr">$addr</a>}; + $addr =~ s{">.+?:}{">}; # strip the mailto: from the visible part + + return $addr; +} + +sub _UnescapeSpecialChars { +# +# Swap back in all the special characters we've hidden. +# + my ($self, $text) = @_; + + while( my($char, $hash) = each(%g_escape_table) ) { + $text =~ s/$hash/$char/g; + } + return $text; +} + +sub _TokenizeHTML { +# +# Parameter: String containing HTML markup. +# Returns: Reference to an array of the tokens comprising the input +# string. Each token is either a tag (possibly with nested, +# tags contained therein, such as <a href="<MTFoo>">, or a +# run of text between tags. Each element of the array is a +# two-element array; the first is either 'tag' or 'text'; +# the second is the actual value. +# +# +# Derived from the _tokenize() subroutine from Brad Choate's MTRegex plugin. +# <http://www.bradchoate.com/past/mtregex.php> +# + + my ($self, $str) = @_; + my $pos = 0; + my $len = length $str; + my @tokens; + + my $depth = 6; + my $nested_tags = join('|', ('(?:<[a-z/!$](?:[^<>]') x $depth) . (')*>)' x $depth); + my $match = qr/(?s: <! ( -- .*? -- \s* )+ > ) | # comment + (?s: <\? .*? \?> ) | # processing instruction + $nested_tags/iox; # nested tags + + while ($str =~ m/($match)/og) { + my $whole_tag = $1; + my $sec_start = pos $str; + my $tag_start = $sec_start - length $whole_tag; + if ($pos < $tag_start) { + push @tokens, ['text', substr($str, $pos, $tag_start - $pos)]; + } + push @tokens, ['tag', $whole_tag]; + $pos = pos $str; + } + push @tokens, ['text', substr($str, $pos, $len - $pos)] if $pos < $len; + \@tokens; +} + +sub _Outdent { +# +# Remove one level of line-leading tabs or spaces +# + my ($self, $text) = @_; + + $text =~ s/^(\t|[ ]{1,$self->{tab_width}})//gm; + return $text; +} + +sub _Detab { +# +# Cribbed from a post by Bart Lateur: +# <http://www.nntp.perl.org/group/perl.macperl.anyperl/154> +# + my ($self, $text) = @_; + + # FIXME - Better anchor/regex would be quicker. + + # Original: + #$text =~ s{(.*?)\t}{$1.(' ' x ($self->{tab_width} - length($1) % $self->{tab_width}))}ge; + + # Much swifter, but pretty hateful: + do {} while ($text =~ s{^(.*?)\t}{$1.(' ' x ($self->{tab_width} - length($1) % $self->{tab_width}))}mge); + return $text; +} + +sub _ConvertCopyright { + my ($self, $text) = @_; + # Convert to an XML compatible form of copyright symbol + + $text =~ s/©/©/gi; + + return $text; +} + +1; + +__END__ + +=head1 OTHER IMPLEMENTATIONS + +Markdown has been re-implemented in a number of languages, and with a number of additions. + +Those that I have found are listed below: + +=over + +=item C - <http://www.pell.portland.or.us/~orc/Code/discount> + +Discount - Original Markdown, but in C. Fastest implementation available, and passes MDTest. +Adds its own set of custom features. + +=item python - <http://www.freewisdom.org/projects/python-markdown/> + +Python Markdown which is mostly compatible with the original, with an interesting extension API. + +=item ruby (maruku) - <http://maruku.rubyforge.org/> + +One of the nicest implementations out there. Builds a parse tree internally so very flexible. + +=item php - <http://michelf.com/projects/php-markdown/> + +A direct port of Markdown.pl, also has a separately maintained 'extra' version, +which adds a number of features that were borrowed by MultiMarkdown. + +=item lua - <http://www.frykholm.se/files/markdown.lua> + +Port to lua. Simple and lightweight (as lua is). + +=item haskell - <http://johnmacfarlane.net/pandoc/> + +Pandoc is a more general library, supporting Markdown, reStructuredText, LaTeX and more. + +=item javascript - <http://www.attacklab.net/showdown-gui.html> + +Direct(ish) port of Markdown.pl to JavaScript + +=back + +=head1 BUGS + +To file bug reports or feature requests please send email to: + + bug-Text-Markdown@rt.cpan.org + +Please include with your report: (1) the example input; (2) the output +you expected; (3) the output Markdown actually produced. + +=head1 VERSION HISTORY + +See the Changes file for detailed release notes for this version. + +=head1 AUTHOR + + John Gruber + http://daringfireball.net/ + + PHP port and other contributions by Michel Fortin + http://michelf.com/ + + MultiMarkdown changes by Fletcher Penney + http://fletcher.freeshell.org/ + + CPAN Module Text::MultiMarkdown (based on Text::Markdown by Sebastian + Riedel) originally by Darren Kulp (http://kulp.ch/) + + Support for markdown="1" by Dan Dascalescu (http://dandascalescu.com) + + This module is maintained by: Tomas Doran http://www.bobtfish.net/ + +=head1 THIS DISTRIBUTION + +Please note that this distribution is a fork of John Gruber's original Markdown project, +and it *is not* in any way blessed by him. + +Whilst this code aims to be compatible with the original Markdown.pl (and incorporates +and passes the Markdown test suite) whilst fixing a number of bugs in the original - +there may be differences between the behaviour of this module and Markdown.pl. If you find +any differences where you believe Text::Markdown behaves contrary to the Markdown spec, +please report them as bugs. + +Text::Markdown *does not* extend the markdown dialect in any way from that which is documented at +daringfireball. If you want additional features, you should look at L<Text::MultiMarkdown>. + +=head1 SOURCE CODE + +You can find the source code repository for L<Text::Markdown> and L<Text::MultiMarkdown> +on GitHub at <http://github.com/bobtfish/text-markdown>. + +=head1 COPYRIGHT AND LICENSE + +Original Code Copyright (c) 2003-2004 John Gruber +<http://daringfireball.net/> +All rights reserved. + +MultiMarkdown changes Copyright (c) 2005-2006 Fletcher T. Penney +<http://fletcher.freeshell.org/> +All rights reserved. + +Text::MultiMarkdown changes Copyright (c) 2006-2009 Darren Kulp +<http://kulp.ch> and Tomas Doran <http://www.bobtfish.net> + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name "Markdown" nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +This software is provided by the copyright holders and contributors "as +is" and any express or implied warranties, including, but not limited +to, the implied warranties of merchantability and fitness for a +particular purpose are disclaimed. In no event shall the copyright owner +or contributors be liable for any direct, indirect, incidental, special, +exemplary, or consequential damages (including, but not limited to, +procurement of substitute goods or services; loss of use, data, or +profits; or business interruption) however caused and on any theory of +liability, whether in contract, strict liability, or tort (including +negligence or otherwise) arising in any way out of the use of this +software, even if advised of the possibility of such damage. + +=cut diff --git a/script/Markdown.pl b/script/Markdown.pl new file mode 100644 index 0000000..169b15f --- /dev/null +++ b/script/Markdown.pl @@ -0,0 +1,147 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Text::Markdown qw(markdown); + +=head1 NAME + +Markdown.pl - Convert Markdown syntax to (X)HTML + +=head1 DESCRIPTION + +This program is distributed as part of Perl's Text::Markdown module, +illustrating sample usage. + +Markdown can be invoked on any file containing Markdown-syntax, and +will produce the corresponding (X)HTML on STDOUT: + + $ cat file.txt + This is a *test*. + + Absolutely _nothing_ to see here. _Just a **test**_! + + * test + * Yup, test. + $ Markdown.pl file.txt + <p>This is a <em>test</em>.</p> + + <p>Absolutely <em>nothing</em> to see here. <em>Just a <strong>test</strong></em>!</p> + + <ul> + <li>test</li> + <li>Yup, test.</li> + </ul> + +If no file is specified, it will expect its input from STDIN: + + $ echo "A **simple** test" | markdown + <p>A <strong>simple</strong> test</p> + +=head1 OPTIONS + +=over + +=item version + +Shows the full information for this version + +=item shortversion + +Shows only the version number + +=item html4tags + +Produce HTML 4-style tags instead of XHTML - XHTML requires elements +that do not wrap a block (i.e. the C<hr> tag) to state they will not +be closed, by closing with C</E<gt>>. HTML 4-style will plainly output +the tag as it comes: + + $ echo '---' | markdown + <hr /> + $ echo '---' | markdown --html4tags + <hr> + +=item help + +Shows this documentation + +=back + +=head1 AUTHOR + +Copyright 2004 John Gruber + +Copyright 2008 Tomas Doran + +The manpage was written by Gunnar Wolf <gwolf@debian.org> for its use +in Debian systems, but can be freely used elsewhere. + +For full licensing information, please refer to +L<Text::Markdown.pm>'s full documentation. + +=head1 SEE ALSO + +L<Text::Markdown>, L<http://daringfireball.net/projects/markdown/> + +=cut + +#### Check for command-line switches: ################# +my %cli_opts; +use Getopt::Long; +Getopt::Long::Configure('pass_through'); +GetOptions(\%cli_opts, + 'version', + 'shortversion', + 'html4tags', + 'help', +); +if ($cli_opts{'version'}) { # Version info + print "\nThis is Markdown, version $Text::Markdown::VERSION.\n"; + print "Copyright 2004 John Gruber\n"; + print "Copyright 2008 Tomas Doran\n"; + print "Parts contributed by several other people."; + print "http://daringfireball.net/projects/markdown/\n\n"; + exit 0; +} +if ($cli_opts{'shortversion'}) { # Just the version number string. + print $Text::Markdown::VERSION; + exit 0; +} +if ($cli_opts{'help'}) { + for my $dir (split m/:/, $ENV{PATH}) { + my $cmd = "$dir/perldoc"; + exec($cmd, $0) if (-f $cmd and -x $cmd); + } + die "perldoc could not be found in your path - Cannot show help, sorry\n"; +} +my $m; +if ($cli_opts{'html4tags'}) { # Use HTML tag style instead of XHTML + $m = Text::Markdown->new(empty_element_suffix => '>'); +} +else { + $m = Text::Markdown->new; +} + +sub main { + my (@fns) = @_; + + my $f; + if (scalar @fns) { + foreach my $fn (@fns) { + die("Cannot find file $fn") unless (-r $fn); + + my $fh; + open($fh, '<', $fn) or die; + $f = join('', <$fh>); + close($fh) or die; + } + } + else { # STDIN + local $/; # Slurp the whole file + $f = <>; + } + + return $m->markdown($f); +} + +print main(@ARGV) unless caller(); diff --git a/t/02pod.t b/t/02pod.t new file mode 100644 index 0000000..251640d --- /dev/null +++ b/t/02pod.t @@ -0,0 +1,9 @@ +use strict; +use warnings; +use Test::More; + +eval "use Test::Pod 1.14"; +plan skip_all => 'Test::Pod 1.14 required' if $@; +plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; + +all_pod_files_ok(); diff --git a/t/03podcoverage.t b/t/03podcoverage.t new file mode 100644 index 0000000..ae59d4c --- /dev/null +++ b/t/03podcoverage.t @@ -0,0 +1,9 @@ +use strict; +use warnings; +use Test::More; + +eval "use Test::Pod::Coverage 1.04"; +plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@; +plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; + +all_pod_coverage_ok(); diff --git a/t/04ensure_1_newline_before_EOF.t b/t/04ensure_1_newline_before_EOF.t new file mode 100644 index 0000000..fd58837 --- /dev/null +++ b/t/04ensure_1_newline_before_EOF.t @@ -0,0 +1,17 @@ +use strict; +use warnings; +use Test::More tests => 3; +use Test::Differences; + +use FindBin '$Bin'; +use lib "$Bin/../lib"; + +use_ok 'Text::Markdown'; +my $m = Text::Markdown->new(); +my ($out, $expected); + +$out = $m->markdown("foo\n\n\n"); +eq_or_diff($out, "<p>foo</p>\n", "collapse multiple newlines at EOF into one"); + +$out = $m->markdown("foo"); +eq_or_diff($out, "<p>foo</p>\n", "ensure newline before EOF"); diff --git a/t/05markdown_in_divs.t b/t/05markdown_in_divs.t new file mode 100644 index 0000000..a19f771 --- /dev/null +++ b/t/05markdown_in_divs.t @@ -0,0 +1,411 @@ +use strict; +use warnings; +use Test::More tests => 21; +use Test::Differences; +use FindBin '$Bin'; +use lib "$Bin/../lib"; + +use_ok 'Text::Markdown'; + +my $m = Text::Markdown->new(); +my ($html, $test); + +#------------------------------------------------------------------------------- +$test = "sanity check: markown in block elements doesn't get interpreted"; +$html = $m->markdown(<<"EOF"); +<h2> +Literal *asterisks* +and _underscores_ +</h2> +EOF +eq_or_diff $html, <<'EOF', $test; +<h2> +Literal *asterisks* +and _underscores_ +</h2> +EOF + + +#------------------------------------------------------------------------------- +$test = 'markdown on in div - generate <p> tags'; +$html = $m->markdown(<<"EOF"); +some text here + +<div markdown="1"> +Interpreted *asterisks* +and _underscores_ +</div> +EOF +eq_or_diff $html, <<'EOF', $test; +<p>some text here</p> + +<div> +<p>Interpreted <em>asterisks</em> +and <em>underscores</em></p> +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = 'markdown on in h2 - no <p> tags in h2'; +$html = $m->markdown(<<"EOF"); +some text here + +<h2 markdown="on"> +Interpreted *asterisks* +and _underscores_ +</h2> +EOF +eq_or_diff $html, <<'EOF', $test; +<p>some text here</p> + +<h2> +Interpreted <em>asterisks</em> +and <em>underscores</em> +</h2> +EOF + + +#------------------------------------------------------------------------------- +# "block-level HTML elements — e.g. <div>, <table>, <pre>, <p>, etc. — must be separated +# from surrounding content by blank lines, and the start and end tags of the block +# should not be indented with tabs or spaces." -- http://daringfireball.net/projects/markdown/syntax#html +$test = 'some characters before an <h2> make the h2 an ignored element'; +$html = $m->markdown(<<"EOF"); +stuff<h2> +Interpreted *asterisks* and _underscores_ +because HTML block elements must be separated from surrounding content by blank lines +</h2> +EOF +eq_or_diff $html, <<'EOF', $test; +<p>stuff<h2> +Interpreted <em>asterisks</em> and <em>underscores</em> +because HTML block elements must be separated from surrounding content by blank lines +</h2></p> +EOF + + +#------------------------------------------------------------------------------- +$test = "adding markdown='on' if there were some characters before the h2, doesn't change anything. markdown='on' won't be removed."; +$html = $m->markdown(<<"EOF"); +stuff<h2 markdown="on"> +Interpreted *asterisks* and _underscores_, and markdown="on" left alone +because this wasn't a block HTML element in the first place +</h2> +EOF +eq_or_diff $html, <<'EOF', $test; +<p>stuff<h2 markdown="on"> +Interpreted <em>asterisks</em> and <em>underscores</em>, and markdown="on" left alone +because this wasn't a block HTML element in the first place +</h2></p> +EOF + + +#------------------------------------------------------------------------------- +$test = '<hr> in span-level HTML'; +$html = $m->markdown(<<"EOF"); +<span style="color: red"> +Interpreted *asterisks*. +<hr> +Interpreted _underscores_. +</span> +EOF +eq_or_diff $html, <<'EOF', $test; +<p><span style="color: red"> +Interpreted <em>asterisks</em>. +<hr> +Interpreted <em>underscores</em>. +</span></p> +EOF + + +#------------------------------------------------------------------------------- +$test = '<hr> in block-level HTML with markdown="on"'; +$html = $m->markdown(<<"EOF"); +<div markdown="on"> +Interpreted *asterisks*. +<hr> +Interpreted _underscores_. +</div> +EOF +eq_or_diff $html, <<'EOF', $test; +<div> +<p>Interpreted <em>asterisks</em>. +<hr> +Interpreted <em>underscores</em>.</p> +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = "don't mess with the markdown attribute if part of code span or block"; +$html = $m->markdown(<<"EOF"); +A `<div markdown="1">` will interpret Markdown, unless in a code block. + + <div markdown="1"> + The *above* is a '<div>' tag + in a code block</div> +EOF +eq_or_diff $html, <<'EOF', $test; +<p>A <code><div markdown="1"></code> will interpret Markdown, unless in a code block.</p> + +<pre><code><div markdown="1"> +The *above* is a '<div>' tag +in a code block</div> +</code></pre> +EOF + + +#------------------------------------------------------------------------------- +$test = "leave [div] alone, it's not <div>"; +$html = $m->markdown(<<"EOF"); +[div markdown="1"] +The above is NOT a <div>! +</div> +EOF +eq_or_diff $html, <<'EOF', $test; +<p>[div markdown="1"] +The above is NOT a <div>! +</div></p> +EOF + + +#------------------------------------------------------------------------------- +$test = "leave !div! alone, it's not <div>, and it's in code too"; +$html = $m->markdown(<<"EOF"); + !div markdown="1"! + The above is NOT a <div>! + </div> +EOF +eq_or_diff $html, <<'EOF', $test; +<pre><code>!div markdown="1"! +The above is NOT a <div>! +</div> +</code></pre> +EOF + + +#------------------------------------------------------------------------------- +$test = 'start interpreting Markdown without blank line sandwiching'; +$html = $m->markdown(<<"EOF"); +*outside of the div* +<div markdown="1"> +*start interpreting Markdown without blank line sandwiching* +</div> +EOF +eq_or_diff $html, <<'EOF', $test; +<p><em>outside of the div</em></p> + +<div> +<p><em>start interpreting Markdown without blank line sandwiching</em></p> +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = '<div markdown="1"> with inner list'; +$html = $m->markdown(<<"EOF"); +<div markdown="1"> + +1. this +2. is a list + +</div> +EOF + +eq_or_diff $html, <<'EOF', $test; +<div> +<ol> +<li>this</li> +<li>is a list</li> +</ol> +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = '<div markdown="1"> with inner code block'; +$html = $m->markdown(<<"EOF"); +<div markdown="1"> + + code line 1 + code line 2 + +</div> +EOF + +eq_or_diff $html, <<'EOF', $test; +<div> +<pre><code>code line 1 +code line 2 +</code></pre> +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = '<div markdown="1"> with inner blockquote'; +$html = $m->markdown(<<"EOF"); +<div markdown="1"> +> Thus spoke Lincoln +</div> +EOF + +eq_or_diff $html, <<'EOF', $test; +<div> +<blockquote> + <p>Thus spoke Lincoln</p> +</blockquote> +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = '<div markdown="1"> with inner block HTML'; +$html = $m->markdown(<<"EOF"); +<div markdown="1"> +*interpreted* + +<div><script>var i = _count_ ;</script></div> +</div> +EOF + +eq_or_diff $html, <<'EOF', $test; +<div> +<p><em>interpreted</em></p> + +<div><script>var i = _count_ ;</script></div> +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = '<div markdown="1"> with inner <div>, which ends with exactly one line'; +$html = $m->markdown(<<"EOF"); +<div markdown="1"> +<div><script>var i = _count_ ;</script></div> + + +</div> +EOF + +eq_or_diff $html, <<'EOF', $test; +<div> +<div><script>var i = _count_ ;</script></div> +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = '<div markdown="1"> comprehensive'; +$html = $m->markdown(<<"EOF"); +*marked down text* + +<div markdown="1"> + +* this +* is a list + +</div> + +<div markdown="0"> +*no markdown interpretation here* +</div> + +<div> +*no markdown interpretation here* +</div> + +<div markdown="1" class="navbar"> +1. Home +2. About +</div> + +<div markdown="0" clas="web_counter"> +*no markdown interpretation here* +</div> +EOF + +eq_or_diff $html, <<'EOF', $test; +<p><em>marked down text</em></p> + +<div> +<ul> +<li>this</li> +<li>is a list</li> +</ul> +</div> + +<div> +*no markdown interpretation here* +</div> + +<div> +*no markdown interpretation here* +</div> + +<div class="navbar"> +<ol> +<li>Home</li> +<li>About</li> +</ol> +</div> + +<div clas="web_counter"> +*no markdown interpretation here* +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = '<div markdown="1"> with multiple lines of attributes'; +$html = $m->markdown(<<"EOF"); +<div markdown="1" + class="navbar" +> +*multiple lines of attributes* +</div> +EOF +eq_or_diff $html, <<'EOF', $test; +<div + class="navbar" +> +<p><em>multiple lines of attributes</em></p> +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = '<div \n\n...\n markdown="1"> - can put the markdown="1" attribute anywhere'; +$html = $m->markdown(<<"EOF"); +<div class="navbar" + markdown="1" +> +*multiple lines of attributes* +</div> +EOF +eq_or_diff $html, <<'EOF', $test; +<div class="navbar" +> +<p><em>multiple lines of attributes</em></p> +</div> +EOF + + +#------------------------------------------------------------------------------- +$test = "sanity check: just code"; +$html = $m->markdown(<<"EOF"); +Below is code + + code + +Above was code +EOF +eq_or_diff $html, <<'EOF', $test; +<p>Below is code</p> + +<pre><code>code +</code></pre> + +<p>Above was code</p> +EOF diff --git a/t/19exporter-markdown.t b/t/19exporter-markdown.t new file mode 100644 index 0000000..04c06ba --- /dev/null +++ b/t/19exporter-markdown.t @@ -0,0 +1,45 @@ +use strict; +use warnings; +use Test::More tests => 7; +use Test::Exception; + +use_ok( 'Text::Markdown', 'markdown' ); + +my $instr = q{A trivial block of text}; +my $outstr = q{<p>A trivial block of text</p>}; + +lives_ok { + $outstr = markdown($instr); +} 'Functional markdown works without an exception'; + +chomp($outstr); + +is( + $outstr => '<p>' . $instr . '</p>', + 'exported markdown function works' +); + +# Test that we *force* multimarkdown features to be off +$instr = q{# Heading 1}; +my $expstr = qq{<h1>Heading 1</h1>\n}; + +lives_ok { + $outstr = markdown($instr, { heading_ids => 1}); +} 'Functional markdown works without an exception, with options'; + +is( + $outstr => $expstr, + 'exported markdown function overrides passed options' +); + +{ + local $TODO = 'Broken here'; + $outstr = ''; + lives_ok { + $outstr = Text::Markdown->markdown($instr); + } 'Lives (class method)'; + + chomp($outstr); + + is($outstr, '<p>' . $instr . '</p>', 'Text::Markdown->markdown() works (as class method)'); +}; diff --git a/t/21fulldocs-text-markdown.t b/t/21fulldocs-text-markdown.t new file mode 100644 index 0000000..43c5630 --- /dev/null +++ b/t/21fulldocs-text-markdown.t @@ -0,0 +1,116 @@ +use strict; +use warnings; +use Test::More; +use FindBin qw($Bin); + +use List::MoreUtils qw(uniq); +use Encode; + +our $TIDY = 0; + +### Generate difftest subroutine, pretty prints diffs if you have Text::Diff, use uses +### Test::More::is otherwise. + +eval { + require Text::Diff; +}; +if (!$@) { + *difftest = sub { + my ($got, $expected, $testname) = @_; + $got .= "\n"; + $expected .= "\n"; + if ($got eq $expected) { + pass($testname); + return; + } + print "=" x 80 . "\nDIFFERENCES: + = processed version from .text, - = template from .html\n"; + print encode('utf8', Text::Diff::diff(\$expected => \$got, { STYLE => "Unified" }) . "\n"); + fail($testname); + }; +} +else { + warn("Install Text::Diff for more helpful failure messages! ($@)"); + *difftest = \&Test::More::is; +} + +sub tidy { + $TIDY = 1; + eval "use HTML::Tidy; "; + if ($@) { + plan skip_all => 'This test needs HTML::Tidy installed to pass correctly, skipping'; + exit; + } +} + +### Actual code for this test - unless(caller) stops it +### being run when this file is required by other tests + +unless (caller) { + my $docsdir = "$Bin/Text-Markdown.mdtest"; + my @files = get_files($docsdir); + + plan tests => scalar(@files) + 1; + + use_ok('Text::Markdown'); + + my $m = Text::Markdown->new(); + + run_tests($m, $docsdir, @files); +} + +sub get_files { + my ($docsdir) = @_; + my $DH; + opendir($DH, $docsdir) or die("Could not open $docsdir"); + my @files = uniq map { s/\.(xhtml|html|text)$// ? $_ : (); } readdir($DH); + closedir($DH); + return @files; +} + +sub slurp { + my ($filename) = @_; + open my $file, '<', $filename or die "Couldn't open $filename: $!"; + local $/ = undef; + return <$file>; +} + +sub run_tests { + my ($m, $docsdir, @files) = @_; + foreach my $test (@files) { + my ($input, $output); + eval { + if (-f "$docsdir/$test.html") { + $output = slurp("$docsdir/$test.html"); + } + else { + $output = slurp("$docsdir/$test.xhtml"); + } + $input = slurp("$docsdir/$test.text"); + }; + $input .= "\n\n"; + $output .= "\n\n"; + if ($@) { + fail("1 part of test file not found: $@"); + next; + } + $output =~ s/\s+\z//; # trim trailing whitespace + my $processed = $m->markdown($input); + $processed =~ s/\s+\z//; # trim trailing whitespace + + if ($TIDY) { + my $t = HTML::Tidy->new; + $output = $t->clean($output); + $processed = $t->clean($processed); + } + + # Un-comment for debugging if you have space diffs you can't see.. + $output =~ s/ / /g; + $output =~ s/\t/&tab;/g; + $processed =~ s/ / /g; + $processed =~ s/\t/&tab;/g; + + difftest($processed, $output, "Docs test: $test"); + } +} + +1; diff --git a/t/23fulldocs-markdown.t b/t/23fulldocs-markdown.t new file mode 100644 index 0000000..e9b8241 --- /dev/null +++ b/t/23fulldocs-markdown.t @@ -0,0 +1,18 @@ +use strict; +use warnings; +use Test::More; +use FindBin qw($Bin); + +require "$Bin/21fulldocs-text-markdown.t"; +tidy(); + +my $docsdir = "$Bin/Markdown-from-MDTest1.1.mdtest"; +my @files = get_files($docsdir); + +plan tests => scalar(@files) + 1; + +use_ok('Text::Markdown'); + +my $m = Text::Markdown->new(); + +run_tests($m, $docsdir, @files); diff --git a/t/25fulldocs-phpmarkdown.t b/t/25fulldocs-phpmarkdown.t new file mode 100644 index 0000000..d2c7c4d --- /dev/null +++ b/t/25fulldocs-phpmarkdown.t @@ -0,0 +1,22 @@ +use strict; +use warnings; +use Test::More; +use FindBin qw($Bin); + +require "$Bin/21fulldocs-text-markdown.t"; + +tidy(); + +my $docsdir = "$Bin/PHP_Markdown-from-MDTest1.1.mdtest"; +my @files = get_files($docsdir); + +plan tests => scalar(@files) + 1; + +use_ok('Text::Markdown'); + +my $m = Text::Markdown->new(); + +TODO: { + local $TODO = 'Have not fixed a load of the bugs PHP markdown has yet.'; + run_tests($m, $docsdir, @files); +}; diff --git a/t/31angleedgecase.t b/t/31angleedgecase.t new file mode 100644 index 0000000..1304221 --- /dev/null +++ b/t/31angleedgecase.t @@ -0,0 +1,18 @@ +use strict; +use warnings; +use Test::More tests => 2; + +# http://babelmark.bobtfish.net/?markdown=x%3Cmax(a%2Cb)%0D%0A&normalize=on + +use_ok('Text::Markdown'); + +my $m = Text::Markdown->new; + +my $in = q{x<max(a,b)}; +my $ex = q{<p>x<max(a,b)</p>}; + +{ + local $TODO = 'Known "bug" (the no < unless next to space thing was originally by design) - but I would like to +break the spec and fix this..'; + is ($m->markdown($in), $ex); +}; diff --git a/t/32tabwidth.t b/t/32tabwidth.t new file mode 100644 index 0000000..8b13a2b --- /dev/null +++ b/t/32tabwidth.t @@ -0,0 +1,37 @@ +use strict; +use warnings; +use Test::More tests => 4; + +use_ok( 'Text::Markdown' ); + +my $m = Text::Markdown->new( tab_width => 2 ); +my $instr = q{start + + <h1>HTML block</h1> + +end +}; + +my $expstr = q{<p>start</p> + +<pre><code><h1>HTML block</h1> +</code></pre> + +<p>end</p> +}; + +is($m->markdown($instr) => $expstr, 'Correct (constructor)'); +is(Text::Markdown->new->markdown($instr, { tab_width => 2}) => $expstr, 'Correct (markdown method option)'); + +my $txt = $m->markdown(<<'END_MARKDOWN'); +This is a para. + + This is code. + --- + This is code. + +This is a para. +END_MARKDOWN + +unlike($txt, qr{<hr}, "no HR elements when the hr is in a code block"); +
\ No newline at end of file diff --git a/t/33spaceinlinksandimages.t b/t/33spaceinlinksandimages.t new file mode 100644 index 0000000..3b447b8 --- /dev/null +++ b/t/33spaceinlinksandimages.t @@ -0,0 +1,15 @@ +use strict; +use warnings; +use Test::More tests => 2; + +use_ok('Text::Markdown'); + +{ + local $TODO = 'Proposed syntax extension (on list) to deal with spaces in URLs by quoting them'; + + my $instr = qq{\n}; + my $expstr = qq{<p><img src="pfad/und/eine%20lange/urlzu%20mbild.jpg" alt="alternativer text" title="testtitle" /></p>\n}; + + is(Text::Markdown::markdown($instr) => $expstr, 'as expected'); + +};
\ No newline at end of file diff --git a/t/34commandlinemarkdown.t b/t/34commandlinemarkdown.t new file mode 100644 index 0000000..92c0230 --- /dev/null +++ b/t/34commandlinemarkdown.t @@ -0,0 +1,16 @@ +use strict; +use warnings; +use FindBin qw($Bin); +use Test::More tests => 2; +use Test::Exception; + +my $filename = "$Bin/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax"; +unshift(@ARGV, "$filename.text"); +open my $file, '<', "$filename.xhtml" or die "Couldn't open $filename: $!"; +my $expected = do { local $/; <$file> }; + +lives_ok { + require "$Bin/../script/Markdown.pl"; +} 'require Markdown.pl works'; +my $out = main(); +is($out, $expected, 'Markdown.pl does the right thing with the syntax guide'); diff --git a/t/37anchormultilinebugs.t b/t/37anchormultilinebugs.t new file mode 100644 index 0000000..1a26bc7 --- /dev/null +++ b/t/37anchormultilinebugs.t @@ -0,0 +1,44 @@ +# http://bugs.debian.org/459885 +use strict; +use warnings; +use Test::More tests => 4; +# This is also tested in the Links Reference style test case. + + +use_ok('Text::Markdown'); + +my $m = Text::Markdown->new; + +my $in = q{[link +text] [link +id] + +[link id]: /someurl/ +}; +my $ex = q{<p><a href="/someurl/">link +text</a></p> +}; + +is($m->markdown($in), $ex, 'http://bugs.debian.org/459885 - Line breaks in reference link ids (single line breaks)'); + +$in = qq{Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is [my \nUniversity][]. + + [my university]: http://www.ua.es +}; +$ex = q{<p>Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is <a href="http://www.ua.es">my <br /> +University</a>.</p> +}; + +is($m->markdown($in), $ex, 'http://bugs.debian.org/459885 - Line breaks in reference link ids (multiple trailing spaces and line breaks)'); + +$in = qq{Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is [my \nUniversity]. + + [my university]: http://www.ua.es +}; +$ex = q{<p>Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is <a href="http://www.ua.es">my <br /> +University</a>.</p> +}; + +is($m->markdown($in), $ex, 'http://bugs.debian.org/459885 - Line breaks in shortcut reference link ids (multiple trailing spaces and line breaks)'); + + diff --git a/t/40trustliststart.t b/t/40trustliststart.t new file mode 100644 index 0000000..289e8d2 --- /dev/null +++ b/t/40trustliststart.t @@ -0,0 +1,33 @@ +use strict; +use warnings; +use Test::More tests => 2; + +use_ok( 'Text::Markdown' ); + +my $m = Text::Markdown->new(trust_list_start_value => 1); +my $html1 = $m->markdown(<<"EOF"); +1. this +2. is a list + +Paragraph. + +3. and we +4. pick up + +EOF + +my $want = <<'EOF'; +<ol start='1'> +<li>this</li> +<li>is a list</li> +</ol> + +<p>Paragraph.</p> + +<ol start='3'> +<li>and we</li> +<li>pick up</li> +</ol> +EOF + +is($html1, $want, "we can use numbering from start marker"); diff --git a/t/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.text b/t/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.text new file mode 100644 index 0000000..0e9527f --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.text @@ -0,0 +1,21 @@ +AT&T has an ampersand in their name. + +AT&T is another way to write it. + +This & that. + +4 < 5. + +6 > 5. + +Here's a [link] [1] with an ampersand in the URL. + +Here's a link with an amersand in the link text: [AT&T] [2]. + +Here's an inline [link](/script?foo=1&bar=2). + +Here's an inline [link](</script?foo=1&bar=2>). + + +[1]: http://example.com/?foo=1&bar=2 +[2]: http://att.com/ "AT&T"
\ No newline at end of file diff --git a/t/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.xhtml new file mode 100644 index 0000000..9606860 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.xhtml @@ -0,0 +1,17 @@ +<p>AT&T has an ampersand in their name.</p> + +<p>AT&T is another way to write it.</p> + +<p>This & that.</p> + +<p>4 < 5.</p> + +<p>6 > 5.</p> + +<p>Here's a <a href="http://example.com/?foo=1&bar=2">link</a> with an ampersand in the URL.</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 inline <a href="/script?foo=1&bar=2">link</a>.</p> + +<p>Here's an inline <a href="/script?foo=1&bar=2">link</a>.</p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Auto_links.text b/t/Markdown-from-MDTest1.1.mdtest/Auto_links.text new file mode 100644 index 0000000..abbc488 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Auto_links.text @@ -0,0 +1,13 @@ +Link: <http://example.com/>. + +With an ampersand: <http://example.com/?foo=1&bar=2> + +* In a list? +* <http://example.com/> +* It should. + +> Blockquoted: <http://example.com/> + +Auto-links should not occur here: `<http://example.com/>` + + or here: <http://example.com/>
\ No newline at end of file diff --git a/t/Markdown-from-MDTest1.1.mdtest/Auto_links.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Auto_links.xhtml new file mode 100644 index 0000000..f8df985 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Auto_links.xhtml @@ -0,0 +1,18 @@ +<p>Link: <a href="http://example.com/">http://example.com/</a>.</p> + +<p>With an ampersand: <a href="http://example.com/?foo=1&bar=2">http://example.com/?foo=1&bar=2</a></p> + +<ul> +<li>In a list?</li> +<li><a href="http://example.com/">http://example.com/</a></li> +<li>It should.</li> +</ul> + +<blockquote> + <p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p> +</blockquote> + +<p>Auto-links should not occur here: <code><http://example.com/></code></p> + +<pre><code>or here: <http://example.com/> +</code></pre> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.text b/t/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.text new file mode 100644 index 0000000..5b014cb --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.text @@ -0,0 +1,120 @@ +These should all get escaped: + +Backslash: \\ + +Backtick: \` + +Asterisk: \* + +Underscore: \_ + +Left brace: \{ + +Right brace: \} + +Left bracket: \[ + +Right bracket: \] + +Left paren: \( + +Right paren: \) + +Greater-than: \> + +Hash: \# + +Period: \. + +Bang: \! + +Plus: \+ + +Minus: \- + + + +These should not, because they occur within a code block: + + Backslash: \\ + + Backtick: \` + + Asterisk: \* + + Underscore: \_ + + Left brace: \{ + + Right brace: \} + + Left bracket: \[ + + Right bracket: \] + + Left paren: \( + + Right paren: \) + + Greater-than: \> + + Hash: \# + + Period: \. + + Bang: \! + + Plus: \+ + + Minus: \- + + +Nor should these, which occur in code spans: + +Backslash: `\\` + +Backtick: `` \` `` + +Asterisk: `\*` + +Underscore: `\_` + +Left brace: `\{` + +Right brace: `\}` + +Left bracket: `\[` + +Right bracket: `\]` + +Left paren: `\(` + +Right paren: `\)` + +Greater-than: `\>` + +Hash: `\#` + +Period: `\.` + +Bang: `\!` + +Plus: `\+` + +Minus: `\-` + + +These should get escaped, even though they're matching pairs for +other Markdown constructs: + +\*asterisks\* + +\_underscores\_ + +\`backticks\` + +This is a code span with a literal backslash-backtick sequence: `` \` `` + +This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>. + +This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>. diff --git a/t/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.xhtml new file mode 100644 index 0000000..29870da --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.xhtml @@ -0,0 +1,118 @@ +<p>These should all get escaped:</p> + +<p>Backslash: \</p> + +<p>Backtick: `</p> + +<p>Asterisk: *</p> + +<p>Underscore: _</p> + +<p>Left brace: {</p> + +<p>Right brace: }</p> + +<p>Left bracket: [</p> + +<p>Right bracket: ]</p> + +<p>Left paren: (</p> + +<p>Right paren: )</p> + +<p>Greater-than: ></p> + +<p>Hash: #</p> + +<p>Period: .</p> + +<p>Bang: !</p> + +<p>Plus: +</p> + +<p>Minus: -</p> + +<p>These should not, because they occur within a code block:</p> + +<pre><code>Backslash: \\ + +Backtick: \` + +Asterisk: \* + +Underscore: \_ + +Left brace: \{ + +Right brace: \} + +Left bracket: \[ + +Right bracket: \] + +Left paren: \( + +Right paren: \) + +Greater-than: \> + +Hash: \# + +Period: \. + +Bang: \! + +Plus: \+ + +Minus: \- +</code></pre> + +<p>Nor should these, which occur in code spans:</p> + +<p>Backslash: <code>\\</code></p> + +<p>Backtick: <code>\`</code></p> + +<p>Asterisk: <code>\*</code></p> + +<p>Underscore: <code>\_</code></p> + +<p>Left brace: <code>\{</code></p> + +<p>Right brace: <code>\}</code></p> + +<p>Left bracket: <code>\[</code></p> + +<p>Right bracket: <code>\]</code></p> + +<p>Left paren: <code>\(</code></p> + +<p>Right paren: <code>\)</code></p> + +<p>Greater-than: <code>\></code></p> + +<p>Hash: <code>\#</code></p> + +<p>Period: <code>\.</code></p> + +<p>Bang: <code>\!</code></p> + +<p>Plus: <code>\+</code></p> + +<p>Minus: <code>\-</code></p> + + +<p>These should get escaped, even though they're matching pairs for +other Markdown constructs:</p> + +<p>*asterisks*</p> + +<p>_underscores_</p> + +<p>`backticks`</p> + +<p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p> + +<p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p> + +<p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.text b/t/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.text new file mode 100644 index 0000000..c31d171 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.text @@ -0,0 +1,11 @@ +> Example: +> +> sub status { +> print "working"; +> } +> +> Or: +> +> sub status { +> return "working"; +> } diff --git a/t/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.xhtml new file mode 100644 index 0000000..990202a --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.xhtml @@ -0,0 +1,15 @@ +<blockquote> + <p>Example:</p> + +<pre><code>sub status { + print "working"; +} +</code></pre> + + <p>Or:</p> + +<pre><code>sub status { + return "working"; +} +</code></pre> +</blockquote> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Code_Blocks.text b/t/Markdown-from-MDTest1.1.mdtest/Code_Blocks.text new file mode 100644 index 0000000..b54b092 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Code_Blocks.text @@ -0,0 +1,14 @@ + code block on the first line + +Regular text. + + code block indented by spaces + +Regular text. + + the lines in this block + all contain trailing spaces + +Regular Text. + + code block on the last line
\ No newline at end of file diff --git a/t/Markdown-from-MDTest1.1.mdtest/Code_Blocks.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Code_Blocks.xhtml new file mode 100644 index 0000000..32703f5 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Code_Blocks.xhtml @@ -0,0 +1,18 @@ +<pre><code>code block on the first line +</code></pre> + +<p>Regular text.</p> + +<pre><code>code block indented by spaces +</code></pre> + +<p>Regular text.</p> + +<pre><code>the lines in this block +all contain trailing spaces +</code></pre> + +<p>Regular Text.</p> + +<pre><code>code block on the last line +</code></pre> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Code_Spans.text b/t/Markdown-from-MDTest1.1.mdtest/Code_Spans.text new file mode 100644 index 0000000..5c229c7 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Code_Spans.text @@ -0,0 +1,5 @@ +`<test a="` content of attribute `">` + +Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span> + +Here's how you put `` `backticks` `` in a code span.
\ No newline at end of file diff --git a/t/Markdown-from-MDTest1.1.mdtest/Code_Spans.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Code_Spans.xhtml new file mode 100644 index 0000000..b057457 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Code_Spans.xhtml @@ -0,0 +1,5 @@ +<p><code><test a="</code> content of attribute <code>"></code></p> + +<p>Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span></p> + +<p>Here's how you put <code>`backticks`</code> in a code span.</p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.text b/t/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.text new file mode 100644 index 0000000..f8a5b27 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.text @@ -0,0 +1,8 @@ +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. + +Here's one with a bullet. +* criminey. diff --git a/t/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.xhtml new file mode 100644 index 0000000..e21ac79 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.xhtml @@ -0,0 +1,8 @@ +<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> + +<p>Here's one with a bullet. +* criminey.</p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.text b/t/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.text new file mode 100644 index 0000000..1594bda --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.text @@ -0,0 +1,67 @@ +Dashes: + +--- + + --- + + --- + + --- + + --- + +- - - + + - - - + + - - - + + - - - + + - - - + + +Asterisks: + +*** + + *** + + *** + + *** + + *** + +* * * + + * * * + + * * * + + * * * + + * * * + + +Underscores: + +___ + + ___ + + ___ + + ___ + + ___ + +_ _ _ + + _ _ _ + + _ _ _ + + _ _ _ + + _ _ _ diff --git a/t/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.xhtml new file mode 100644 index 0000000..2dc2ab6 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.xhtml @@ -0,0 +1,71 @@ +<p>Dashes:</p> + +<hr /> + +<hr /> + +<hr /> + +<hr /> + +<pre><code>--- +</code></pre> + +<hr /> + +<hr /> + +<hr /> + +<hr /> + +<pre><code>- - - +</code></pre> + +<p>Asterisks:</p> + +<hr /> + +<hr /> + +<hr /> + +<hr /> + +<pre><code>*** +</code></pre> + +<hr /> + +<hr /> + +<hr /> + +<hr /> + +<pre><code>* * * +</code></pre> + +<p>Underscores:</p> + +<hr /> + +<hr /> + +<hr /> + +<hr /> + +<pre><code>___ +</code></pre> + +<hr /> + +<hr /> + +<hr /> + +<hr /> + +<pre><code>_ _ _ +</code></pre> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Images.text b/t/Markdown-from-MDTest1.1.mdtest/Images.text new file mode 100644 index 0000000..5707590 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Images.text @@ -0,0 +1,26 @@ + + + + +Inline within a paragraph: [alt text](/url/). + + + + + + + +. + +![Empty]() + +.jpg) + + +![alt text][foo] + + [foo]: /url/ + +![alt text][bar] + + [bar]: /url/ "Title here"
\ No newline at end of file diff --git a/t/Markdown-from-MDTest1.1.mdtest/Images.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Images.xhtml new file mode 100644 index 0000000..925bc14 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Images.xhtml @@ -0,0 +1,21 @@ +<p><img src="/path/to/img.jpg" alt="Alt text" /></p> + +<p><img src="/path/to/img.jpg" alt="Alt text" title="Optional title" /></p> + +<p>Inline within a paragraph: <a href="/url/">alt text</a>.</p> + +<p><img src="/url/" alt="alt text" title="title preceded by two spaces" /></p> + +<p><img src="/url/" alt="alt text" title="title has spaces afterward" /></p> + +<p><img src="/url/" alt="alt text" /></p> + +<p><img src="/url/" alt="alt text" title="with a title" />.</p> + +<p><img src="" alt="Empty" /></p> + +<p><img src="http://example.com/(parens).jpg" alt="this is a stupid URL" /></p> + +<p><img src="/url/" alt="alt text" /></p> + +<p><img src="/url/" alt="alt text" title="Title here" /></p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).text b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).text new file mode 100644 index 0000000..3633f81 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).text @@ -0,0 +1,30 @@ +Simple block on one line: + +<div>foo</div> + +And nested without indentation: + +<div> +<div> +<div> +foo +</div> +<div style=">"/> +</div> +<div>bar</div> +</div> + +And with attributes: + +<div> + <div id="foo"> + </div> +</div> + +This was broken in 1.0.2b7: + +<div class="inlinepage"> +<div class="toggleableend"> +foo +</div> +</div> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).xhtml b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).xhtml new file mode 100644 index 0000000..884f14c --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).xhtml @@ -0,0 +1,30 @@ +<p>Simple block on one line:</p> + +<div>foo</div> + +<p>And nested without indentation:</p> + +<div> +<div> +<div> +foo +</div> +<div style=">"/> +</div> +<div>bar</div> +</div> + +<p>And with attributes:</p> + +<div> + <div id="foo"> + </div> +</div> + +<p>This was broken in 1.0.2b7:</p> + +<div class="inlinepage"> +<div class="toggleableend"> +foo +</div> +</div> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).html b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).html new file mode 100644 index 0000000..6bf78f8 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).html @@ -0,0 +1,72 @@ +<p>Here's a simple block:</p> + +<div> + foo +</div> + +<p>This should be a code block, though:</p> + +<pre><code><div> + foo +</div> +</code></pre> + +<p>As should this:</p> + +<pre><code><div>foo</div> +</code></pre> + +<p>Now, nested:</p> + +<div> + <div> + <div> + foo + </div> + </div> +</div> + +<p>This should just be an HTML comment:</p> + +<!-- Comment --> + +<p>Multiline:</p> + +<!-- +Blah +Blah +--> + +<p>Code block:</p> + +<pre><code><!-- Comment --> +</code></pre> + +<p>Just plain comment, with trailing spaces on the line:</p> + +<!-- foo --> + +<p>Code:</p> + +<pre><code><hr /> +</code></pre> + +<p>Hr's:</p> + +<hr> + +<hr/> + +<hr /> + +<hr> + +<hr/> + +<hr /> + +<hr class="foo" id="bar" /> + +<hr class="foo" id="bar"/> + +<hr class="foo" id="bar" > diff --git a/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).text b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).text new file mode 100644 index 0000000..14aa2dc --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).text @@ -0,0 +1,69 @@ +Here's a simple block: + +<div> + foo +</div> + +This should be a code block, though: + + <div> + foo + </div> + +As should this: + + <div>foo</div> + +Now, nested: + +<div> + <div> + <div> + foo + </div> + </div> +</div> + +This should just be an HTML comment: + +<!-- Comment --> + +Multiline: + +<!-- +Blah +Blah +--> + +Code block: + + <!-- Comment --> + +Just plain comment, with trailing spaces on the line: + +<!-- foo --> + +Code: + + <hr /> + +Hr's: + +<hr> + +<hr/> + +<hr /> + +<hr> + +<hr/> + +<hr /> + +<hr class="foo" id="bar" /> + +<hr class="foo" id="bar"/> + +<hr class="foo" id="bar" > + diff --git a/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.html b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.html new file mode 100644 index 0000000..3f167a1 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.html @@ -0,0 +1,13 @@ +<p>Paragraph one.</p> + +<!-- This is a simple comment --> + +<!-- + This is another comment. +--> + +<p>Paragraph two.</p> + +<!-- one comment block -- -- with two comments --> + +<p>The end.</p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.text b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.text new file mode 100644 index 0000000..41d830d --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.text @@ -0,0 +1,13 @@ +Paragraph one. + +<!-- This is a simple comment --> + +<!-- + This is another comment. +--> + +Paragraph two. + +<!-- one comment block -- -- with two comments --> + +The end. diff --git a/t/Markdown-from-MDTest1.1.mdtest/Links_inline_style.text b/t/Markdown-from-MDTest1.1.mdtest/Links_inline_style.text new file mode 100644 index 0000000..aba9658 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Links_inline_style.text @@ -0,0 +1,24 @@ +Just a [URL](/url/). + +[URL and title](/url/ "title"). + +[URL and title](/url/ "title preceded by two spaces"). + +[URL and title](/url/ "title preceded by a tab"). + +[URL and title](/url/ "title has spaces afterward" ). + +[URL wrapped in angle brackets](</url/>). + +[URL w/ angle brackets + title](</url/> "Here's the title"). + +[Empty](). + +[With parens in the URL](http://en.wikipedia.org/wiki/WIMP_(computing)) + +(With outer parens and [parens in url](/foo(bar))) + + +[With parens in the URL](/foo(bar) "and a title") + +(With outer parens and [parens in url](/foo(bar) "and a title")) diff --git a/t/Markdown-from-MDTest1.1.mdtest/Links_inline_style.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Links_inline_style.xhtml new file mode 100644 index 0000000..9f351ef --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Links_inline_style.xhtml @@ -0,0 +1,23 @@ +<p>Just a <a href="/url/">URL</a>.</p> + +<p><a href="/url/" title="title">URL and title</a>.</p> + +<p><a href="/url/" title="title preceded by two spaces">URL and title</a>.</p> + +<p><a href="/url/" title="title preceded by a tab">URL and title</a>.</p> + +<p><a href="/url/" title="title has spaces afterward">URL and title</a>.</p> + +<p><a href="/url/">URL wrapped in angle brackets</a>.</p> + +<p><a href="/url/" title="Here's the title">URL w/ angle brackets + title</a>.</p> + +<p><a href="">Empty</a>.</p> + +<p><a href="http://en.wikipedia.org/wiki/WIMP_(computing)">With parens in the URL</a></p> + +<p>(With outer parens and <a href="/foo(bar)">parens in url</a>)</p> + +<p><a href="/foo(bar)" title="and a title">With parens in the URL</a></p> + +<p>(With outer parens and <a href="/foo(bar)" title="and a title">parens in url</a>)</p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Links_reference_style.text b/t/Markdown-from-MDTest1.1.mdtest/Links_reference_style.text new file mode 100644 index 0000000..341ec88 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Links_reference_style.text @@ -0,0 +1,71 @@ +Foo [bar] [1]. + +Foo [bar][1]. + +Foo [bar] +[1]. + +[1]: /url/ "Title" + + +With [embedded [brackets]] [b]. + + +Indented [once][]. + +Indented [twice][]. + +Indented [thrice][]. + +Indented [four][] times. + + [once]: /url + + [twice]: /url + + [thrice]: /url + + [four]: /url + + +[b]: /url/ + +* * * + +[this] [this] should work + +So should [this][this]. + +And [this] []. + +And [this][]. + +And [this]. + +But not [that] []. + +Nor [that][]. + +Nor [that]. + +[Something in brackets like [this][] should work] + +[Same with [this].] + +In this case, [this](/somethingelse/) points to something else. + +Backslashing should suppress \[this] and [this\]. + +[this]: foo + + +* * * + +Here's one where the [link +breaks] across lines. + +Here's another where the [link +breaks] across lines, but with a line-ending space. + + +[link breaks]: /url/ diff --git a/t/Markdown-from-MDTest1.1.mdtest/Links_reference_style.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Links_reference_style.xhtml new file mode 100644 index 0000000..8e70c32 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Links_reference_style.xhtml @@ -0,0 +1,52 @@ +<p>Foo <a href="/url/" title="Title">bar</a>.</p> + +<p>Foo <a href="/url/" title="Title">bar</a>.</p> + +<p>Foo <a href="/url/" title="Title">bar</a>.</p> + +<p>With <a href="/url/">embedded [brackets]</a>.</p> + +<p>Indented <a href="/url">once</a>.</p> + +<p>Indented <a href="/url">twice</a>.</p> + +<p>Indented <a href="/url">thrice</a>.</p> + +<p>Indented [four][] times.</p> + +<pre><code>[four]: /url +</code></pre> + +<hr /> + +<p><a href="foo">this</a> should work</p> + +<p>So should <a href="foo">this</a>.</p> + +<p>And <a href="foo">this</a>.</p> + +<p>And <a href="foo">this</a>.</p> + +<p>And <a href="foo">this</a>.</p> + +<p>But not [that] [].</p> + +<p>Nor [that][].</p> + +<p>Nor [that].</p> + +<p>[Something in brackets like <a href="foo">this</a> should work]</p> + +<p>[Same with <a href="foo">this</a>.]</p> + +<p>In this case, <a href="/somethingelse/">this</a> points to something else.</p> + +<p>Backslashing should suppress [this] and [this].</p> + +<hr /> + +<p>Here's one where the <a href="/url/">link +breaks</a> across lines.</p> + +<p>Here's another where the <a href="/url/">link +breaks</a> across lines, but with a line-ending space.</p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.text b/t/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.text new file mode 100644 index 0000000..8c44c98 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.text @@ -0,0 +1,20 @@ +This is the [simple case]. + +[simple case]: /simple + + + +This one has a [line +break]. + +This one has a [line +break] with a line-ending space. + +[line break]: /foo + + +[this] [that] and the [other] + +[this]: /this +[that]: /that +[other]: /other diff --git a/t/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.xhtml new file mode 100644 index 0000000..bf81e93 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.xhtml @@ -0,0 +1,9 @@ +<p>This is the <a href="/simple">simple case</a>.</p> + +<p>This one has a <a href="/foo">line +break</a>.</p> + +<p>This one has a <a href="/foo">line +break</a> with a line-ending space.</p> + +<p><a href="/that">this</a> and the <a href="/other">other</a></p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.text b/t/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.text new file mode 100644 index 0000000..29d0e42 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.text @@ -0,0 +1,7 @@ +Foo [bar][]. + +Foo [bar](/url/ "Title with "quotes" inside"). + + + [bar]: /url/ "Title with "quotes" inside" + diff --git a/t/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.xhtml new file mode 100644 index 0000000..611c1ac --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.xhtml @@ -0,0 +1,3 @@ +<p>Foo <a href="/url/" title="Title with "quotes" inside">bar</a>.</p> + +<p>Foo <a href="/url/" title="Title with "quotes" inside">bar</a>.</p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.text b/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.text new file mode 100644 index 0000000..486055c --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.text @@ -0,0 +1,306 @@ +Markdown: Basics +================ + +<ul id="ProjectSubmenu"> + <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li> + <li><a class="selected" title="Markdown Basics">Basics</a></li> + <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li> + <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li> + <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li> +</ul> + + +Getting the Gist of Markdown's Formatting Syntax +------------------------------------------------ + +This page offers a brief overview of what it's like to use Markdown. +The [syntax page] [s] provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown. + +It's also helpful to simply try Markdown out; the [Dingus] [d] is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML. + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL] [src]. + + [s]: /projects/markdown/syntax "Markdown Syntax" + [d]: /projects/markdown/dingus "Markdown Dingus" + [src]: /projects/markdown/basics.text + + +## Paragraphs, Headers, Blockquotes ## + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs. + +Markdown offers two styles of headers: *Setext* and *atx*. +Setext-style headers for `<h1>` and `<h2>` are created by +"underlining" with equal signs (`=`) and hyphens (`-`), respectively. +To create an atx-style header, you put 1-6 hash marks (`#`) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level. + +Blockquotes are indicated using email-style '`>`' angle brackets. + +Markdown: + + A First Level Header + ==================== + + A Second Level Header + --------------------- + + Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph. + + The quick brown fox jumped over the lazy + dog's back. + + ### Header 3 + + > This is a blockquote. + > + > This is the second paragraph in the blockquote. + > + > ## This is an H2 in a blockquote + + +Output: + + <h1>A First Level Header</h1> + + <h2>A Second Level Header</h2> + + <p>Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph.</p> + + <p>The quick brown fox jumped over the lazy + dog's back.</p> + + <h3>Header 3</h3> + + <blockquote> + <p>This is a blockquote.</p> + + <p>This is the second paragraph in the blockquote.</p> + + <h2>This is an H2 in a blockquote</h2> + </blockquote> + + + +### Phrase Emphasis ### + +Markdown uses asterisks and underscores to indicate spans of emphasis. + +Markdown: + + Some of these words *are emphasized*. + Some of these words _are emphasized also_. + + Use two asterisks for **strong emphasis**. + Or, if you prefer, __use two underscores instead__. + +Output: + + <p>Some of these words <em>are emphasized</em>. + Some of these words <em>are emphasized also</em>.</p> + + <p>Use two asterisks for <strong>strong emphasis</strong>. + Or, if you prefer, <strong>use two underscores instead</strong>.</p> + + + +## Lists ## + +Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, +`+`, and `-`) as list markers. These three markers are +interchangable; this: + + * Candy. + * Gum. + * Booze. + +this: + + + Candy. + + Gum. + + Booze. + +and this: + + - Candy. + - Gum. + - Booze. + +all produce the same output: + + <ul> + <li>Candy.</li> + <li>Gum.</li> + <li>Booze.</li> + </ul> + +Ordered (numbered) lists use regular numbers, followed by periods, as +list markers: + + 1. Red + 2. Green + 3. Blue + +Output: + + <ol> + <li>Red</li> + <li>Green</li> + <li>Blue</li> + </ol> + +If you put blank lines between items, you'll get `<p>` tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab: + + * A list item. + + With multiple paragraphs. + + * Another item in the list. + +Output: + + <ul> + <li><p>A list item.</p> + <p>With multiple paragraphs.</p></li> + <li><p>Another item in the list.</p></li> + </ul> + + + +### Links ### + +Markdown supports two styles for creating links: *inline* and +*reference*. With both styles, you use square brackets to delimit the +text you want to turn into a link. + +Inline-style links use parentheses immediately after the link text. +For example: + + This is an [example link](http://example.com/). + +Output: + + <p>This is an <a href="http://example.com/"> + example link</a>.</p> + +Optionally, you may include a title attribute in the parentheses: + + This is an [example link](http://example.com/ "With a Title"). + +Output: + + <p>This is an <a href="http://example.com/" title="With a Title"> + example link</a>.</p> + +Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document: + + I get 10 times more traffic from [Google][1] than from + [Yahoo][2] or [MSN][3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Output: + + <p>I get 10 times more traffic from <a href="http://google.com/" + title="Google">Google</a> than from <a href="http://search.yahoo.com/" + title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/" + title="MSN Search">MSN</a>.</p> + +The title attribute is optional. Link names may contain letters, +numbers and spaces, but are *not* case sensitive: + + I start my morning with a cup of coffee and + [The New York Times][NY Times]. + + [ny times]: http://www.nytimes.com/ + +Output: + + <p>I start my morning with a cup of coffee and + <a href="http://www.nytimes.com/">The New York Times</a>.</p> + + +### Images ### + +Image syntax is very much like link syntax. + +Inline (titles are optional): + +  + +Reference-style: + + ![alt text][id] + + [id]: /path/to/img.jpg "Title" + +Both of the above examples produce the same output: + + <img src="/path/to/img.jpg" alt="alt text" title="Title" /> + + + +### Code ### + +In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (`&`) and angle brackets (`<` or +`>`) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code: + + I strongly recommend against using any `<blink>` tags. + + I wish SmartyPants used named entities like `—` + instead of decimal-encoded entites like `—`. + +Output: + + <p>I strongly recommend against using any + <code><blink></code> tags.</p> + + <p>I wish SmartyPants used named entities like + <code>&mdash;</code> instead of decimal-encoded + entites like <code>&#8212;</code>.</p> + + +To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, +and `>` characters will be escaped automatically. + +Markdown: + + If you want your page to validate under XHTML 1.0 Strict, + you've got to put paragraph tags in your blockquotes: + + <blockquote> + <p>For example.</p> + </blockquote> + +Output: + + <p>If you want your page to validate under XHTML 1.0 Strict, + you've got to put paragraph tags in your blockquotes:</p> + + <pre><code><blockquote> + <p>For example.</p> + </blockquote> + </code></pre> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.xhtml new file mode 100644 index 0000000..d5bdbb2 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.xhtml @@ -0,0 +1,314 @@ +<h1>Markdown: Basics</h1> + +<ul id="ProjectSubmenu"> + <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li> + <li><a class="selected" title="Markdown Basics">Basics</a></li> + <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li> + <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li> + <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li> +</ul> + +<h2>Getting the Gist of Markdown's Formatting Syntax</h2> + +<p>This page offers a brief overview of what it's like to use Markdown. +The <a href="/projects/markdown/syntax" title="Markdown Syntax">syntax page</a> provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown.</p> + +<p>It's also helpful to simply try Markdown out; the <a href="/projects/markdown/dingus" title="Markdown Dingus">Dingus</a> is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML.</p> + +<p><strong>Note:</strong> This document is itself written using Markdown; you +can <a href="/projects/markdown/basics.text">see the source for it by adding '.text' to the URL</a>.</p> + +<h2>Paragraphs, Headers, Blockquotes</h2> + +<p>A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs.</p> + +<p>Markdown offers two styles of headers: <em>Setext</em> and <em>atx</em>. +Setext-style headers for <code><h1></code> and <code><h2></code> are created by +"underlining" with equal signs (<code>=</code>) and hyphens (<code>-</code>), respectively. +To create an atx-style header, you put 1-6 hash marks (<code>#</code>) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level.</p> + +<p>Blockquotes are indicated using email-style '<code>></code>' angle brackets.</p> + +<p>Markdown:</p> + +<pre><code>A First Level Header +==================== + +A Second Level Header +--------------------- + +Now is the time for all good men to come to +the aid of their country. This is just a +regular paragraph. + +The quick brown fox jumped over the lazy +dog's back. + +### Header 3 + +> This is a blockquote. +> +> This is the second paragraph in the blockquote. +> +> ## This is an H2 in a blockquote +</code></pre> + +<p>Output:</p> + +<pre><code><h1>A First Level Header</h1> + +<h2>A Second Level Header</h2> + +<p>Now is the time for all good men to come to +the aid of their country. This is just a +regular paragraph.</p> + +<p>The quick brown fox jumped over the lazy +dog's back.</p> + +<h3>Header 3</h3> + +<blockquote> + <p>This is a blockquote.</p> + + <p>This is the second paragraph in the blockquote.</p> + + <h2>This is an H2 in a blockquote</h2> +</blockquote> +</code></pre> + +<h3>Phrase Emphasis</h3> + +<p>Markdown uses asterisks and underscores to indicate spans of emphasis.</p> + +<p>Markdown:</p> + +<pre><code>Some of these words *are emphasized*. +Some of these words _are emphasized also_. + +Use two asterisks for **strong emphasis**. +Or, if you prefer, __use two underscores instead__. +</code></pre> + +<p>Output:</p> + +<pre><code><p>Some of these words <em>are emphasized</em>. +Some of these words <em>are emphasized also</em>.</p> + +<p>Use two asterisks for <strong>strong emphasis</strong>. +Or, if you prefer, <strong>use two underscores instead</strong>.</p> +</code></pre> + +<h2>Lists</h2> + +<p>Unordered (bulleted) lists use asterisks, pluses, and hyphens (<code>*</code>, +<code>+</code>, and <code>-</code>) as list markers. These three markers are +interchangable; this:</p> + +<pre><code>* Candy. +* Gum. +* Booze. +</code></pre> + +<p>this:</p> + +<pre><code>+ Candy. ++ Gum. ++ Booze. +</code></pre> + +<p>and this:</p> + +<pre><code>- Candy. +- Gum. +- Booze. +</code></pre> + +<p>all produce the same output:</p> + +<pre><code><ul> +<li>Candy.</li> +<li>Gum.</li> +<li>Booze.</li> +</ul> +</code></pre> + +<p>Ordered (numbered) lists use regular numbers, followed by periods, as +list markers:</p> + +<pre><code>1. Red +2. Green +3. Blue +</code></pre> + +<p>Output:</p> + +<pre><code><ol> +<li>Red</li> +<li>Green</li> +<li>Blue</li> +</ol> +</code></pre> + +<p>If you put blank lines between items, you'll get <code><p></code> tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab:</p> + +<pre><code>* A list item. + + With multiple paragraphs. + +* Another item in the list. +</code></pre> + +<p>Output:</p> + +<pre><code><ul> +<li><p>A list item.</p> +<p>With multiple paragraphs.</p></li> +<li><p>Another item in the list.</p></li> +</ul> +</code></pre> + +<h3>Links</h3> + +<p>Markdown supports two styles for creating links: <em>inline</em> and +<em>reference</em>. With both styles, you use square brackets to delimit the +text you want to turn into a link.</p> + +<p>Inline-style links use parentheses immediately after the link text. +For example:</p> + +<pre><code>This is an [example link](http://example.com/). +</code></pre> + +<p>Output:</p> + +<pre><code><p>This is an <a href="http://example.com/"> +example link</a>.</p> +</code></pre> + +<p>Optionally, you may include a title attribute in the parentheses:</p> + +<pre><code>This is an [example link](http://example.com/ "With a Title"). +</code></pre> + +<p>Output:</p> + +<pre><code><p>This is an <a href="http://example.com/" title="With a Title"> +example link</a>.</p> +</code></pre> + +<p>Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document:</p> + +<pre><code>I get 10 times more traffic from [Google][1] than from +[Yahoo][2] or [MSN][3]. + +[1]: http://google.com/ "Google" +[2]: http://search.yahoo.com/ "Yahoo Search" +[3]: http://search.msn.com/ "MSN Search" +</code></pre> + +<p>Output:</p> + +<pre><code><p>I get 10 times more traffic from <a href="http://google.com/" +title="Google">Google</a> than from <a href="http://search.yahoo.com/" +title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/" +title="MSN Search">MSN</a>.</p> +</code></pre> + +<p>The title attribute is optional. Link names may contain letters, +numbers and spaces, but are <em>not</em> case sensitive:</p> + +<pre><code>I start my morning with a cup of coffee and +[The New York Times][NY Times]. + +[ny times]: http://www.nytimes.com/ +</code></pre> + +<p>Output:</p> + +<pre><code><p>I start my morning with a cup of coffee and +<a href="http://www.nytimes.com/">The New York Times</a>.</p> +</code></pre> + +<h3>Images</h3> + +<p>Image syntax is very much like link syntax.</p> + +<p>Inline (titles are optional):</p> + +<pre><code> +</code></pre> + +<p>Reference-style:</p> + +<pre><code>![alt text][id] + +[id]: /path/to/img.jpg "Title" +</code></pre> + +<p>Both of the above examples produce the same output:</p> + +<pre><code><img src="/path/to/img.jpg" alt="alt text" title="Title" /> +</code></pre> + +<h3>Code</h3> + +<p>In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (<code>&</code>) and angle brackets (<code><</code> or +<code>></code>) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code:</p> + +<pre><code>I strongly recommend against using any `<blink>` tags. + +I wish SmartyPants used named entities like `&mdash;` +instead of decimal-encoded entites like `&#8212;`. +</code></pre> + +<p>Output:</p> + +<pre><code><p>I strongly recommend against using any +<code>&lt;blink&gt;</code> tags.</p> + +<p>I wish SmartyPants used named entities like +<code>&amp;mdash;</code> instead of decimal-encoded +entites like <code>&amp;#8212;</code>.</p> +</code></pre> + +<p>To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, <code>&</code>, <code><</code>, +and <code>></code> characters will be escaped automatically.</p> + +<p>Markdown:</p> + +<pre><code>If you want your page to validate under XHTML 1.0 Strict, +you've got to put paragraph tags in your blockquotes: + + <blockquote> + <p>For example.</p> + </blockquote> +</code></pre> + +<p>Output:</p> + +<pre><code><p>If you want your page to validate under XHTML 1.0 Strict, +you've got to put paragraph tags in your blockquotes:</p> + +<pre><code>&lt;blockquote&gt; + &lt;p&gt;For example.&lt;/p&gt; +&lt;/blockquote&gt; +</code></pre> +</code></pre> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.text b/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.text new file mode 100644 index 0000000..57360a1 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.text @@ -0,0 +1,888 @@ +Markdown: Syntax +================ + +<ul id="ProjectSubmenu"> + <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li> + <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li> + <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li> + <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li> + <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li> +</ul> + + +* [Overview](#overview) + * [Philosophy](#philosophy) + * [Inline HTML](#html) + * [Automatic Escaping for Special Characters](#autoescape) +* [Block Elements](#block) + * [Paragraphs and Line Breaks](#p) + * [Headers](#header) + * [Blockquotes](#blockquote) + * [Lists](#list) + * [Code Blocks](#precode) + * [Horizontal Rules](#hr) +* [Span Elements](#span) + * [Links](#link) + * [Emphasis](#em) + * [Code](#code) + * [Images](#img) +* [Miscellaneous](#misc) + * [Backslash Escapes](#backslash) + * [Automatic Links](#autolink) + + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL][src]. + + [src]: /projects/markdown/syntax.text + +* * * + +<h2 id="overview">Overview</h2> + +<h3 id="philosophy">Philosophy</h3> + +Markdown is intended to be as easy-to-read and easy-to-write as is feasible. + +Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], +[Grutatext] [5], and [EtText] [6] -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email. + + [1]: http://docutils.sourceforge.net/mirror/setext.html + [2]: http://www.aaronsw.com/2002/atx/ + [3]: http://textism.com/tools/textile/ + [4]: http://docutils.sourceforge.net/rst.html + [5]: http://www.triptico.com/software/grutatxt.html + [6]: http://ettext.taint.org/doc/ + +To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like \*emphasis\*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email. + + + +<h3 id="html">Inline HTML</h3> + +Markdown's syntax is intended for one purpose: to be used as a +format for *writing* for the web. + +Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is *not* to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a *publishing* format; Markdown is a *writing* +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text. + +For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags. + +The only restrictions are that block-level HTML elements -- e.g. `<div>`, +`<table>`, `<pre>`, `<p>`, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) `<p>` tags around HTML block-level tags. + +For example, to add an HTML table to a Markdown article: + + This is a regular paragraph. + + <table> + <tr> + <td>Foo</td> + </tr> + </table> + + This is another regular paragraph. + +Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an +HTML block. + +Span-level HTML tags -- e.g. `<span>`, `<cite>`, or `<del>` -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML `<a>` or `<img>` tags instead of Markdown's +link or image syntax, go right ahead. + +Unlike block-level HTML tags, Markdown syntax *is* processed within +span-level tags. + + +<h3 id="autoescape">Automatic Escaping for Special Characters</h3> + +In HTML, there are two characters that demand special treatment: `<` +and `&`. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. `<`, and +`&`. + +Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write '`AT&T`'. You even need to +escape ampersands within URLs. Thus, if you want to link to: + + http://images.google.com/images?num=30&q=larry+bird + +you need to encode the URL as: + + http://images.google.com/images?num=30&q=larry+bird + +in your anchor tag `href` attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites. + +Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into `&`. + +So, if you want to include a copyright symbol in your article, you can write: + + © + +and Markdown will leave it alone. But if you write: + + AT&T + +Markdown will translate it to: + + AT&T + +Similarly, because Markdown supports [inline HTML](#html), if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write: + + 4 < 5 + +Markdown will translate it to: + + 4 < 5 + +However, inside Markdown code spans and blocks, angle brackets and +ampersands are *always* encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single `<` +and `&` in your example code needs to be escaped.) + + +* * * + + +<h2 id="block">Block Elements</h2> + + +<h3 id="p">Paragraphs and Line Breaks</h3> + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs. + +The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a `<br />` tag. + +When you *do* want to insert a `<br />` break tag using Markdown, you +end a line with two or more spaces, then type return. + +Yes, this takes a tad more effort to create a `<br />`, but a simplistic +"every line break is a `<br />`" rule wouldn't work for Markdown. +Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] +work best -- and look better -- when you format them with hard breaks. + + [bq]: #blockquote + [l]: #list + + + +<h3 id="header">Headers</h3> + +Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. + +Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example: + + This is an H1 + ============= + + This is an H2 + ------------- + +Any number of underlining `=`'s or `-`'s will work. + +Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example: + + # This is an H1 + + ## This is an H2 + + ###### This is an H6 + +Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) : + + # This is an H1 # + + ## This is an H2 ## + + ### This is an H3 ###### + + +<h3 id="blockquote">Blockquotes</h3> + +Markdown uses email-style `>` characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a `>` before every line: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + > + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + > id sem consectetuer libero luctus adipiscing. + +Markdown allows you to be lazy and only put the `>` before the first +line of a hard-wrapped paragraph: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + id sem consectetuer libero luctus adipiscing. + +Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of `>`: + + > This is the first level of quoting. + > + > > This is nested blockquote. + > + > Back to the first level. + +Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks: + + > ## This is a header. + > + > 1. This is the first list item. + > 2. This is the second list item. + > + > Here's some example code: + > + > return shell_exec("echo $input | $markdown_script"); + +Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu. + + +<h3 id="list">Lists</h3> + +Markdown supports ordered (numbered) and unordered (bulleted) lists. + +Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers: + + * Red + * Green + * Blue + +is equivalent to: + + + Red + + Green + + Blue + +and: + + - Red + - Green + - Blue + +Ordered lists use numbers followed by periods: + + 1. Bird + 2. McHale + 3. Parish + +It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is: + + <ol> + <li>Bird</li> + <li>McHale</li> + <li>Parish</li> + </ol> + +If you instead wrote the list in Markdown like this: + + 1. Bird + 1. McHale + 1. Parish + +or even: + + 3. Bird + 1. McHale + 8. Parish + +you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to. + +If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number. + +List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab. + +To make lists look nice, you can wrap items with hanging indents: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +But if you want to be lazy, you don't have to: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +If list items are separated by blank lines, Markdown will wrap the +items in `<p>` tags in the HTML output. For example, this input: + + * Bird + * Magic + +will turn into: + + <ul> + <li>Bird</li> + <li>Magic</li> + </ul> + +But this: + + * Bird + + * Magic + +will turn into: + + <ul> + <li><p>Bird</p></li> + <li><p>Magic</p></li> + </ul> + +List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be intended by either 4 spaces +or one tab: + + 1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + + 2. Suspendisse id sem consectetuer libero luctus adipiscing. + +It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy: + + * This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're + only required to indent the first line. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. + + * Another item in the same list. + +To put a blockquote within a list item, the blockquote's `>` +delimiters need to be indented: + + * A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +To put a code block within a list item, the code block needs +to be indented *twice* -- 8 spaces or two tabs: + + * A list item with a code block: + + <code goes here> + + +It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this: + + 1986. What a great season. + +In other words, a *number-period-space* sequence at the beginning of a +line. To avoid this, you can backslash-escape the period: + + 1986\. What a great season. + + + +<h3 id="precode">Code Blocks</h3> + +Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both `<pre>` and `<code>` tags. + +To produce a code block in Markdown, simply indent every line of the +block by at least 4 spaces or 1 tab. For example, given this input: + + This is a normal paragraph: + + This is a code block. + +Markdown will generate: + + <p>This is a normal paragraph:</p> + + <pre><code>This is a code block. + </code></pre> + +One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this: + + Here is an example of AppleScript: + + tell application "Foo" + beep + end tell + +will turn into: + + <p>Here is an example of AppleScript:</p> + + <pre><code>tell application "Foo" + beep + end tell + </code></pre> + +A code block continues until it reaches a line that is not indented +(or the end of the article). + +Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this: + + <div class="footer"> + © 2004 Foo Corporation + </div> + +will turn into: + + <pre><code><div class="footer"> + &copy; 2004 Foo Corporation + </div> + </code></pre> + +Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax. + + + +<h3 id="hr">Horizontal Rules</h3> + +You can produce a horizontal rule tag (`<hr />`) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule: + + * * * + + *** + + ***** + + - - - + + --------------------------------------- + + _ _ _ + + +* * * + +<h2 id="span">Span Elements</h2> + +<h3 id="link">Links</h3> + +Markdown supports two style of links: *inline* and *reference*. + +In both styles, the link text is delimited by [square brackets]. + +To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an *optional* +title for the link, surrounded in quotes. For example: + + This is [an example](http://example.com/ "Title") inline link. + + [This link](http://example.net/) has no title attribute. + +Will produce: + + <p>This is <a href="http://example.com/" title="Title"> + an example</a> inline link.</p> + + <p><a href="http://example.net/">This link</a> has no + title attribute.</p> + +If you're referring to a local resource on the same server, you can +use relative paths: + + See my [About](/about/) page for details. + +Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link: + + This is [an example][id] reference-style link. + +You can optionally use a space to separate the sets of brackets: + + This is [an example] [id] reference-style link. + +Then, anywhere in the document, you define your link label like this, +on a line by itself: + + [id]: http://example.com/ "Optional Title Here" + +That is: + +* Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces); +* followed by a colon; +* followed by one or more spaces (or tabs); +* followed by the URL for the link; +* optionally followed by a title attribute for the link, enclosed + in double or single quotes. + +The link URL may, optionally, be surrounded by angle brackets: + + [id]: <http://example.com/> "Optional Title Here" + +You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs: + + [id]: http://example.com/longish/path/to/resource/here + "Optional Title Here" + +Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output. + +Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: + + [link text][a] + [link text][A] + +are equivalent. + +The *implicit link name* shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write: + + [Google][] + +And then define the link: + + [Google]: http://google.com/ + +Because link names may contain spaces, this shortcut even works for +multiple words in the link text: + + Visit [Daring Fireball][] for more information. + +And then define the link: + + [Daring Fireball]: http://daringfireball.net/ + +Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes. + +Here's an example of reference links in action: + + I get 10 times more traffic from [Google] [1] than from + [Yahoo] [2] or [MSN] [3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Using the implicit link name shortcut, you could instead write: + + I get 10 times more traffic from [Google][] than from + [Yahoo][] or [MSN][]. + + [google]: http://google.com/ "Google" + [yahoo]: http://search.yahoo.com/ "Yahoo Search" + [msn]: http://search.msn.com/ "MSN Search" + +Both of the above examples will produce the following HTML output: + + <p>I get 10 times more traffic from <a href="http://google.com/" + title="Google">Google</a> than from + <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a> + or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p> + +For comparison, here is the same paragraph written using +Markdown's inline link style: + + I get 10 times more traffic from [Google](http://google.com/ "Google") + than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or + [MSN](http://search.msn.com/ "MSN Search"). + +The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text. + +With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose. + + +<h3 id="em">Emphasis</h3> + +Markdown treats asterisks (`*`) and underscores (`_`) as indicators of +emphasis. Text wrapped with one `*` or `_` will be wrapped with an +HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML +`<strong>` tag. E.g., this input: + + *single asterisks* + + _single underscores_ + + **double asterisks** + + __double underscores__ + +will produce: + + <em>single asterisks</em> + + <em>single underscores</em> + + <strong>double asterisks</strong> + + <strong>double underscores</strong> + +You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span. + +Emphasis can be used in the middle of a word: + + un*fucking*believable + +But if you surround an `*` or `_` with spaces, it'll be treated as a +literal asterisk or underscore. + +To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it: + + \*this text is surrounded by literal asterisks\* + + + +<h3 id="code">Code</h3> + +To indicate a span of code, wrap it with backtick quotes (`` ` ``). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example: + + Use the `printf()` function. + +will produce: + + <p>Use the <code>printf()</code> function.</p> + +To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters: + + ``There is a literal backtick (`) here.`` + +which will produce this: + + <p><code>There is a literal backtick (`) here.</code></p> + +The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span: + + A single backtick in a code span: `` ` `` + + A backtick-delimited string in a code span: `` `foo` `` + +will produce: + + <p>A single backtick in a code span: <code>`</code></p> + + <p>A backtick-delimited string in a code span: <code>`foo`</code></p> + +With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this: + + Please don't use any `<blink>` tags. + +into: + + <p>Please don't use any <code><blink></code> tags.</p> + +You can write this: + + `—` is the decimal-encoded equivalent of `—`. + +to produce: + + <p><code>&#8212;</code> is the decimal-encoded + equivalent of <code>&mdash;</code>.</p> + + + +<h3 id="img">Images</h3> + +Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format. + +Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: *inline* and *reference*. + +Inline image syntax looks like this: + +  + +  + +That is: + +* An exclamation mark: `!`; +* followed by a set of square brackets, containing the `alt` + attribute text for the image; +* followed by a set of parentheses, containing the URL or path to + the image, and an optional `title` attribute enclosed in double + or single quotes. + +Reference-style image syntax looks like this: + + ![Alt text][id] + +Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references: + + [id]: url/to/image "Optional title attribute" + +As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML `<img>` tags. + + +* * * + + +<h2 id="misc">Miscellaneous</h2> + +<h3 id="autolink">Automatic Links</h3> + +Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: + + <http://example.com/> + +Markdown will turn this into: + + <a href="http://example.com/">http://example.com/</a> + +Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this: + + <address@example.com> + +into something like this: + + <a href="mailto:addre + ss@example.co + m">address@exa + mple.com</a> + +which will render in a browser as a clickable link to "address@example.com". + +(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.) + + + +<h3 id="backslash">Backslash Escapes</h3> + +Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML `<em>` tag), you can backslashes +before the asterisks, like this: + + \*literal asterisks\* + +Markdown provides backslash escapes for the following characters: + + \ backslash + ` backtick + * asterisk + _ underscore + {} curly braces + [] square brackets + () parentheses + # hash mark + + plus sign + - minus sign (hyphen) + . dot + ! exclamation mark + diff --git a/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.xhtml new file mode 100644 index 0000000..5c01306 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.xhtml @@ -0,0 +1,942 @@ +<h1>Markdown: Syntax</h1> + +<ul id="ProjectSubmenu"> + <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li> + <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li> + <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li> + <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li> + <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li> +</ul> + +<ul> +<li><a href="#overview">Overview</a> +<ul> +<li><a href="#philosophy">Philosophy</a></li> +<li><a href="#html">Inline HTML</a></li> +<li><a href="#autoescape">Automatic Escaping for Special Characters</a></li> +</ul></li> +<li><a href="#block">Block Elements</a> +<ul> +<li><a href="#p">Paragraphs and Line Breaks</a></li> +<li><a href="#header">Headers</a></li> +<li><a href="#blockquote">Blockquotes</a></li> +<li><a href="#list">Lists</a></li> +<li><a href="#precode">Code Blocks</a></li> +<li><a href="#hr">Horizontal Rules</a></li> +</ul></li> +<li><a href="#span">Span Elements</a> +<ul> +<li><a href="#link">Links</a></li> +<li><a href="#em">Emphasis</a></li> +<li><a href="#code">Code</a></li> +<li><a href="#img">Images</a></li> +</ul></li> +<li><a href="#misc">Miscellaneous</a> +<ul> +<li><a href="#backslash">Backslash Escapes</a></li> +<li><a href="#autolink">Automatic Links</a></li> +</ul></li> +</ul> + +<p><strong>Note:</strong> This document is itself written using Markdown; you +can <a href="/projects/markdown/syntax.text">see the source for it by adding '.text' to the URL</a>.</p> + +<hr /> + +<h2 id="overview">Overview</h2> + +<h3 id="philosophy">Philosophy</h3> + +<p>Markdown is intended to be as easy-to-read and easy-to-write as is feasible.</p> + +<p>Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including <a href="http://docutils.sourceforge.net/mirror/setext.html">Setext</a>, <a href="http://www.aaronsw.com/2002/atx/">atx</a>, <a href="http://textism.com/tools/textile/">Textile</a>, <a href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>, +<a href="http://www.triptico.com/software/grutatxt.html">Grutatext</a>, and <a href="http://ettext.taint.org/doc/">EtText</a> -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email.</p> + +<p>To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like *emphasis*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email.</p> + +<h3 id="html">Inline HTML</h3> + +<p>Markdown's syntax is intended for one purpose: to be used as a +format for <em>writing</em> for the web.</p> + +<p>Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is <em>not</em> to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a <em>publishing</em> format; Markdown is a <em>writing</em> +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text.</p> + +<p>For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags.</p> + +<p>The only restrictions are that block-level HTML elements -- e.g. <code><div></code>, +<code><table></code>, <code><pre></code>, <code><p></code>, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) <code><p></code> tags around HTML block-level tags.</p> + +<p>For example, to add an HTML table to a Markdown article:</p> + +<pre><code>This is a regular paragraph. + +<table> + <tr> + <td>Foo</td> + </tr> +</table> + +This is another regular paragraph. +</code></pre> + +<p>Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style <code>*emphasis*</code> inside an +HTML block.</p> + +<p>Span-level HTML tags -- e.g. <code><span></code>, <code><cite></code>, or <code><del></code> -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML <code><a></code> or <code><img></code> tags instead of Markdown's +link or image syntax, go right ahead.</p> + +<p>Unlike block-level HTML tags, Markdown syntax <em>is</em> processed within +span-level tags.</p> + +<h3 id="autoescape">Automatic Escaping for Special Characters</h3> + +<p>In HTML, there are two characters that demand special treatment: <code><</code> +and <code>&</code>. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. <code>&lt;</code>, and +<code>&amp;</code>.</p> + +<p>Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write '<code>AT&amp;T</code>'. You even need to +escape ampersands within URLs. Thus, if you want to link to:</p> + +<pre><code>http://images.google.com/images?num=30&q=larry+bird +</code></pre> + +<p>you need to encode the URL as:</p> + +<pre><code>http://images.google.com/images?num=30&amp;q=larry+bird +</code></pre> + +<p>in your anchor tag <code>href</code> attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites.</p> + +<p>Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into <code>&amp;</code>.</p> + +<p>So, if you want to include a copyright symbol in your article, you can write:</p> + +<pre><code>&copy; +</code></pre> + +<p>and Markdown will leave it alone. But if you write:</p> + +<pre><code>AT&T +</code></pre> + +<p>Markdown will translate it to:</p> + +<pre><code>AT&amp;T +</code></pre> + +<p>Similarly, because Markdown supports <a href="#html">inline HTML</a>, if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write:</p> + +<pre><code>4 < 5 +</code></pre> + +<p>Markdown will translate it to:</p> + +<pre><code>4 &lt; 5 +</code></pre> + +<p>However, inside Markdown code spans and blocks, angle brackets and +ampersands are <em>always</em> encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single <code><</code> +and <code>&</code> in your example code needs to be escaped.)</p> + +<hr /> + +<h2 id="block">Block Elements</h2> + +<h3 id="p">Paragraphs and Line Breaks</h3> + +<p>A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs.</p> + +<p>The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a <code><br /></code> tag.</p> + +<p>When you <em>do</em> want to insert a <code><br /></code> break tag using Markdown, you +end a line with two or more spaces, then type return.</p> + +<p>Yes, this takes a tad more effort to create a <code><br /></code>, but a simplistic +"every line break is a <code><br /></code>" rule wouldn't work for Markdown. +Markdown's email-style <a href="#blockquote">blockquoting</a> and multi-paragraph <a href="#list">list items</a> +work best -- and look better -- when you format them with hard breaks.</p> + +<h3 id="header">Headers</h3> + +<p>Markdown supports two styles of headers, <a href="http://docutils.sourceforge.net/mirror/setext.html">Setext</a> and <a href="http://www.aaronsw.com/2002/atx/">atx</a>.</p> + +<p>Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example:</p> + +<pre><code>This is an H1 +============= + +This is an H2 +------------- +</code></pre> + +<p>Any number of underlining <code>=</code>'s or <code>-</code>'s will work.</p> + +<p>Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example:</p> + +<pre><code># This is an H1 + +## This is an H2 + +###### This is an H6 +</code></pre> + +<p>Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) :</p> + +<pre><code># This is an H1 # + +## This is an H2 ## + +### This is an H3 ###### +</code></pre> + +<h3 id="blockquote">Blockquotes</h3> + +<p>Markdown uses email-style <code>></code> characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a <code>></code> before every line:</p> + +<pre><code>> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, +> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. +> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. +> +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse +> id sem consectetuer libero luctus adipiscing. +</code></pre> + +<p>Markdown allows you to be lazy and only put the <code>></code> before the first +line of a hard-wrapped paragraph:</p> + +<pre><code>> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, +consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. +Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse +id sem consectetuer libero luctus adipiscing. +</code></pre> + +<p>Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of <code>></code>:</p> + +<pre><code>> This is the first level of quoting. +> +> > This is nested blockquote. +> +> Back to the first level. +</code></pre> + +<p>Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks:</p> + +<pre><code>> ## This is a header. +> +> 1. This is the first list item. +> 2. This is the second list item. +> +> Here's some example code: +> +> return shell_exec("echo $input | $markdown_script"); +</code></pre> + +<p>Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu.</p> + +<h3 id="list">Lists</h3> + +<p>Markdown supports ordered (numbered) and unordered (bulleted) lists.</p> + +<p>Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers:</p> + +<pre><code>* Red +* Green +* Blue +</code></pre> + +<p>is equivalent to:</p> + +<pre><code>+ Red ++ Green ++ Blue +</code></pre> + +<p>and:</p> + +<pre><code>- Red +- Green +- Blue +</code></pre> + +<p>Ordered lists use numbers followed by periods:</p> + +<pre><code>1. Bird +2. McHale +3. Parish +</code></pre> + +<p>It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is:</p> + +<pre><code><ol> +<li>Bird</li> +<li>McHale</li> +<li>Parish</li> +</ol> +</code></pre> + +<p>If you instead wrote the list in Markdown like this:</p> + +<pre><code>1. Bird +1. McHale +1. Parish +</code></pre> + +<p>or even:</p> + +<pre><code>3. Bird +1. McHale +8. Parish +</code></pre> + +<p>you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to.</p> + +<p>If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number.</p> + +<p>List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab.</p> + +<p>To make lists look nice, you can wrap items with hanging indents:</p> + +<pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. +* Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. +</code></pre> + +<p>But if you want to be lazy, you don't have to:</p> + +<pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit. +Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, +viverra nec, fringilla in, laoreet vitae, risus. +* Donec sit amet nisl. Aliquam semper ipsum sit amet velit. +Suspendisse id sem consectetuer libero luctus adipiscing. +</code></pre> + +<p>If list items are separated by blank lines, Markdown will wrap the +items in <code><p></code> tags in the HTML output. For example, this input:</p> + +<pre><code>* Bird +* Magic +</code></pre> + +<p>will turn into:</p> + +<pre><code><ul> +<li>Bird</li> +<li>Magic</li> +</ul> +</code></pre> + +<p>But this:</p> + +<pre><code>* Bird + +* Magic +</code></pre> + +<p>will turn into:</p> + +<pre><code><ul> +<li><p>Bird</p></li> +<li><p>Magic</p></li> +</ul> +</code></pre> + +<p>List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be intended by either 4 spaces +or one tab:</p> + +<pre><code>1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + +2. Suspendisse id sem consectetuer libero luctus adipiscing. +</code></pre> + +<p>It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy:</p> + +<pre><code>* This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're +only required to indent the first line. Lorem ipsum dolor +sit amet, consectetuer adipiscing elit. + +* Another item in the same list. +</code></pre> + +<p>To put a blockquote within a list item, the blockquote's <code>></code> +delimiters need to be indented:</p> + +<pre><code>* A list item with a blockquote: + + > This is a blockquote + > inside a list item. +</code></pre> + +<p>To put a code block within a list item, the code block needs +to be indented <em>twice</em> -- 8 spaces or two tabs:</p> + +<pre><code>* A list item with a code block: + + <code goes here> +</code></pre> + +<p>It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this:</p> + +<pre><code>1986. What a great season. +</code></pre> + +<p>In other words, a <em>number-period-space</em> sequence at the beginning of a +line. To avoid this, you can backslash-escape the period:</p> + +<pre><code>1986\. What a great season. +</code></pre> + +<h3 id="precode">Code Blocks</h3> + +<p>Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both <code><pre></code> and <code><code></code> tags.</p> + +<p>To produce a code block in Markdown, simply indent every line of the +block by at least 4 spaces or 1 tab. For example, given this input:</p> + +<pre><code>This is a normal paragraph: + + This is a code block. +</code></pre> + +<p>Markdown will generate:</p> + +<pre><code><p>This is a normal paragraph:</p> + +<pre><code>This is a code block. +</code></pre> +</code></pre> + +<p>One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this:</p> + +<pre><code>Here is an example of AppleScript: + + tell application "Foo" + beep + end tell +</code></pre> + +<p>will turn into:</p> + +<pre><code><p>Here is an example of AppleScript:</p> + +<pre><code>tell application "Foo" + beep +end tell +</code></pre> +</code></pre> + +<p>A code block continues until it reaches a line that is not indented +(or the end of the article).</p> + +<p>Within a code block, ampersands (<code>&</code>) and angle brackets (<code><</code> and <code>></code>) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this:</p> + +<pre><code> <div class="footer"> + &copy; 2004 Foo Corporation + </div> +</code></pre> + +<p>will turn into:</p> + +<pre><code><pre><code>&lt;div class="footer"&gt; + &amp;copy; 2004 Foo Corporation +&lt;/div&gt; +</code></pre> +</code></pre> + +<p>Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax.</p> + +<h3 id="hr">Horizontal Rules</h3> + +<p>You can produce a horizontal rule tag (<code><hr /></code>) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule:</p> + +<pre><code>* * * + +*** + +***** + +- - - + +--------------------------------------- + +_ _ _ +</code></pre> + +<hr /> + +<h2 id="span">Span Elements</h2> + +<h3 id="link">Links</h3> + +<p>Markdown supports two style of links: <em>inline</em> and <em>reference</em>.</p> + +<p>In both styles, the link text is delimited by [square brackets].</p> + +<p>To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an <em>optional</em> +title for the link, surrounded in quotes. For example:</p> + +<pre><code>This is [an example](http://example.com/ "Title") inline link. + +[This link](http://example.net/) has no title attribute. +</code></pre> + +<p>Will produce:</p> + +<pre><code><p>This is <a href="http://example.com/" title="Title"> +an example</a> inline link.</p> + +<p><a href="http://example.net/">This link</a> has no +title attribute.</p> +</code></pre> + +<p>If you're referring to a local resource on the same server, you can +use relative paths:</p> + +<pre><code>See my [About](/about/) page for details. +</code></pre> + +<p>Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link:</p> + +<pre><code>This is [an example][id] reference-style link. +</code></pre> + +<p>You can optionally use a space to separate the sets of brackets:</p> + +<pre><code>This is [an example] [id] reference-style link. +</code></pre> + +<p>Then, anywhere in the document, you define your link label like this, +on a line by itself:</p> + +<pre><code>[id]: http://example.com/ "Optional Title Here" +</code></pre> + +<p>That is:</p> + +<ul> +<li>Square brackets containing the link identifier (optionally +indented from the left margin using up to three spaces);</li> +<li>followed by a colon;</li> +<li>followed by one or more spaces (or tabs);</li> +<li>followed by the URL for the link;</li> +<li>optionally followed by a title attribute for the link, enclosed +in double or single quotes.</li> +</ul> + +<p>The link URL may, optionally, be surrounded by angle brackets:</p> + +<pre><code>[id]: <http://example.com/> "Optional Title Here" +</code></pre> + +<p>You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs:</p> + +<pre><code>[id]: http://example.com/longish/path/to/resource/here + "Optional Title Here" +</code></pre> + +<p>Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output.</p> + +<p>Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are <em>not</em> case sensitive. E.g. these two links:</p> + +<pre><code>[link text][a] +[link text][A] +</code></pre> + +<p>are equivalent.</p> + +<p>The <em>implicit link name</em> shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write:</p> + +<pre><code>[Google][] +</code></pre> + +<p>And then define the link:</p> + +<pre><code>[Google]: http://google.com/ +</code></pre> + +<p>Because link names may contain spaces, this shortcut even works for +multiple words in the link text:</p> + +<pre><code>Visit [Daring Fireball][] for more information. +</code></pre> + +<p>And then define the link:</p> + +<pre><code>[Daring Fireball]: http://daringfireball.net/ +</code></pre> + +<p>Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes.</p> + +<p>Here's an example of reference links in action:</p> + +<pre><code>I get 10 times more traffic from [Google] [1] than from +[Yahoo] [2] or [MSN] [3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" +</code></pre> + +<p>Using the implicit link name shortcut, you could instead write:</p> + +<pre><code>I get 10 times more traffic from [Google][] than from +[Yahoo][] or [MSN][]. + + [google]: http://google.com/ "Google" + [yahoo]: http://search.yahoo.com/ "Yahoo Search" + [msn]: http://search.msn.com/ "MSN Search" +</code></pre> + +<p>Both of the above examples will produce the following HTML output:</p> + +<pre><code><p>I get 10 times more traffic from <a href="http://google.com/" +title="Google">Google</a> than from +<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a> +or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p> +</code></pre> + +<p>For comparison, here is the same paragraph written using +Markdown's inline link style:</p> + +<pre><code>I get 10 times more traffic from [Google](http://google.com/ "Google") +than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or +[MSN](http://search.msn.com/ "MSN Search"). +</code></pre> + +<p>The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text.</p> + +<p>With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose.</p> + +<h3 id="em">Emphasis</h3> + +<p>Markdown treats asterisks (<code>*</code>) and underscores (<code>_</code>) as indicators of +emphasis. Text wrapped with one <code>*</code> or <code>_</code> will be wrapped with an +HTML <code><em></code> tag; double <code>*</code>'s or <code>_</code>'s will be wrapped with an HTML +<code><strong></code> tag. E.g., this input:</p> + +<pre><code>*single asterisks* + +_single underscores_ + +**double asterisks** + +__double underscores__ +</code></pre> + +<p>will produce:</p> + +<pre><code><em>single asterisks</em> + +<em>single underscores</em> + +<strong>double asterisks</strong> + +<strong>double underscores</strong> +</code></pre> + +<p>You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span.</p> + +<p>Emphasis can be used in the middle of a word:</p> + +<pre><code>un*fucking*believable +</code></pre> + +<p>But if you surround an <code>*</code> or <code>_</code> with spaces, it'll be treated as a +literal asterisk or underscore.</p> + +<p>To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it:</p> + +<pre><code>\*this text is surrounded by literal asterisks\* +</code></pre> + +<h3 id="code">Code</h3> + +<p>To indicate a span of code, wrap it with backtick quotes (<code>`</code>). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example:</p> + +<pre><code>Use the `printf()` function. +</code></pre> + +<p>will produce:</p> + +<pre><code><p>Use the <code>printf()</code> function.</p> +</code></pre> + +<p>To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters:</p> + +<pre><code>``There is a literal backtick (`) here.`` +</code></pre> + +<p>which will produce this:</p> + +<pre><code><p><code>There is a literal backtick (`) here.</code></p> +</code></pre> + +<p>The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span:</p> + +<pre><code>A single backtick in a code span: `` ` `` + +A backtick-delimited string in a code span: `` `foo` `` +</code></pre> + +<p>will produce:</p> + +<pre><code><p>A single backtick in a code span: <code>`</code></p> + +<p>A backtick-delimited string in a code span: <code>`foo`</code></p> +</code></pre> + +<p>With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this:</p> + +<pre><code>Please don't use any `<blink>` tags. +</code></pre> + +<p>into:</p> + +<pre><code><p>Please don't use any <code>&lt;blink&gt;</code> tags.</p> +</code></pre> + +<p>You can write this:</p> + +<pre><code>`&#8212;` is the decimal-encoded equivalent of `&mdash;`. +</code></pre> + +<p>to produce:</p> + +<pre><code><p><code>&amp;#8212;</code> is the decimal-encoded +equivalent of <code>&amp;mdash;</code>.</p> +</code></pre> + +<h3 id="img">Images</h3> + +<p>Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format.</p> + +<p>Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: <em>inline</em> and <em>reference</em>.</p> + +<p>Inline image syntax looks like this:</p> + +<pre><code> + + +</code></pre> + +<p>That is:</p> + +<ul> +<li>An exclamation mark: <code>!</code>;</li> +<li>followed by a set of square brackets, containing the <code>alt</code> +attribute text for the image;</li> +<li>followed by a set of parentheses, containing the URL or path to +the image, and an optional <code>title</code> attribute enclosed in double +or single quotes.</li> +</ul> + +<p>Reference-style image syntax looks like this:</p> + +<pre><code>![Alt text][id] +</code></pre> + +<p>Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references:</p> + +<pre><code>[id]: url/to/image "Optional title attribute" +</code></pre> + +<p>As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML <code><img></code> tags.</p> + +<hr /> + +<h2 id="misc">Miscellaneous</h2> + +<h3 id="autolink">Automatic Links</h3> + +<p>Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:</p> + +<pre><code><http://example.com/> +</code></pre> + +<p>Markdown will turn this into:</p> + +<pre><code><a href="http://example.com/">http://example.com/</a> +</code></pre> + +<p>Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this:</p> + +<pre><code><address@example.com> +</code></pre> + +<p>into something like this:</p> + +<pre><code><a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65; +&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111; +&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61; +&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a> +</code></pre> + +<p>which will render in a browser as a clickable link to "address@example.com".</p> + +<p>(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.)</p> + +<h3 id="backslash">Backslash Escapes</h3> + +<p>Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML <code><em></code> tag), you can backslashes +before the asterisks, like this:</p> + +<pre><code>\*literal asterisks\* +</code></pre> + +<p>Markdown provides backslash escapes for the following characters:</p> + +<pre><code>\ backslash +` backtick +* asterisk +_ underscore +{} curly braces +[] square brackets +() parentheses +# hash mark ++ plus sign +- minus sign (hyphen) +. dot +! exclamation mark +</code></pre> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.text b/t/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.text new file mode 100644 index 0000000..ed3c624 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.text @@ -0,0 +1,5 @@ +> foo +> +> > bar +> +> foo diff --git a/t/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.xhtml new file mode 100644 index 0000000..d8ec7f8 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.xhtml @@ -0,0 +1,9 @@ +<blockquote> + <p>foo</p> + + <blockquote> + <p>bar</p> + </blockquote> + + <p>foo</p> +</blockquote> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.text b/t/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.text new file mode 100644 index 0000000..7f3b497 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.text @@ -0,0 +1,131 @@ +## Unordered + +Asterisks tight: + +* asterisk 1 +* asterisk 2 +* asterisk 3 + + +Asterisks loose: + +* asterisk 1 + +* asterisk 2 + +* asterisk 3 + +* * * + +Pluses tight: + ++ Plus 1 ++ Plus 2 ++ Plus 3 + + +Pluses loose: + ++ Plus 1 + ++ Plus 2 + ++ Plus 3 + +* * * + + +Minuses tight: + +- Minus 1 +- Minus 2 +- Minus 3 + + +Minuses loose: + +- Minus 1 + +- Minus 2 + +- Minus 3 + + +## Ordered + +Tight: + +1. First +2. Second +3. Third + +and: + +1. One +2. Two +3. Three + + +Loose using tabs: + +1. First + +2. Second + +3. Third + +and using spaces: + +1. One + +2. Two + +3. Three + +Multiple paragraphs: + +1. Item 1, graf one. + + Item 2. graf two. The quick brown fox jumped over the lazy dog's + back. + +2. Item 2. + +3. Item 3. + + + +## Nested + +* Tab + * Tab + * Tab + +Here's another: + +1. First +2. Second: + * Fee + * Fie + * Foe +3. Third + +Same thing but with paragraphs: + +1. First + +2. Second: + * Fee + * Fie + * Foe + +3. Third + + +This was an error in Markdown 1.0.1: + +* this + + * sub + + that diff --git a/t/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.xhtml new file mode 100644 index 0000000..ba71eab --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.xhtml @@ -0,0 +1,148 @@ +<h2>Unordered</h2> + +<p>Asterisks tight:</p> + +<ul> +<li>asterisk 1</li> +<li>asterisk 2</li> +<li>asterisk 3</li> +</ul> + +<p>Asterisks loose:</p> + +<ul> +<li><p>asterisk 1</p></li> +<li><p>asterisk 2</p></li> +<li><p>asterisk 3</p></li> +</ul> + +<hr /> + +<p>Pluses tight:</p> + +<ul> +<li>Plus 1</li> +<li>Plus 2</li> +<li>Plus 3</li> +</ul> + +<p>Pluses loose:</p> + +<ul> +<li><p>Plus 1</p></li> +<li><p>Plus 2</p></li> +<li><p>Plus 3</p></li> +</ul> + +<hr /> + +<p>Minuses tight:</p> + +<ul> +<li>Minus 1</li> +<li>Minus 2</li> +<li>Minus 3</li> +</ul> + +<p>Minuses loose:</p> + +<ul> +<li><p>Minus 1</p></li> +<li><p>Minus 2</p></li> +<li><p>Minus 3</p></li> +</ul> + +<h2>Ordered</h2> + +<p>Tight:</p> + +<ol> +<li>First</li> +<li>Second</li> +<li>Third</li> +</ol> + +<p>and:</p> + +<ol> +<li>One</li> +<li>Two</li> +<li>Three</li> +</ol> + +<p>Loose using tabs:</p> + +<ol> +<li><p>First</p></li> +<li><p>Second</p></li> +<li><p>Third</p></li> +</ol> + +<p>and using spaces:</p> + +<ol> +<li><p>One</p></li> +<li><p>Two</p></li> +<li><p>Three</p></li> +</ol> + +<p>Multiple paragraphs:</p> + +<ol> +<li><p>Item 1, graf one.</p> + +<p>Item 2. graf two. The quick brown fox jumped over the lazy dog's +back.</p></li> +<li><p>Item 2.</p></li> +<li><p>Item 3.</p></li> +</ol> + +<h2>Nested</h2> + +<ul> +<li>Tab +<ul> +<li>Tab +<ul> +<li>Tab</li> +</ul></li> +</ul></li> +</ul> + +<p>Here's another:</p> + +<ol> +<li>First</li> +<li>Second: +<ul> +<li>Fee</li> +<li>Fie</li> +<li>Foe</li> +</ul></li> +<li>Third</li> +</ol> + +<p>Same thing but with paragraphs:</p> + +<ol> +<li><p>First</p></li> +<li><p>Second:</p> + +<ul> +<li>Fee</li> +<li>Fie</li> +<li>Foe</li> +</ul></li> +<li><p>Third</p></li> +</ol> + + +<p>This was an error in Markdown 1.0.1:</p> + +<ul> +<li><p>this</p> + +<ul><li>sub</li></ul> + +<p>that</p></li> +</ul> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.text b/t/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.text new file mode 100644 index 0000000..95ee690 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.text @@ -0,0 +1,7 @@ +***This is strong and em.*** + +So is ***this*** word. + +___This is strong and em.___ + +So is ___this___ word. diff --git a/t/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.xhtml new file mode 100644 index 0000000..71ec78c --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.xhtml @@ -0,0 +1,7 @@ +<p><strong><em>This is strong and em.</em></strong></p> + +<p>So is <strong><em>this</em></strong> word.</p> + +<p><strong><em>This is strong and em.</em></strong></p> + +<p>So is <strong><em>this</em></strong> word.</p> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Tabs.text b/t/Markdown-from-MDTest1.1.mdtest/Tabs.text new file mode 100644 index 0000000..589d113 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Tabs.text @@ -0,0 +1,21 @@ ++ this is a list item + indented with tabs + ++ this is a list item + indented with spaces + +Code: + + this code block is indented by one tab + +And: + + this code block is indented by two tabs + +And: + + + this is an example list item + indented with tabs + + + this is an example list item + indented with spaces diff --git a/t/Markdown-from-MDTest1.1.mdtest/Tabs.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Tabs.xhtml new file mode 100644 index 0000000..3301ba8 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Tabs.xhtml @@ -0,0 +1,25 @@ +<ul> +<li><p>this is a list item +indented with tabs</p></li> +<li><p>this is a list item +indented with spaces</p></li> +</ul> + +<p>Code:</p> + +<pre><code>this code block is indented by one tab +</code></pre> + +<p>And:</p> + +<pre><code> this code block is indented by two tabs +</code></pre> + +<p>And:</p> + +<pre><code>+ this is an example list item + indented with tabs + ++ this is an example list item + indented with spaces +</code></pre> diff --git a/t/Markdown-from-MDTest1.1.mdtest/Tidyness.text b/t/Markdown-from-MDTest1.1.mdtest/Tidyness.text new file mode 100644 index 0000000..5f18b8d --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Tidyness.text @@ -0,0 +1,5 @@ +> A list within a blockquote: +> +> * asterisk 1 +> * asterisk 2 +> * asterisk 3 diff --git a/t/Markdown-from-MDTest1.1.mdtest/Tidyness.xhtml b/t/Markdown-from-MDTest1.1.mdtest/Tidyness.xhtml new file mode 100644 index 0000000..f2a8ce7 --- /dev/null +++ b/t/Markdown-from-MDTest1.1.mdtest/Tidyness.xhtml @@ -0,0 +1,8 @@ +<blockquote> +<p>A list within a blockquote:</p> +<ul> +<li>asterisk 1</li> +<li>asterisk 2</li> +<li>asterisk 3</li> +</ul> +</blockquote> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.text new file mode 100644 index 0000000..a5e769b --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.text @@ -0,0 +1 @@ +Tricky combinaisons:
backslash with \\-- two dashes
backslash with \\> greater than
\\\[test](not a link)
\\\*no emphasis*
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.xhtml new file mode 100644 index 0000000..08fb8ef --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.xhtml @@ -0,0 +1 @@ +<p>Tricky combinaisons:</p>
<p>backslash with \-- two dashes</p>
<p>backslash with \> greater than</p>
<p>\[test](not a link)</p>
<p>\*no emphasis*</p>
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.text new file mode 100644 index 0000000..43f2bcf --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.text @@ -0,0 +1,6 @@ +From `<!--` to `-->` +on two lines. + +From `<!--` +to `-->` +on three lines. diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.xhtml new file mode 100644 index 0000000..9ed0df8 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.xhtml @@ -0,0 +1,6 @@ +<p>From <code><!--</code> to <code>--></code> +on two lines.</p> + +<p>From <code><!--</code> +to <code>--></code> +on three lines.</p> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.text new file mode 100644 index 0000000..3fa24c3 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.text @@ -0,0 +1,8 @@ + +* List Item: + + code block + + with a blank line + + within a list item.
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.xhtml new file mode 100644 index 0000000..7d57b1e --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.xhtml @@ -0,0 +1,10 @@ +<ul> +<li><p>List Item:</p> + +<pre><code>code block + +with a blank line +</code></pre> + +<p>within a list item.</p></li> +</ul>
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.text new file mode 100644 index 0000000..a8af4ec --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.text @@ -0,0 +1,3 @@ +<michel.fortin@michelf.com> + +International domain names: <help@tūdaliņ.lv>
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.xhtml new file mode 100644 index 0000000..a32c408 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.xhtml @@ -0,0 +1,3 @@ +<p><a href="mailto:michel.fortin@michelf.com">michel.fortin@michelf.com</a></p> + +<p>International domain names: <a href="mailto:help@tūdaliņ.lv">help@tūdaliņ.lv</a></p> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.text new file mode 100644 index 0000000..ec48dec --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.text @@ -0,0 +1,69 @@ +Combined emphasis: + +1. ***test test*** +2. ___test test___ +3. *test **test*** +4. **test *test*** +5. ***test* test** +6. ***test** test* +7. ***test* test** +8. **test *test*** +9. *test **test*** +10. _test __test___ +11. __test _test___ +12. ___test_ test__ +13. ___test__ test_ +14. ___test_ test__ +15. __test _test___ +16. _test __test___ + + +Incorrect nesting: + +1. *test **test* test** +2. _test __test_ test__ +3. **test *test** test* +4. __test _test__ test_ +5. *test *test* test* +6. _test _test_ test_ +7. **test **test** test** +8. __test __test__ test__ + + + +No emphasis: + +1. test* test *test +2. test** test **test +3. test_ test _test +4. test__ test __test + + + +Middle-word emphasis (asterisks): + +1. *a*b +2. a*b* +3. a*b*c +4. **a**b +5. a**b** +6. a**b**c + + +Middle-word emphasis (underscore): + +1. _a_b +2. a_b_ +3. a_b_c +4. __a__b +5. a__b__ +6. a__b__c + +my_precious_file.txt + + +## Tricky Cases + +E**. **Test** TestTestTest + +E**. **Test** Test Test Test diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.xhtml new file mode 100644 index 0000000..7399132 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.xhtml @@ -0,0 +1,72 @@ +<p>Combined emphasis:</p> + +<ol> +<li><strong><em>test test</em></strong></li> +<li><strong><em>test test</em></strong></li> +<li><em>test <strong>test</strong></em></li> +<li><strong>test <em>test</em></strong></li> +<li><strong><em>test</em> test</strong></li> +<li><em><strong>test</strong> test</em></li> +<li><strong><em>test</em> test</strong></li> +<li><strong>test <em>test</em></strong></li> +<li><em>test <strong>test</strong></em></li> +<li><em>test <strong>test</strong></em></li> +<li><strong>test <em>test</em></strong></li> +<li><strong><em>test</em> test</strong></li> +<li><em><strong>test</strong> test</em></li> +<li><strong><em>test</em> test</strong></li> +<li><strong>test <em>test</em></strong></li> +<li><em>test <strong>test</strong></em></li> +</ol> + +<p>Incorrect nesting:</p> + +<ol> +<li>*test <strong>test* test</strong></li> +<li>_test <strong>test_ test</strong></li> +<li>**test <em>test</em>* test*</li> +<li>__test <em>test</em>_ test_</li> +<li><em>test *test</em> test*</li> +<li><em>test _test</em> test_</li> +<li><strong>test <strong>test</strong> test</strong></li> +<li><strong>test <strong>test</strong> test</strong></li> +</ol> + +<p>No emphasis:</p> + +<ol> +<li>test* test *test</li> +<li>test** test **test</li> +<li>test_ test _test</li> +<li>test__ test __test</li> +</ol> + +<p>Middle-word emphasis (asterisks):</p> + +<ol> +<li><em>a</em>b</li> +<li>a<em>b</em></li> +<li>a<em>b</em>c</li> +<li><strong>a</strong>b</li> +<li>a<strong>b</strong></li> +<li>a<strong>b</strong>c</li> +</ol> + +<p>Middle-word emphasis (underscore):</p> + +<ol> +<li><em>a</em>b</li> +<li>a<em>b</em></li> +<li>a<em>b</em>c</li> +<li><strong>a</strong>b</li> +<li>a<strong>b</strong></li> +<li>a<strong>b</strong>c</li> +</ol> + +<p>my<em>precious</em>file.txt</p> + +<h2>Tricky Cases</h2> + +<p>E**. <strong>Test</strong> TestTestTest</p> + +<p>E**. <strong>Test</strong> Test Test Test</p> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Headers.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Headers.text new file mode 100644 index 0000000..3a39174 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Headers.text @@ -0,0 +1,9 @@ +Header
======
Header
------
### Header + + - - - + +Header
======
Paragraph
Header
------
Paragraph
### Header
Paragraph + + - - - + +Paragraph
Header
======
Paragraph
Paragraph
Header
------
Paragraph
Paragraph
### Header
Paragraph
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Headers.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Headers.xhtml new file mode 100644 index 0000000..3adb470 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Headers.xhtml @@ -0,0 +1,39 @@ +<h1>Header</h1> + +<h2>Header</h2> + +<h3>Header</h3> + +<hr /> + +<h1>Header</h1> + +<p>Paragraph</p> + +<h2>Header</h2> + +<p>Paragraph</p> + +<h3>Header</h3> + +<p>Paragraph</p> + +<hr /> + +<p>Paragraph</p> + +<h1>Header</h1> + +<p>Paragraph</p> + +<p>Paragraph</p> + +<h2>Header</h2> + +<p>Paragraph</p> + +<p>Paragraph</p> + +<h3>Header</h3> + +<p>Paragraph</p> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.text new file mode 100644 index 0000000..8e2da0b --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.text @@ -0,0 +1,29 @@ +Horizontal rules: + +- - - + +* * * + +*** + +--- + +___ + +Not horizontal rules (testing for a bug in 1.0.1j): + ++++ + +,,, + +=== + +??? + +AAA + +jjj + +j j j + +n n n diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.xhtml new file mode 100644 index 0000000..b9170b1 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.xhtml @@ -0,0 +1,30 @@ +<p>Horizontal rules:</p> + +<hr /> + +<hr /> + +<hr /> + +<hr /> + +<hr /> + +<p>Not horizontal rules (testing for a bug in 1.0.1j):</p> + +<p>+++</p> + +<p>,,,</p> + +<p>===</p> + +<p>???</p> + +<p>AAA</p> + +<p>jjj</p> + +<p>j j j</p> + +<p>n n n</p> + diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).html b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).html new file mode 100644 index 0000000..facfefb --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).html @@ -0,0 +1,15 @@ +<p>With some attributes:</p> + +<div id="test"> + foo +</div> + +<div id="test" + class="nono"> + foo +</div> + +<p>Hr's:</p> + +<hr class="foo" + id="bar" >
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).text new file mode 100644 index 0000000..9177105 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).text @@ -0,0 +1,15 @@ +With some attributes: + +<div id="test"> + foo +</div> + +<div id="test" + class="nono"> + foo +</div> + +Hr's: + +<hr class="foo" + id="bar" > diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).text new file mode 100644 index 0000000..19028bb --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).text @@ -0,0 +1,4 @@ +<abbr title="` **Attribute Content Is Not A Code Span** `">ACINACS</abbr> + +<abbr title="`first backtick!">SB</abbr> +<abbr title="`second backtick!">SB</abbr>
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).xhtml new file mode 100644 index 0000000..4d18aff --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).xhtml @@ -0,0 +1,4 @@ +<p><abbr title="` **Attribute Content Is Not A Code Span** `">ACINACS</abbr></p> + +<p><abbr title="`first backtick!">SB</abbr> +<abbr title="`second backtick!">SB</abbr></p>
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.html b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.html new file mode 100644 index 0000000..b45f014 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.html @@ -0,0 +1,9 @@ +<p>Paragraph one.</p> + +<!-- double--dash (invalid SGML comment) --> + +<p>Paragraph two.</p> + +<!-- enclosed tag </div> --> + +<p>The end.</p> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.text new file mode 100644 index 0000000..d57d00a --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.text @@ -0,0 +1,9 @@ +Paragraph one. + +<!-- double--dash (invalid SGML comment) --> + +Paragraph two. + +<!-- enclosed tag </div> --> + +The end. diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.text new file mode 100644 index 0000000..2d54c66 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.text @@ -0,0 +1,17 @@ +Here is a block tag ins: + +<ins> +<p>Some text</p> +</ins> + +<ins>And here it is inside a paragraph.</ins> + +And here it is <ins>in the middle of</ins> a paragraph. + +<del> +<p>Some text</p> +</del> + +<del>And here is ins as a paragraph.</del> + +And here it is <del>in the middle of</del> a paragraph. diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.xhtml new file mode 100644 index 0000000..60e8c5f --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.xhtml @@ -0,0 +1,17 @@ +<p>Here is a block tag ins:</p> + +<ins> +<p>Some text</p> +</ins> + +<p><ins>And here it is inside a paragraph.</ins></p> + +<p>And here it is <ins>in the middle of</ins> a paragraph.</p> + +<del> +<p>Some text</p> +</del> + +<p><del>And here is ins as a paragraph.</del></p> + +<p>And here it is <del>in the middle of</del> a paragraph.</p> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.text new file mode 100644 index 0000000..600a044 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.text @@ -0,0 +1 @@ +[silly URL w/ angle brackets](<?}]*+|&)>). diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.xhtml new file mode 100644 index 0000000..d3e4d11 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.xhtml @@ -0,0 +1 @@ +<p><a href="?}]*+|&)">silly URL w/ angle brackets</a>.</p> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.text new file mode 100644 index 0000000..7e03221 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.text @@ -0,0 +1,11 @@ +# Character Escapes + +The MD5 value for `+` is "26b17225b626fb9238849fd60eabdf60". + +# HTML Blocks + +<p>test</p> + +The MD5 value for `<p>test</p>` is: + +6205333b793f34273d75379350b36826
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.xhtml new file mode 100644 index 0000000..894e4aa --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.xhtml @@ -0,0 +1,11 @@ +<h1>Character Escapes</h1> + +<p>The MD5 value for <code>+</code> is "26b17225b626fb9238849fd60eabdf60".</p> + +<h1>HTML Blocks</h1> + +<p>test</p> + +<p>The MD5 value for <code><p>test</p></code> is:</p> + +<p>6205333b793f34273d75379350b36826</p> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.text new file mode 100644 index 0000000..791538c --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.text @@ -0,0 +1,11 @@ +Valid nesting: + +**[Link](url)** + +[**Link**](url) + +**[**Link**](url)** + +Invalid nesting: + +[[Link](url)](url)
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.xhtml new file mode 100644 index 0000000..37845d3 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.xhtml @@ -0,0 +1,11 @@ +<p>Valid nesting:</p> + +<p><strong><a href="url">Link</a></strong></p> + +<p><a href="url"><strong>Link</strong></a></p> + +<p><strong><a href="url"><strong>Link</strong></a></strong></p> + +<p>Invalid nesting:</p> + +<p><a href="url">[Link](url)</a></p> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.text new file mode 100644 index 0000000..246b60d --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.text @@ -0,0 +1,22 @@ +This tests for a bug where quotes escaped by PHP when using +`preg_replace` with the `/e` modifier must be correctly unescaped +(hence the `_UnslashQuotes` function found only in PHP Markdown). + + + +Headers below should appear exactly as they are typed (no backslash +added or removed). + +Header "quoted\" again \\"" +=========================== + +Header "quoted\" again \\"" +--------------------------- + +### Header "quoted\" again \\"" ### + + + +Test with tabs for `_Detab`: + + Code 'block' with some "tabs" and "quotes" diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.xhtml new file mode 100644 index 0000000..c982417 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.xhtml @@ -0,0 +1,17 @@ +<p>This tests for a bug where quotes escaped by PHP when using +<code>preg_replace</code> with the <code>/e</code> modifier must be correctly unescaped +(hence the <code>_UnslashQuotes</code> function found only in PHP Markdown).</p> + +<p>Headers below should appear exactly as they are typed (no backslash +added or removed).</p> + +<h1>Header "quoted\" again \""</h1> + +<h2>Header "quoted\" again \""</h2> + +<h3>Header "quoted\" again \""</h3> + +<p>Test with tabs for <code>_Detab</code>:</p> + +<pre><code>Code 'block' with some "tabs" and "quotes" +</code></pre> diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.text new file mode 100644 index 0000000..bb7be4f --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.text @@ -0,0 +1,14 @@ +[Inline link 1 with parens](/url\(test\) "title"). + +[Inline link 2 with parens](</url\(test\)> "title"). + +[Inline link 3 with non-escaped parens](/url(test) "title"). + +[Inline link 4 with non-escaped parens](</url(test)> "title"). + +[Reference link 1 with parens][1]. + +[Reference link 2 with parens][2]. + + [1]: /url(test) "title" + [2]: </url(test)> "title" diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.xhtml new file mode 100644 index 0000000..a81aa02 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.xhtml @@ -0,0 +1,11 @@ +<p><a href="/url(test)" title="title">Inline link 1 with parens</a>.</p> + +<p><a href="/url(test)" title="title">Inline link 2 with parens</a>.</p> + +<p><a href="/url(test)" title="title">Inline link 3 with non-escaped parens</a>.</p> + +<p><a href="/url(test)" title="title">Inline link 4 with non-escaped parens</a>.</p> + +<p><a href="/url(test)" title="title">Reference link 1 with parens</a>.</p> + +<p><a href="/url(test)" title="title">Reference link 2 with parens</a>.</p>
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.text b/t/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.text new file mode 100644 index 0000000..ae4cdcb --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.text @@ -0,0 +1 @@ +Paragraph and no space:
* ciao
Paragraph and 1 space:
* ciao
Paragraph and 3 spaces:
* ciao
Paragraph and 4 spaces:
* ciao
Paragraph before header:
#Header
Paragraph before blockquote:
>Some quote.
\ No newline at end of file diff --git a/t/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.xhtml b/t/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.xhtml new file mode 100644 index 0000000..8655430 --- /dev/null +++ b/t/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.xhtml @@ -0,0 +1,21 @@ +<p>Paragraph and no space: +* ciao</p> + +<p>Paragraph and 1 space: + * ciao</p> + +<p>Paragraph and 3 spaces: + * ciao</p> + +<p>Paragraph and 4 spaces: + * ciao</p> + +<p>Paragraph before header:</p> + +<h1>Header</h1> + +<p>Paragraph before blockquote:</p> + +<blockquote> + <p>Some quote.</p> +</blockquote> diff --git a/t/Text-Markdown.mdtest/CoreDumps5.8.text b/t/Text-Markdown.mdtest/CoreDumps5.8.text new file mode 100644 index 0000000..30ce312 --- /dev/null +++ b/t/Text-Markdown.mdtest/CoreDumps5.8.text @@ -0,0 +1,7 @@ +* Unordered +1. Ordered + +Text + +* Unordered +1. Ordered diff --git a/t/Text-Markdown.mdtest/CoreDumps5.8.xhtml b/t/Text-Markdown.mdtest/CoreDumps5.8.xhtml new file mode 100644 index 0000000..8a2963e --- /dev/null +++ b/t/Text-Markdown.mdtest/CoreDumps5.8.xhtml @@ -0,0 +1,15 @@ +<ul> +<li>Unordered +<ol> +<li>Ordered</li> +</ol></li> +</ul> + +<p>Text</p> + +<ul> +<li>Unordered +<ol> +<li>Ordered</li> +</ol></li> +</ul> diff --git a/t/Text-Markdown.mdtest/Emphasis.text b/t/Text-Markdown.mdtest/Emphasis.text new file mode 100644 index 0000000..104f90e --- /dev/null +++ b/t/Text-Markdown.mdtest/Emphasis.text @@ -0,0 +1,4 @@ +_M*A*S*H_ here I am going with original Markdown.. + +foo_bar_bas I am going with PHP Markdown Extra here (by default, there is an option for original style behavior - see +docs).. diff --git a/t/Text-Markdown.mdtest/Emphasis.xhtml b/t/Text-Markdown.mdtest/Emphasis.xhtml new file mode 100644 index 0000000..96cef6d --- /dev/null +++ b/t/Text-Markdown.mdtest/Emphasis.xhtml @@ -0,0 +1,4 @@ +<p><em>M*A*S*H</em> here I am going with original Markdown..</p> + +<p>foo_bar_bas I am going with PHP Markdown Extra here (by default, there is an option for original style behavior - see +docs)..</p> diff --git a/t/Text-Markdown.mdtest/HTML-Comment-encoding.text b/t/Text-Markdown.mdtest/HTML-Comment-encoding.text new file mode 100644 index 0000000..557c6af --- /dev/null +++ b/t/Text-Markdown.mdtest/HTML-Comment-encoding.text @@ -0,0 +1,5 @@ +A markdown paragraph with a comment that *will* be processed by original Markdown. However MultiMarkdown and Pandoc do not convert the & sigil in the comment.. + +A paragraph <!-- This & *will* be converted by original Markdown --> + +<p><!-- This & will *not* be converted --></p> diff --git a/t/Text-Markdown.mdtest/HTML-Comment-encoding.xhtml b/t/Text-Markdown.mdtest/HTML-Comment-encoding.xhtml new file mode 100644 index 0000000..b19577f --- /dev/null +++ b/t/Text-Markdown.mdtest/HTML-Comment-encoding.xhtml @@ -0,0 +1,5 @@ +<p>A markdown paragraph with a comment that <em>will</em> be processed by original Markdown. However MultiMarkdown and Pandoc do not convert the & sigil in the comment.. </p> + +<p>A paragraph <!-- This & *will* be converted by original Markdown --></p> + +<p><!-- This & will *not* be converted --></p> diff --git a/t/Text-Markdown.mdtest/HTML5-attributes.html b/t/Text-Markdown.mdtest/HTML5-attributes.html new file mode 100644 index 0000000..9dc2b47 --- /dev/null +++ b/t/Text-Markdown.mdtest/HTML5-attributes.html @@ -0,0 +1,11 @@ +<h1 class=foo>foo</h1> + +<p class=bar> +this is a paragraph +</p> + +<h2 class=bar> +an h2 +</h2> + +<p>normal</p> diff --git a/t/Text-Markdown.mdtest/HTML5-attributes.text b/t/Text-Markdown.mdtest/HTML5-attributes.text new file mode 100644 index 0000000..66d655a --- /dev/null +++ b/t/Text-Markdown.mdtest/HTML5-attributes.text @@ -0,0 +1,11 @@ +<h1 class=foo>foo</h1> + +<p class=bar> +this is a paragraph +</p> + +<h2 class=bar> +an h2 +</h2> + +normal diff --git a/t/Text-Markdown.mdtest/Links_brackets.text b/t/Text-Markdown.mdtest/Links_brackets.text new file mode 100644 index 0000000..6dd3c5d --- /dev/null +++ b/t/Text-Markdown.mdtest/Links_brackets.text @@ -0,0 +1,2 @@ +[ZIP archives](http://en.wikipedia.org/wiki/ZIP_(file_format) "ZIP (file format) - Wikipedia, the free encyclopedia") + diff --git a/t/Text-Markdown.mdtest/Links_brackets.xhtml b/t/Text-Markdown.mdtest/Links_brackets.xhtml new file mode 100644 index 0000000..75376b9 --- /dev/null +++ b/t/Text-Markdown.mdtest/Links_brackets.xhtml @@ -0,0 +1 @@ +<p><a href="http://en.wikipedia.org/wiki/ZIP_(file_format)" title="ZIP (file format) - Wikipedia, the free encyclopedia">ZIP archives</a></p> diff --git a/t/Text-Markdown.mdtest/Links_multiline_bugs_1.html b/t/Text-Markdown.mdtest/Links_multiline_bugs_1.html new file mode 100644 index 0000000..386174a --- /dev/null +++ b/t/Text-Markdown.mdtest/Links_multiline_bugs_1.html @@ -0,0 +1,4 @@ +<p><a href="http://bugs.debian.org/459885">http://bugs.debian.org/459885</a></p> + +<p><a href="/someurl/">link +text</a></p> diff --git a/t/Text-Markdown.mdtest/Links_multiline_bugs_1.text b/t/Text-Markdown.mdtest/Links_multiline_bugs_1.text new file mode 100644 index 0000000..9744d4f --- /dev/null +++ b/t/Text-Markdown.mdtest/Links_multiline_bugs_1.text @@ -0,0 +1,7 @@ +<http://bugs.debian.org/459885> + +[link +text] [link +id] + +[link id]: /someurl/ diff --git a/t/Text-Markdown.mdtest/Links_multiline_bugs_2.html b/t/Text-Markdown.mdtest/Links_multiline_bugs_2.html new file mode 100644 index 0000000..7be828b --- /dev/null +++ b/t/Text-Markdown.mdtest/Links_multiline_bugs_2.html @@ -0,0 +1,4 @@ +<p><a href="http://bugs.debian.org/459885">http://bugs.debian.org/459885</a></p> + +<p>Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is <a href="http://www.ua.es">my <br /> +University</a>.</p> diff --git a/t/Text-Markdown.mdtest/Links_multiline_bugs_2.text b/t/Text-Markdown.mdtest/Links_multiline_bugs_2.text new file mode 100644 index 0000000..773679e --- /dev/null +++ b/t/Text-Markdown.mdtest/Links_multiline_bugs_2.text @@ -0,0 +1,6 @@ +<http://bugs.debian.org/459885> + +Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is [my +University][]. + + [my university]: http://www.ua.es diff --git a/t/Text-Markdown.mdtest/Links_reference_style.text b/t/Text-Markdown.mdtest/Links_reference_style.text new file mode 100644 index 0000000..8b1aaf9 --- /dev/null +++ b/t/Text-Markdown.mdtest/Links_reference_style.text @@ -0,0 +1,87 @@ +Foo [bar] [1]. + +Foo [bar][1]. + +Foo [bar] +[1]. + +[1]: /url/ "Title" + + +With [embedded [brackets]] [b]. + + +Indented [once][]. + +Indented [twice][]. + +Indented [thrice][]. + +Indented [four][] times. + + [once]: /url + + [twice]: /url + + [thrice]: /url + + [four]: /url + + +[b]: /url/ + +* * * + +[this] [this] should work + +So should [this][this]. + +And [this] []. + +And [this][]. + +And [this]. + +But not [that] []. + +Nor [that][]. + +Nor [that]. + +[Something in brackets like [this][] should work] + +[Same with [this].] + +In this case, [this](/somethingelse/) points to something else. + +Backslashing should suppress \[this] and [this\]. + +[this]: foo + + +* * * + +Here's one where the [link +breaks] across lines. + +Here's another where the [link +breaks] across lines, but with a line-ending space. + + +[link breaks]: /url/ + +More multi line edge cases. First a broken link id + +[link +text] [link +id] + +[link id]: /someurl/ + +Then a line with 2 chars of trailing whitespace and a line break [my +University][]. + +The a shortcut reference link with 2 chars of trailing whitespace and a line break [my +University]. + + [my university]: http://www.ua.es
\ No newline at end of file diff --git a/t/Text-Markdown.mdtest/Links_reference_style.xhtml b/t/Text-Markdown.mdtest/Links_reference_style.xhtml new file mode 100644 index 0000000..0793721 --- /dev/null +++ b/t/Text-Markdown.mdtest/Links_reference_style.xhtml @@ -0,0 +1,63 @@ +<p>Foo <a href="/url/" title="Title">bar</a>.</p> + +<p>Foo <a href="/url/" title="Title">bar</a>.</p> + +<p>Foo <a href="/url/" title="Title">bar</a>.</p> + +<p>With <a href="/url/">embedded [brackets]</a>.</p> + +<p>Indented <a href="/url">once</a>.</p> + +<p>Indented <a href="/url">twice</a>.</p> + +<p>Indented <a href="/url">thrice</a>.</p> + +<p>Indented [four][] times.</p> + +<pre><code>[four]: /url +</code></pre> + +<hr /> + +<p><a href="foo">this</a> should work</p> + +<p>So should <a href="foo">this</a>.</p> + +<p>And <a href="foo">this</a>.</p> + +<p>And <a href="foo">this</a>.</p> + +<p>And <a href="foo">this</a>.</p> + +<p>But not [that] [].</p> + +<p>Nor [that][].</p> + +<p>Nor [that].</p> + +<p>[Something in brackets like <a href="foo">this</a> should work]</p> + +<p>[Same with <a href="foo">this</a>.]</p> + +<p>In this case, <a href="/somethingelse/">this</a> points to something else.</p> + +<p>Backslashing should suppress [this] and [this].</p> + +<hr /> + +<p>Here's one where the <a href="/url/">link +breaks</a> across lines.</p> + +<p>Here's another where the <a href="/url/">link +breaks</a> across lines, but with a line-ending space.</p> + +<p>More multi line edge cases. First a broken link id</p> + +<p><a href="/someurl/">link +text</a></p> + +<p>Then a line with 2 chars of trailing whitespace and a line break <a href="http://www.ua.es">my <br /> +University</a>.</p> + +<p>The a shortcut reference link with 2 chars of trailing whitespace and a line break <a href="http://www.ua.es">my <br /> +University</a>.</p> diff --git a/t/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.text b/t/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.text new file mode 100644 index 0000000..6bd63e8 --- /dev/null +++ b/t/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.text @@ -0,0 +1,25 @@ +# text1 + + * text2 + + * text3 + + text4 + +## text5 + + * text6 + + * text7 + + text8 + +## text9 + + * text10 + + * text11 + + text12 + + text13 diff --git a/t/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.xhtml b/t/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.xhtml new file mode 100644 index 0000000..9c7617c --- /dev/null +++ b/t/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.xhtml @@ -0,0 +1,37 @@ +<h1>text1</h1> + +<ul> +<li><p>text2</p> + +<ul> +<li>text3</li> +</ul> + +<p>text4</p></li> +</ul> + +<h2>text5</h2> + +<ul> +<li><p>text6</p> + +<ul> +<li>text7</li> +</ul> + +<p>text8</p></li> +</ul> + +<h2>text9</h2> + +<ul> +<li><p>text10</p> + +<ul> +<li>text11</li> +</ul> + +<p>text12</p> + +<p>text13</p></li> +</ul> diff --git a/t/Text-Markdown.mdtest/PHP-ASP_tags.text b/t/Text-Markdown.mdtest/PHP-ASP_tags.text new file mode 100644 index 0000000..6cd1887 --- /dev/null +++ b/t/Text-Markdown.mdtest/PHP-ASP_tags.text @@ -0,0 +1,7 @@ +I am going with the same as Markdown.pl 1.0.2b8 here. *However* I reserve the right to also leave Template toolkit alone at a later date if I need to.. + +<%foo ok %> + +<?php test_foo ?> + +[% template_toolkit %]
\ No newline at end of file diff --git a/t/Text-Markdown.mdtest/PHP-ASP_tags.xhtml b/t/Text-Markdown.mdtest/PHP-ASP_tags.xhtml new file mode 100644 index 0000000..96eb227 --- /dev/null +++ b/t/Text-Markdown.mdtest/PHP-ASP_tags.xhtml @@ -0,0 +1,7 @@ +<p>I am going with the same as Markdown.pl 1.0.2b8 here. <em>However</em> I reserve the right to also leave Template toolkit alone at a later date if I need to..</p> + +<%foo ok %> + +<?php test_foo ?> + +<p>[% template_toolkit %]</p> diff --git a/t/Text-Markdown.mdtest/Unicode.text b/t/Text-Markdown.mdtest/Unicode.text new file mode 100644 index 0000000..4b63bea --- /dev/null +++ b/t/Text-Markdown.mdtest/Unicode.text @@ -0,0 +1,5 @@ +> Fo—o + +μορεοϋερ + +> ßåř diff --git a/t/Text-Markdown.mdtest/Unicode.xhtml b/t/Text-Markdown.mdtest/Unicode.xhtml new file mode 100644 index 0000000..ca06ddd --- /dev/null +++ b/t/Text-Markdown.mdtest/Unicode.xhtml @@ -0,0 +1,9 @@ +<blockquote> + <p>Fo—o</p> +</blockquote> + +<p>μορεοϋερ</p> + +<blockquote> + <p>ßåř</p> +</blockquote> diff --git a/t/code-hr.t b/t/code-hr.t new file mode 100644 index 0000000..005b39a --- /dev/null +++ b/t/code-hr.t @@ -0,0 +1,16 @@ +use strict; +use warnings; +use Text::Markdown 'markdown'; +use Test::More tests => 1; + +my $txt = markdown(<<'END_MARKDOWN', { tab_width => 2 }); +This is a para. + + This is code. + --- + This is code. + +This is a para. +END_MARKDOWN + +unlike($txt, qr{<hr}, "no HR elements when the hr is in a code block"); diff --git a/t/docs-maruku-unittest/abbreviations.html b/t/docs-maruku-unittest/abbreviations.html new file mode 100644 index 0000000..b670785 --- /dev/null +++ b/t/docs-maruku-unittest/abbreviations.html @@ -0,0 +1,3 @@ +<p>The <abbr title='Hyper Text Markup Language'>HTML</abbr> specification is maintained by the <abbr title='World Wide Web Consortium'>W3C</abbr>.</p> + +<p>Operation <abbr>Tigra Genesis</abbr> is going well.</p> diff --git a/t/docs-maruku-unittest/abbreviations.text b/t/docs-maruku-unittest/abbreviations.text new file mode 100644 index 0000000..6551313 --- /dev/null +++ b/t/docs-maruku-unittest/abbreviations.text @@ -0,0 +1,11 @@ + +The HTML specification is maintained by the W3C. + +*[HTML]: Hyper Text Markup Language +*[W3C]: World Wide Web Consortium + + + +Operation Tigra Genesis is going well. + +*[Tigra Genesis]: diff --git a/t/docs-maruku-unittest/alt.html b/t/docs-maruku-unittest/alt.html new file mode 100644 index 0000000..d4f1d31 --- /dev/null +++ b/t/docs-maruku-unittest/alt.html @@ -0,0 +1 @@ +<p><img src='/foo.jpg' alt='bar' /></p> diff --git a/t/docs-maruku-unittest/alt.text b/t/docs-maruku-unittest/alt.text new file mode 100644 index 0000000..915c68f --- /dev/null +++ b/t/docs-maruku-unittest/alt.text @@ -0,0 +1,3 @@ +  + + diff --git a/t/docs-maruku-unittest/blank.html b/t/docs-maruku-unittest/blank.html new file mode 100644 index 0000000..f735d03 --- /dev/null +++ b/t/docs-maruku-unittest/blank.html @@ -0,0 +1,3 @@ +<p>Linea 1</p> + +<p>Linea 2</p> diff --git a/t/docs-maruku-unittest/blank.text b/t/docs-maruku-unittest/blank.text new file mode 100644 index 0000000..e065a12 --- /dev/null +++ b/t/docs-maruku-unittest/blank.text @@ -0,0 +1,4 @@ + +Linea 1 + +Linea 2 diff --git a/t/docs-maruku-unittest/blanks_in_code.html b/t/docs-maruku-unittest/blanks_in_code.html new file mode 100644 index 0000000..a4ef5db --- /dev/null +++ b/t/docs-maruku-unittest/blanks_in_code.html @@ -0,0 +1,16 @@ +<p>This block is composed of three lines:</p> + +<pre><code>one + +three</code></pre> + +<p>This block is composed of 5</p> + +<pre><code>one + + +four</code></pre> + +<p>This block is composed of 2</p> + +<pre><code>two</code></pre> diff --git a/t/docs-maruku-unittest/blanks_in_code.text b/t/docs-maruku-unittest/blanks_in_code.text new file mode 100644 index 0000000..0f2d7c3 --- /dev/null +++ b/t/docs-maruku-unittest/blanks_in_code.text @@ -0,0 +1,22 @@ +This block is composed of three lines: + + one + + three + +This block is composed of 5 + + + one + + + four + + +This block is composed of 2 + + + two + + + diff --git a/t/docs-maruku-unittest/bug_def.html b/t/docs-maruku-unittest/bug_def.html new file mode 100644 index 0000000..ba6f60c --- /dev/null +++ b/t/docs-maruku-unittest/bug_def.html @@ -0,0 +1 @@ +<p><span>test</span>:</p> diff --git a/t/docs-maruku-unittest/bug_def.text b/t/docs-maruku-unittest/bug_def.text new file mode 100644 index 0000000..8489355 --- /dev/null +++ b/t/docs-maruku-unittest/bug_def.text @@ -0,0 +1,2 @@ +[test][]: + diff --git a/t/docs-maruku-unittest/bug_table.html b/t/docs-maruku-unittest/bug_table.html new file mode 100644 index 0000000..ae94052 --- /dev/null +++ b/t/docs-maruku-unittest/bug_table.html @@ -0,0 +1,3 @@ +<p class='class1' style='color:red'>hello</p> +<table class='class1' summary='Table summary' style='color:red'><thead><tr><th>h</th><th>h</th></tr></thead><tbody><tr><th scope='row' style='text-align: left;'> c1</th><td style='text-align: left;'>c2</td> +</tr></tbody></table> diff --git a/t/docs-maruku-unittest/bug_table.text b/t/docs-maruku-unittest/bug_table.text new file mode 100644 index 0000000..f18d1b8 --- /dev/null +++ b/t/docs-maruku-unittest/bug_table.text @@ -0,0 +1,13 @@ + + +hello +{: summary="Table summary" .class1 style="color:red"} + +h | h +----------|-- +{:t} c1 | c2 +{: summary="Table summary" .class1 style="color:red"} + + + +{:t: scope="row"} diff --git a/t/docs-maruku-unittest/code.html b/t/docs-maruku-unittest/code.html new file mode 100644 index 0000000..a20950b --- /dev/null +++ b/t/docs-maruku-unittest/code.html @@ -0,0 +1,6 @@ +<p>Here is an example of AppleScript:</p> + +<pre><code>tell application "Foo" + beep +end tell + tab</code></pre> diff --git a/t/docs-maruku-unittest/code.text b/t/docs-maruku-unittest/code.text new file mode 100644 index 0000000..3656212 --- /dev/null +++ b/t/docs-maruku-unittest/code.text @@ -0,0 +1,7 @@ +Here is an example of AppleScript: + + tell application "Foo" + beep + end tell + tab + diff --git a/t/docs-maruku-unittest/code2.html b/t/docs-maruku-unittest/code2.html new file mode 100644 index 0000000..9401dba --- /dev/null +++ b/t/docs-maruku-unittest/code2.html @@ -0,0 +1,5 @@ +<blockquote> +<p>Code</p> + +<pre><code>Ciao</code></pre> +</blockquote> diff --git a/t/docs-maruku-unittest/code2.text b/t/docs-maruku-unittest/code2.text new file mode 100644 index 0000000..3f4ea50 --- /dev/null +++ b/t/docs-maruku-unittest/code2.text @@ -0,0 +1,3 @@ +> Code +> +> Ciao diff --git a/t/docs-maruku-unittest/code3.html b/t/docs-maruku-unittest/code3.html new file mode 100644 index 0000000..655a952 --- /dev/null +++ b/t/docs-maruku-unittest/code3.html @@ -0,0 +1,15 @@ +<p>This is code (4 spaces):</p> + +<pre><code>Code</code></pre> + +<p>This is not code</p> + +<pre><code>Code</code></pre> + +<p>This is code (1 tab):</p> + +<pre><code>Code</code></pre> + +<p>This is not code</p> + +<pre><code>Code</code></pre> diff --git a/t/docs-maruku-unittest/code3.text b/t/docs-maruku-unittest/code3.text new file mode 100644 index 0000000..2e7c652 --- /dev/null +++ b/t/docs-maruku-unittest/code3.text @@ -0,0 +1,17 @@ + +This is code (4 spaces): + + Code +This is not code + + Code + +This is code (1 tab): + + Code +This is not code + + Code + + + diff --git a/t/docs-maruku-unittest/convert.pl b/t/docs-maruku-unittest/convert.pl new file mode 100644 index 0000000..20346c8 --- /dev/null +++ b/t/docs-maruku-unittest/convert.pl @@ -0,0 +1,47 @@ +use strict; +use warnings; +open(LS, "ls -1 *.md|") or die; +my @list = <LS>; +close(LS); + +foreach (@list) { + chomp; + s/\.md$//; + my ($markdown, $html) = convert_to_perl_test("$_.md"); + open(MD, ">$_.text") or die; + print MD $markdown; + close(MD); + open(MD, ">$_.html") or die; + print MD $html; + close(MD); +} + +sub convert_to_perl_test { + my ($file) = @_; + my $FH; + open($FH, '<', $file) or die("Cannot open $file"); + my ($markdown, $html); + my @lines = <$FH>; + close($FH); + my $mode = 0; + foreach my $l (@lines) { + if ($l =~ /^\*\*\*/) { + $mode = 0; + if ($l =~ /Markdown input/i) { + $mode = 1; + } + if ($l =~ /Output of to_html/) { + $mode = 2; + } + } + elsif ($mode > 0) { + if (1 == $mode) { + $markdown .= $l; + } + else { + $html .= $l; + } + } + } + return ($markdown, $html); +} diff --git a/t/docs-maruku-unittest/data_loss.html b/t/docs-maruku-unittest/data_loss.html new file mode 100644 index 0000000..32463a9 --- /dev/null +++ b/t/docs-maruku-unittest/data_loss.html @@ -0,0 +1,3 @@ +<ol> +<li>abcd efgh ijkl</li> +</ol> diff --git a/t/docs-maruku-unittest/data_loss.text b/t/docs-maruku-unittest/data_loss.text new file mode 100644 index 0000000..a353aeb --- /dev/null +++ b/t/docs-maruku-unittest/data_loss.text @@ -0,0 +1,4 @@ +1. abcd +efgh +ijkl + diff --git a/t/docs-maruku-unittest/easy.html b/t/docs-maruku-unittest/easy.html new file mode 100644 index 0000000..8649e55 --- /dev/null +++ b/t/docs-maruku-unittest/easy.html @@ -0,0 +1 @@ +<p><em>Hello!</em> how are <strong>you</strong>?</p> diff --git a/t/docs-maruku-unittest/easy.text b/t/docs-maruku-unittest/easy.text new file mode 100644 index 0000000..d5ad50c --- /dev/null +++ b/t/docs-maruku-unittest/easy.text @@ -0,0 +1 @@ +*Hello!* how are **you**? diff --git a/t/docs-maruku-unittest/email.html b/t/docs-maruku-unittest/email.html new file mode 100644 index 0000000..fe1000d --- /dev/null +++ b/t/docs-maruku-unittest/email.html @@ -0,0 +1 @@ +<p>This is an email address: <a href='mailto:andrea@invalid.it'>andrea@invalid.it</a></p> diff --git a/t/docs-maruku-unittest/email.text b/t/docs-maruku-unittest/email.text new file mode 100644 index 0000000..4d154e4 --- /dev/null +++ b/t/docs-maruku-unittest/email.text @@ -0,0 +1,4 @@ + + +This is an email address: <andrea@invalid.it> + diff --git a/t/docs-maruku-unittest/entities.html b/t/docs-maruku-unittest/entities.html new file mode 100644 index 0000000..94239c6 --- /dev/null +++ b/t/docs-maruku-unittest/entities.html @@ -0,0 +1,14 @@ +<p>Maruku translates HTML entities to the equivalent in LaTeX:</p> +<table><thead><tr><th>Entity</th><th>Result</th></tr></thead><tbody><tr><td style='text-align: left;'><code>&copy;</code></td><td style='text-align: left;'>©</td> +</tr><tr><td style='text-align: left;'><code>&pound;</code></td><td style='text-align: left;'>£</td> +</tr><tr><td style='text-align: left;'><code>a&nbsp;b</code></td><td style='text-align: left;'>a b</td> +</tr><tr><td style='text-align: left;'><code>&lambda;</code></td><td style='text-align: left;'>λ</td> +</tr><tr><td style='text-align: left;'><code>&mdash;</code></td><td style='text-align: left;'>—</td> +</tr></tbody></table> +<p>Entity-substitution does not happen in code blocks or inline code.</p> + +<p>The following should not be translated:</p> + +<pre><code>&copy;</code></pre> + +<p>It should read just like this: <code>&copy;</code>.</p> diff --git a/t/docs-maruku-unittest/entities.text b/t/docs-maruku-unittest/entities.text new file mode 100644 index 0000000..7ad0b9e --- /dev/null +++ b/t/docs-maruku-unittest/entities.text @@ -0,0 +1,20 @@ +Maruku translates HTML entities to the equivalent in LaTeX: + +Entity | Result +------------|---------- +`©` | © +`£` | £ +`a b` | a b +`λ` | λ +`—` | — + + +Entity-substitution does not happen in code blocks or inline code. + +The following should not be translated: + + © + +It should read just like this: `©`. + + diff --git a/t/docs-maruku-unittest/escaping.html b/t/docs-maruku-unittest/escaping.html new file mode 100644 index 0000000..165a784 --- /dev/null +++ b/t/docs-maruku-unittest/escaping.html @@ -0,0 +1,9 @@ +<p>Hello: ! ! ` { } [ ] ( ) # . ! * * *</p> + +<p>Ora, <em>emphasis</em>, <strong>bold</strong>, * <- due asterischi-> * , un underscore-> _ , <em>emphasis</em>, incre<em>dible</em>e!</p> + +<p>This is <code>Code with a special: -> ` <-</code>(after)</p> + +<p><code>Start </code> of paragraph</p> + +<p>End of <code>paragraph </code></p> diff --git a/t/docs-maruku-unittest/escaping.text b/t/docs-maruku-unittest/escaping.text new file mode 100644 index 0000000..ff043c2 --- /dev/null +++ b/t/docs-maruku-unittest/escaping.text @@ -0,0 +1,11 @@ + Hello: ! \! \` \{ \} \[ \] \( \) \# \. \! * \* * + + +Ora, *emphasis*, **bold**, * <- due asterischi-> * , un underscore-> _ , _emphasis_, + incre*dible*e! + +This is ``Code with a special: -> ` <- ``(after) + +`Start ` of paragraph + +End of `paragraph ` diff --git a/t/docs-maruku-unittest/extra_dl.html b/t/docs-maruku-unittest/extra_dl.html new file mode 100644 index 0000000..f66d4da --- /dev/null +++ b/t/docs-maruku-unittest/extra_dl.html @@ -0,0 +1,9 @@ +<dl> +<dt>Apple</dt> + +<dd>Pomaceous fruit of plants of the genus Malus in the family Rosaceae.</dd> + +<dt>Orange</dt> + +<dd>The fruit of an evergreen tree of the genus Citrus.</dd> +</dl> diff --git a/t/docs-maruku-unittest/extra_dl.text b/t/docs-maruku-unittest/extra_dl.text new file mode 100644 index 0000000..e9c01dc --- /dev/null +++ b/t/docs-maruku-unittest/extra_dl.text @@ -0,0 +1,10 @@ +CSS: style.css + + +Apple +: Pomaceous fruit of plants of the genus Malus in + the family Rosaceae. + +Orange +: The fruit of an evergreen tree of the genus Citrus. + diff --git a/t/docs-maruku-unittest/extra_header_id.html b/t/docs-maruku-unittest/extra_header_id.html new file mode 100644 index 0000000..20ca1f6 --- /dev/null +++ b/t/docs-maruku-unittest/extra_header_id.html @@ -0,0 +1,9 @@ +<h1 id='header1'>Header 1</h1> + +<h2 id='header2'>Header 2</h2> + +<h3 id='header3'>Header 3</h3> + +<p>Then you can create links to different parts of the same document like this:</p> + +<p><a href='#header1'>Link back to header 1</a>, <a href='#header2'>Link back to header 2</a>, <a href='#header3'>Link back to header 3</a></p> diff --git a/t/docs-maruku-unittest/extra_header_id.text b/t/docs-maruku-unittest/extra_header_id.text new file mode 100644 index 0000000..969f947 --- /dev/null +++ b/t/docs-maruku-unittest/extra_header_id.text @@ -0,0 +1,14 @@ +Header 1 {#header1} +======== + +Header 2 {#header2} +-------- + +### Header 3 ### {#header3} + +Then you can create links to different parts of the same document like this: + +[Link back to header 1](#header1), +[Link back to header 2](#header2), +[Link back to header 3](#header3) + diff --git a/t/docs-maruku-unittest/extra_table1.html b/t/docs-maruku-unittest/extra_table1.html new file mode 100644 index 0000000..4c780de --- /dev/null +++ b/t/docs-maruku-unittest/extra_table1.html @@ -0,0 +1,3 @@ +<table><thead><tr><th>First Header</th><th>Second Header</th></tr></thead><tbody><tr><td style='text-align: left;'>Content Cell</td><td style='text-align: left;'>Content Cell</td> +</tr><tr><td style='text-align: left;'>Content Cell</td><td style='text-align: left;'>Content Cell</td> +</tr></tbody></table> diff --git a/t/docs-maruku-unittest/extra_table1.text b/t/docs-maruku-unittest/extra_table1.text new file mode 100644 index 0000000..769c7e7 --- /dev/null +++ b/t/docs-maruku-unittest/extra_table1.text @@ -0,0 +1,7 @@ +CSS: style.css + +First Header | Second Header +------------- | ------------- +Content Cell | Content Cell +Content Cell | Content Cell + diff --git a/t/docs-maruku-unittest/footnotes.html b/t/docs-maruku-unittest/footnotes.html new file mode 100644 index 0000000..17d1a8f --- /dev/null +++ b/t/docs-maruku-unittest/footnotes.html @@ -0,0 +1,14 @@ +<p>That’s some text with a footnote <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup> and another <sup id='fnref:2'><a href='#fn:2' rel='footnote'>2</a></sup> and another <sup id='fnref:3'><a href='#fn:3' rel='footnote'>3</a></sup>.</p> + +<p>This is not a footnote.</p> +<div class='footnotes'><hr /><ol><li id='fn:1'> +<p>And that’s the footnote. This is second sentence (same paragraph).</p> +<a href='#fnref:1' rev='footnote'>↩</a></li><li id='fn:2'> +<p>This is the very long one.</p> + +<p>That’s the second paragraph.</p> +<a href='#fnref:2' rev='footnote'>↩</a></li><li id='fn:3'> +<p>And that’s the footnote.</p> + +<p>That’s the second paragraph of the footnote.</p> +<a href='#fnref:3' rev='footnote'>↩</a></li></ol></div> diff --git a/t/docs-maruku-unittest/footnotes.text b/t/docs-maruku-unittest/footnotes.text new file mode 100644 index 0000000..05c6f99 --- /dev/null +++ b/t/docs-maruku-unittest/footnotes.text @@ -0,0 +1,17 @@ +That's some text with a footnote [^b] and another [^c] and another [^a]. + +[^a]: And that's the footnote. + + That's the second paragraph of the footnote. + + +[^b]: And that's the footnote. +This is second sentence (same paragraph). + +[^c]: + This is the very long one. + + That's the second paragraph. + + +This is not a footnote. diff --git a/t/docs-maruku-unittest/headers.html b/t/docs-maruku-unittest/headers.html new file mode 100644 index 0000000..b6d3893 --- /dev/null +++ b/t/docs-maruku-unittest/headers.html @@ -0,0 +1,5 @@ +<h1 id='a_title_with_emphasis'>A title with <em>emphasis</em></h1> + +<h2 id='a_title_with_emphasis'>A title with <em>emphasis</em></h2> + +<h4 id='a_title_with_emphasis'>A title with <em>emphasis</em></h4> diff --git a/t/docs-maruku-unittest/headers.text b/t/docs-maruku-unittest/headers.text new file mode 100644 index 0000000..387d4e9 --- /dev/null +++ b/t/docs-maruku-unittest/headers.text @@ -0,0 +1,11 @@ +A title with *emphasis* +======================= + +A title with *emphasis* +----------------------- + + +#### A title with *emphasis* #### + + + diff --git a/t/docs-maruku-unittest/hex_entities.html b/t/docs-maruku-unittest/hex_entities.html new file mode 100644 index 0000000..8741bcc --- /dev/null +++ b/t/docs-maruku-unittest/hex_entities.html @@ -0,0 +1 @@ +<p>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.</p> diff --git a/t/docs-maruku-unittest/hex_entities.text b/t/docs-maruku-unittest/hex_entities.text new file mode 100644 index 0000000..98d3bfc --- /dev/null +++ b/t/docs-maruku-unittest/hex_entities.text @@ -0,0 +1,3 @@ +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/t/docs-maruku-unittest/hrule.html b/t/docs-maruku-unittest/hrule.html new file mode 100644 index 0000000..b856afb --- /dev/null +++ b/t/docs-maruku-unittest/hrule.html @@ -0,0 +1 @@ +<hr /><hr /><hr /><hr /><hr /> diff --git a/t/docs-maruku-unittest/hrule.text b/t/docs-maruku-unittest/hrule.text new file mode 100644 index 0000000..8ccef4e --- /dev/null +++ b/t/docs-maruku-unittest/hrule.text @@ -0,0 +1,2 @@ +* * * + diff --git a/t/docs-maruku-unittest/html2.html b/t/docs-maruku-unittest/html2.html new file mode 100644 index 0000000..1c93e7c --- /dev/null +++ b/t/docs-maruku-unittest/html2.html @@ -0,0 +1,2 @@ +<p>One <div />123</p> +<div /> diff --git a/t/docs-maruku-unittest/html2.text b/t/docs-maruku-unittest/html2.text new file mode 100644 index 0000000..58510e2 --- /dev/null +++ b/t/docs-maruku-unittest/html2.text @@ -0,0 +1,4 @@ +One +<div></div>123 + +<div></div>123 diff --git a/t/docs-maruku-unittest/html3.html b/t/docs-maruku-unittest/html3.html new file mode 100644 index 0000000..8ca3d06 --- /dev/null +++ b/t/docs-maruku-unittest/html3.html @@ -0,0 +1 @@ +<p>taking part in <a href='http://sied.dis.uniroma1.it/'>some arcane conspirations</a> which involve <b href='http://www.flickr.com/photos/censi/70893277/'>coffee</b>, <a href='http://flickr.com/photos/censi/42775664/in/set-936677/'>robots</a>, <a href='http://www.flickr.com/photos/censi/42775888/in/set-936677/'>sushi</a>,</p> diff --git a/t/docs-maruku-unittest/html3.text b/t/docs-maruku-unittest/html3.text new file mode 100644 index 0000000..e742017 --- /dev/null +++ b/t/docs-maruku-unittest/html3.text @@ -0,0 +1,5 @@ +taking part in <a href="http://sied.dis.uniroma1.it/">some arcane conspirations</a> which +involve <b href="http://www.flickr.com/photos/censi/70893277/">coffee</b>, +<a href="http://flickr.com/photos/censi/42775664/in/set-936677/">robots</a>, +<a href="http://www.flickr.com/photos/censi/42775888/in/set-936677/">sushi</a>, + diff --git a/t/docs-maruku-unittest/html4.html b/t/docs-maruku-unittest/html4.html new file mode 100644 index 0000000..1b9c5a3 --- /dev/null +++ b/t/docs-maruku-unittest/html4.html @@ -0,0 +1,3 @@ +<div class='frame'> + <a href='http://www.flickr.com/photos/censi/54757256/' class='photo'><img src='http://static.flickr.com/27/54757256_1a2c1d2a95_m.jpg' moz-do-not-send='true' alt='' /></a> +</div> diff --git a/t/docs-maruku-unittest/html4.text b/t/docs-maruku-unittest/html4.text new file mode 100644 index 0000000..fc9c028 --- /dev/null +++ b/t/docs-maruku-unittest/html4.text @@ -0,0 +1,7 @@ +<div class="frame"> + <a class="photo" href="http://www.flickr.com/photos/censi/54757256/"><img alt="" + moz-do-not-send="true" + src="http://static.flickr.com/27/54757256_1a2c1d2a95_m.jpg" /></a> +</div> + + diff --git a/t/docs-maruku-unittest/html5.html b/t/docs-maruku-unittest/html5.html new file mode 100644 index 0000000..8ffffe2 --- /dev/null +++ b/t/docs-maruku-unittest/html5.html @@ -0,0 +1,3 @@ +<div class='frame'> + <a href='http://www.flickr.com/photos/censi/88561568/' class='photo'><img src='http://static.flickr.com/28/88561568_ab84d28245_m.jpg' height='180' moz-do-not-send='true' alt='Aperitif' width='240' /></a> + </div> diff --git a/t/docs-maruku-unittest/html5.text b/t/docs-maruku-unittest/html5.text new file mode 100644 index 0000000..5adc250 --- /dev/null +++ b/t/docs-maruku-unittest/html5.text @@ -0,0 +1,5 @@ + <div class="frame"> + <a class="photo" href="http://www.flickr.com/photos/censi/88561568/" ><img moz-do-not-send="true" src="http://static.flickr.com/28/88561568_ab84d28245_m.jpg" width="240" height="180" alt="Aperitif" /></a> + </div> + + diff --git a/t/docs-maruku-unittest/ie.html b/t/docs-maruku-unittest/ie.html new file mode 100644 index 0000000..2809bfd --- /dev/null +++ b/t/docs-maruku-unittest/ie.html @@ -0,0 +1,9 @@ +<p><code><p>here's an apostrophe & a quote "</p></code></p> + +<pre><code><p>here's an apostrophe & a quote "</p></code></pre> + +<pre lang='xml'><code class='xml' lang='xml'><p>here's an apostrophe & a quote "</p></code></pre> + +<pre><code class='not_supported' lang='not_supported'><p>here's an apostrophe & a quote "</p></code></pre> + +<pre><code class='xml' lang='xml'><span class='punct'><</span><span class='tag'>p</span><span class='punct'>></span>here's an apostrophe & a quote "<span class='punct'></</span><span class='tag'>p</span><span class='punct'>></span></code></pre> diff --git a/t/docs-maruku-unittest/ie.text b/t/docs-maruku-unittest/ie.text new file mode 100644 index 0000000..7a4cfab --- /dev/null +++ b/t/docs-maruku-unittest/ie.text @@ -0,0 +1,15 @@ +`<p>here's an apostrophe & a quote "</p>` + + <p>here's an apostrophe & a quote "</p> +{:} + + <p>here's an apostrophe & a quote "</p> +{:lang=xml} + + <p>here's an apostrophe & a quote "</p> +{:html_use_syntax=true lang=not_supported} + + <p>here's an apostrophe & a quote "</p> +{:html_use_syntax=true lang=xml} + + diff --git a/t/docs-maruku-unittest/images.html b/t/docs-maruku-unittest/images.html new file mode 100644 index 0000000..a40a804 --- /dev/null +++ b/t/docs-maruku-unittest/images.html @@ -0,0 +1,9 @@ +<p>This page does not uilizes <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Cascading Style Sheets' /></p> + +<p>Please mouseover to see the title: <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Cascading Style Sheets' /></p> + +<p>Please mouseover to see the title: <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Cascading Style Sheets' /></p> + +<p>I’ll say it one more time: this page does not use <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Cascading Style Sheets' /></p> + +<p>This is double size: <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Cascading Style Sheets' /></p> diff --git a/t/docs-maruku-unittest/images.text b/t/docs-maruku-unittest/images.text new file mode 100644 index 0000000..7569361 --- /dev/null +++ b/t/docs-maruku-unittest/images.text @@ -0,0 +1,22 @@ + +This page does not uilizes  + + +Please mouseover to see the title:  + +Please mouseover to see the title:  + + +I'll say it one more time: this page does not use ![Cascading Style Sheets] [css] + +This is double size: ![Cascading Style Sheets] [css2] + + + +[css]: http://jigsaw.w3.org/css-validator/images/vcss "Optional title attribute" + +[css2]: http://jigsaw.w3.org/css-validator/images/vcss "Optional title attribute" class=external + style="border:0;width:188px;height:131px" + + + diff --git a/t/docs-maruku-unittest/images2.html b/t/docs-maruku-unittest/images2.html new file mode 100644 index 0000000..ad36dd0 --- /dev/null +++ b/t/docs-maruku-unittest/images2.html @@ -0,0 +1,3 @@ +<p>This is an <img src='image.jpg' alt='image' />.</p> + +<p>This is an <img src='image.jpg' alt='image' />.</p> diff --git a/t/docs-maruku-unittest/images2.text b/t/docs-maruku-unittest/images2.text new file mode 100644 index 0000000..ef97f4b --- /dev/null +++ b/t/docs-maruku-unittest/images2.text @@ -0,0 +1,7 @@ + +This is an ![image][]. + +This is an ![image]. + +[image]: image.jpg + diff --git a/t/docs-maruku-unittest/inline_html.html b/t/docs-maruku-unittest/inline_html.html new file mode 100644 index 0000000..71e7f08 --- /dev/null +++ b/t/docs-maruku-unittest/inline_html.html @@ -0,0 +1,66 @@ +<p>Input:</p> + +<pre><code><em>Emphasis</em></code></pre> + +<p>Result: <em>Emphasis</em></p> + +<p>Input:</p> + +<pre><code><img src="http://jigsaw.w3.org/css-validator/images/vcss"/></code></pre> + +<p>Result on span: <img src='http://jigsaw.w3.org/css-validator/images/vcss' /></p> + +<p>Result alone:</p> +<img src='http://jigsaw.w3.org/css-validator/images/vcss' /> +<p>Without closing:</p> +<img src='http://jigsaw.w3.org/css-validator/images/vcss' /><div> +<p> +<p>This is</p> +<em> +<p>true</p> +</em> +<p>markdown text (paragraph)</p> +</p> +<p> +<p> +<p>This is</p> +<em> +<p>true</p> +</em> +<p>markdown text (no paragraph)</p> +</p> +</p> + <p> +<p> +<p>This is</p> +<em> +<p>true</p> +</em> +<p>markdown text (block paragraph)</p> +</p> +</p> +</div><table> +<tr> +<td> +<p>This is</p> +<em> +<p>true</p> +</em> +<p>markdown text. (no par)</p> +</td> +<td> +<p>This is</p> +<em> +<p>true</p> +</em> +<p>markdown text. (par)</p> +</td> +</tr> +</table> +<p>The following is invalid HTML, and will generate an error:</p> +<pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error: +<table> +<td markdown="1">This is *true* markdown text. (no par)</td> +<td markdown="block">This is *true* markdown text. (par)</td> +</tr></pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error: +</table></pre> diff --git a/t/docs-maruku-unittest/inline_html.text b/t/docs-maruku-unittest/inline_html.text new file mode 100644 index 0000000..ad89f66 --- /dev/null +++ b/t/docs-maruku-unittest/inline_html.text @@ -0,0 +1,50 @@ +CSS: style.css + +Input: + + <em>Emphasis</em> + +Result: <em>Emphasis</em> + +Input: + + <img src="http://jigsaw.w3.org/css-validator/images/vcss"/> + +Result on span: <img src="http://jigsaw.w3.org/css-validator/images/vcss"/> + +Result alone: + +<img src="http://jigsaw.w3.org/css-validator/images/vcss"/> + +Without closing: + +<img src="http://jigsaw.w3.org/css-validator/images/vcss"> + +<div markdown="1"> + This is *true* markdown text (paragraph) + + <p markdown="1"> + This is *true* markdown text (no paragraph) + </p> + <p markdown="block"> + This is *true* markdown text (block paragraph) + </p> +</div> + +<table> +<tr> +<td markdown="1">This is *true* markdown text. (no par)</td> +<td markdown="block">This is *true* markdown text. (par)</td> +</tr> +</table> + + +The following is invalid HTML, and will generate an error: + +<table> +<td markdown="1">This is *true* markdown text. (no par)</td> +<td markdown="block">This is *true* markdown text. (par)</td> +</tr> +</table> + + diff --git a/t/docs-maruku-unittest/inline_html2.html b/t/docs-maruku-unittest/inline_html2.html new file mode 100644 index 0000000..de87541 --- /dev/null +++ b/t/docs-maruku-unittest/inline_html2.html @@ -0,0 +1,3 @@ +<div> +<p>Test <strong>bold</strong></p> +</div><p>Test <strong>bold</strong></p> diff --git a/t/docs-maruku-unittest/inline_html2.text b/t/docs-maruku-unittest/inline_html2.text new file mode 100644 index 0000000..439f930 --- /dev/null +++ b/t/docs-maruku-unittest/inline_html2.text @@ -0,0 +1,2 @@ +<div markdown="1">Test **bold**</div> +<p markdown="1">Test **bold**</p> diff --git a/t/docs-maruku-unittest/links.html b/t/docs-maruku-unittest/links.html new file mode 100644 index 0000000..8425443 --- /dev/null +++ b/t/docs-maruku-unittest/links.html @@ -0,0 +1,19 @@ +<p>Search on <a href='http://www.google.com'>Google</a></p> + +<p>Search on <a href='http://www.google.com'>Google</a></p> + +<p>Search on <a href='http://www.google.com'>Google</a></p> + +<p>Search on <a href='http://www.google.com'>Google</a></p> + +<p>Search on <a href='http://images.google.com' title='Google images'>Google images</a></p> + +<p>Inline: <a href='http://google.com'>Google images</a></p> + +<p>Inline with title: <a href='http://google.com' title='Title'>Google images</a></p> + +<p>Inline with title: <a href='http://google.com' title='Title'>Google images</a></p> + +<p>Search on <a href='http://www.gogole.com'>http://www.gogole.com</a> or <a href='http://Here.com'>http://Here.com</a> or ask <a href='mailto:bill@google.com'>bill@google.com</a> or you might ask bill@google.com.</p> + +<p>If all else fails, ask <a href='http://www.google.com'>Google</a></p> diff --git a/t/docs-maruku-unittest/links.text b/t/docs-maruku-unittest/links.text new file mode 100644 index 0000000..530f5c0 --- /dev/null +++ b/t/docs-maruku-unittest/links.text @@ -0,0 +1,36 @@ + +Search on [Google][] + +Search on [Google] [] + +Search on [Google] [google] + +Search on [Google] [Google] + +Search on [Google images][] + +Inline: [Google images](http://google.com) + +Inline with title: [Google images](http://google.com "Title") + +Inline with title: [Google images]( http://google.com "Title" ) + + +Search on <http://www.gogole.com> or <http://Here.com> or ask <mailto:bill@google.com> +or you might ask bill@google.com. + +If all else fails, ask [Google](http://www.google.com) + +[google]: http://www.google.com + +[google2]: http://www.google.com 'Single quotes' + +[google3]: http://www.google.com "Double quotes" + +[google4]: http://www.google.com (Parenthesis) + +[Google Search]: + http://www.google.com "Google search" + +[Google Images]: + http://images.google.com (Google images) diff --git a/t/docs-maruku-unittest/list1.html b/t/docs-maruku-unittest/list1.html new file mode 100644 index 0000000..82824f2 --- /dev/null +++ b/t/docs-maruku-unittest/list1.html @@ -0,0 +1,9 @@ +<ul> +<li> +<p>A list item with a blockquote:</p> + +<blockquote> +<p>This is a blockquote inside a list item.</p> +</blockquote> +</li> +</ul> diff --git a/t/docs-maruku-unittest/list1.text b/t/docs-maruku-unittest/list1.text new file mode 100644 index 0000000..c3e37d8 --- /dev/null +++ b/t/docs-maruku-unittest/list1.text @@ -0,0 +1,5 @@ +* A list item with a blockquote: + + > This is a blockquote + > inside a list item. + diff --git a/t/docs-maruku-unittest/list2.html b/t/docs-maruku-unittest/list2.html new file mode 100644 index 0000000..5d180a5 --- /dev/null +++ b/t/docs-maruku-unittest/list2.html @@ -0,0 +1,11 @@ +<ul> +<li> +<p>This is a list item with two paragraphs.</p> + +<p>This is the second paragraph in the list item. You’re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p> +</li> + +<li> +<p>other</p> +</li> +</ul> diff --git a/t/docs-maruku-unittest/list2.text b/t/docs-maruku-unittest/list2.text new file mode 100644 index 0000000..c1af1ad --- /dev/null +++ b/t/docs-maruku-unittest/list2.text @@ -0,0 +1,8 @@ +* This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're +only required to indent the first line. Lorem ipsum dolor +sit amet, consectetuer adipiscing elit. + +* other + diff --git a/t/docs-maruku-unittest/list3.html b/t/docs-maruku-unittest/list3.html new file mode 100644 index 0000000..1460081 --- /dev/null +++ b/t/docs-maruku-unittest/list3.html @@ -0,0 +1,15 @@ +<ul> +<li> +<p>A list item with a blockquote:</p> + +<blockquote> +<p>This is a blockquote inside a list item.</p> +</blockquote> +</li> + +<li> +<p>A list item with a code block:</p> + +<pre><code><code goes here></code></pre> +</li> +</ul> diff --git a/t/docs-maruku-unittest/list3.text b/t/docs-maruku-unittest/list3.text new file mode 100644 index 0000000..e6333b0 --- /dev/null +++ b/t/docs-maruku-unittest/list3.text @@ -0,0 +1,8 @@ +* A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +* A list item with a code block: + + <code goes here> diff --git a/t/docs-maruku-unittest/list4.html b/t/docs-maruku-unittest/list4.html new file mode 100644 index 0000000..45011d0 --- /dev/null +++ b/t/docs-maruku-unittest/list4.html @@ -0,0 +1,19 @@ +<p>This is a list:</p> + +<ul> +<li>one</li> + +<li>two</li> +</ul> + +<p>This is not a list: * one ciao</p> + +<p>This is a list:</p> + +<ol> +<li>one</li> + +<li>two</li> +</ol> + +<p>This is not a list: 1987. one ciao</p> diff --git a/t/docs-maruku-unittest/list4.text b/t/docs-maruku-unittest/list4.text new file mode 100644 index 0000000..0d6e9ce --- /dev/null +++ b/t/docs-maruku-unittest/list4.text @@ -0,0 +1,16 @@ +This is a list: +* one +* two + +This is not a list: +* one +ciao + +This is a list: +1. one +1. two + +This is not a list: +1987. one +ciao + diff --git a/t/docs-maruku-unittest/lists.html b/t/docs-maruku-unittest/lists.html new file mode 100644 index 0000000..c1972b2 --- /dev/null +++ b/t/docs-maruku-unittest/lists.html @@ -0,0 +1,39 @@ +<ul> +<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.</li> + +<li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.</li> + +<li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.</li> + +<li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.</li> + +<li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.</li> +</ul> + +<p>Ancora</p> + +<ul> +<li> +<p>This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.</p> + +<p>ATTENZIONE!</p> +</li> + +<li> +<p>Suspendisse id sem consectetuer libero luctus adipiscing.</p> +</li> +</ul> + +<p>Ancora</p> + +<ul> +<li> +<p>This is a list item with two paragraphs.</p> + +<p>This is the second paragraph in the list item. You’re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p> +</li> + +<li> +<p>Another item in the same list.</p> +</li> +</ul> diff --git a/t/docs-maruku-unittest/lists.text b/t/docs-maruku-unittest/lists.text new file mode 100644 index 0000000..9c41e9b --- /dev/null +++ b/t/docs-maruku-unittest/lists.text @@ -0,0 +1,32 @@ +* Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. +* Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. +* Donec sit amet nisl. Aliquam semper ipsum sit amet velit. +Suspendisse id sem consectetuer libero luctus adipiscing. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. +Suspendisse id sem consectetuer libero luctus adipiscing. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +Ancora + +* This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + ATTENZIONE! + +* Suspendisse id sem consectetuer libero luctus adipiscing. + + +Ancora + +* This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're +only required to indent the first line. Lorem ipsum dolor +sit amet, consectetuer adipiscing elit. + +* Another item in the same list. diff --git a/t/docs-maruku-unittest/lists11.html b/t/docs-maruku-unittest/lists11.html new file mode 100644 index 0000000..3382952 --- /dev/null +++ b/t/docs-maruku-unittest/lists11.html @@ -0,0 +1 @@ +<p>- ένα</p> diff --git a/t/docs-maruku-unittest/lists11.text b/t/docs-maruku-unittest/lists11.text new file mode 100644 index 0000000..54e7ddc --- /dev/null +++ b/t/docs-maruku-unittest/lists11.text @@ -0,0 +1,2 @@ +- ένα + diff --git a/t/docs-maruku-unittest/lists6.html b/t/docs-maruku-unittest/lists6.html new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/t/docs-maruku-unittest/lists6.html @@ -0,0 +1 @@ + diff --git a/t/docs-maruku-unittest/lists6.text b/t/docs-maruku-unittest/lists6.text new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/t/docs-maruku-unittest/lists6.text @@ -0,0 +1 @@ + diff --git a/t/docs-maruku-unittest/lists7.html b/t/docs-maruku-unittest/lists7.html new file mode 100644 index 0000000..d42e22a --- /dev/null +++ b/t/docs-maruku-unittest/lists7.html @@ -0,0 +1,10 @@ +<p>Ciao</p> + +<ul> +<li>Tab * Tab * Tab</li> +</ul> +<p>Ciao</p> + +<ul> +<li>Tab * Tab * Tab</li> +</ul> diff --git a/t/docs-maruku-unittest/lists7.text b/t/docs-maruku-unittest/lists7.text new file mode 100644 index 0000000..67605b1 --- /dev/null +++ b/t/docs-maruku-unittest/lists7.text @@ -0,0 +1,6 @@ +Ciao + +* Tab + * Tab + * Tab + diff --git a/t/docs-maruku-unittest/lists7b.html b/t/docs-maruku-unittest/lists7b.html new file mode 100644 index 0000000..126e133 --- /dev/null +++ b/t/docs-maruku-unittest/lists7b.html @@ -0,0 +1,31 @@ +<ul> +<li> +a + +<ul> +<li>a1</li> + +<li>a2</li> +</ul> +</li> + +<li> +<p>b</p> +</li> +</ul> +-----| WARNING | ----- +<ul> +<li> +<p>a</p> + +<ul> +<li>a1</li> + +<li>a2</li> +</ul> +</li> + +<li> +<p>b</p> +</li> +</ul> diff --git a/t/docs-maruku-unittest/lists7b.text b/t/docs-maruku-unittest/lists7b.text new file mode 100644 index 0000000..c963508 --- /dev/null +++ b/t/docs-maruku-unittest/lists7b.text @@ -0,0 +1,6 @@ +* a + * a1 + * a2 +* b + + diff --git a/t/docs-maruku-unittest/lists8.html b/t/docs-maruku-unittest/lists8.html new file mode 100644 index 0000000..de79558 --- /dev/null +++ b/t/docs-maruku-unittest/lists8.html @@ -0,0 +1,13 @@ +<p>Here is a paragraph.</p> + +<ul> +<li>Item 1</li> + +<li>Item 2</li> + +<li>Item 3</li> +</ul> +-----| WARNING | ----- +<p>Here is a paragraph.</p> + +<p>* Item 1 * Item 2 * Item 3</p> diff --git a/t/docs-maruku-unittest/lists8.text b/t/docs-maruku-unittest/lists8.text new file mode 100644 index 0000000..d11e4a3 --- /dev/null +++ b/t/docs-maruku-unittest/lists8.text @@ -0,0 +1,7 @@ +Here is a paragraph. + + + * Item 1 + * Item 2 + * Item 3 + diff --git a/t/docs-maruku-unittest/lists9.html b/t/docs-maruku-unittest/lists9.html new file mode 100644 index 0000000..29fc1b9 --- /dev/null +++ b/t/docs-maruku-unittest/lists9.html @@ -0,0 +1,17 @@ +<ul> +<li> +<p>Due</p> + +<ol> +<li>tre</li> + +<li>tre</li> + +<li>tre</li> +</ol> +</li> + +<li> +<p>Due</p> +</li> +</ul> diff --git a/t/docs-maruku-unittest/lists9.text b/t/docs-maruku-unittest/lists9.text new file mode 100644 index 0000000..68395e8 --- /dev/null +++ b/t/docs-maruku-unittest/lists9.text @@ -0,0 +1,5 @@ +- Due + 1. tre + 1. tre + 1. tre +- Due diff --git a/t/docs-maruku-unittest/lists_after_paragraph.html b/t/docs-maruku-unittest/lists_after_paragraph.html new file mode 100644 index 0000000..8b52c96 --- /dev/null +++ b/t/docs-maruku-unittest/lists_after_paragraph.html @@ -0,0 +1,37 @@ +<p>Paragraph, list with no space: * ciao</p> + +<p>Paragraph, list with 1 space: * ciao</p> + +<p>Paragraph, list with 3 space: * ciao</p> + +<p>Paragraph, list with 4 spaces: * ciao</p> + +<p>Paragraph, list with 1 tab: * ciao</p> + +<p>Paragraph (1 space after), list with no space: * ciao</p> + +<p>Paragraph (2 spaces after), list with no space:<br />* ciao</p> + +<p>Paragraph (3 spaces after), list with no space: <br />* ciao</p> + +<p>Paragraph with block quote:</p> + +<blockquote> +<p>Quoted</p> +</blockquote> + +<p>Paragraph with header:</p> + +<h3 id='header'>header</h3> + +<p>Paragraph with header on two lines:</p> + +<h2 id='header'>header</h2> + +<p>Paragraph with html after <div /></p> + +<p>Paragraph with html after, indented: <em>Emphasis</em></p> + +<p>Paragraph with html after, indented: <em>Emphasis</em> <em>tralla</em> <em>Emph</em></p> + +<p>Paragraph with html after, indented: <em>Emphasis *tralla* Emph</em></p> diff --git a/t/docs-maruku-unittest/lists_after_paragraph.text b/t/docs-maruku-unittest/lists_after_paragraph.text new file mode 100644 index 0000000..c0be0c2 --- /dev/null +++ b/t/docs-maruku-unittest/lists_after_paragraph.text @@ -0,0 +1,45 @@ +Paragraph, list with no space: +* ciao + +Paragraph, list with 1 space: + * ciao + +Paragraph, list with 3 space: + * ciao + +Paragraph, list with 4 spaces: + * ciao + +Paragraph, list with 1 tab: + * ciao + +Paragraph (1 space after), list with no space: +* ciao + +Paragraph (2 spaces after), list with no space: +* ciao + +Paragraph (3 spaces after), list with no space: +* ciao + +Paragraph with block quote: +> Quoted + +Paragraph with header: +### header ### + +Paragraph with header on two lines: +header +------ + + +Paragraph with html after +<div></div> + +Paragraph with html after, indented: + <em>Emphasis</em> + +Paragraph with html after, indented: <em>Emphasis</em> *tralla* <em>Emph</em> + +Paragraph with html after, indented: <em>Emphasis *tralla* Emph</em> + diff --git a/t/docs-maruku-unittest/lists_ol.html b/t/docs-maruku-unittest/lists_ol.html new file mode 100644 index 0000000..4820f7d --- /dev/null +++ b/t/docs-maruku-unittest/lists_ol.html @@ -0,0 +1,61 @@ +<ol> +<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.</li> + +<li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.</li> + +<li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.</li> + +<li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.</li> + +<li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.</li> +</ol> + +<p>Ancora</p> + +<ol> +<li> +<p>This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.</p> + +<p>ATTENZIONE!</p> + +<ul> +<li> +<p>Uno</p> +</li> + +<li> +<p>Due</p> + +<ol> +<li>tre</li> + +<li>tre</li> + +<li>tre</li> +</ol> +</li> + +<li> +<p>Due</p> +</li> +</ul> +</li> + +<li> +<p>Suspendisse id sem consectetuer libero luctus adipiscing.</p> +</li> +</ol> + +<p>Ancora</p> + +<ul> +<li> +<p>This is a list item with two paragraphs.</p> + +<p>This is the second paragraph in the list item. You’re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p> +</li> + +<li> +<p>Another item in the same list.</p> +</li> +</ul> diff --git a/t/docs-maruku-unittest/lists_ol.text b/t/docs-maruku-unittest/lists_ol.text new file mode 100644 index 0000000..5b94ea0 --- /dev/null +++ b/t/docs-maruku-unittest/lists_ol.text @@ -0,0 +1,39 @@ +1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + 2. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. +3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. +Suspendisse id sem consectetuer libero luctus adipiscing. + 3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. +Suspendisse id sem consectetuer libero luctus adipiscing. + 4. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +Ancora + +1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + ATTENZIONE! + + - Uno + - Due + 1. tre + 1. tre + 1. tre + - Due + +2. Suspendisse id sem consectetuer libero luctus adipiscing. + + +Ancora + +* This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're +only required to indent the first line. Lorem ipsum dolor +sit amet, consectetuer adipiscing elit. + +* Another item in the same list. diff --git a/t/docs-maruku-unittest/loss.html b/t/docs-maruku-unittest/loss.html new file mode 100644 index 0000000..3fc714a --- /dev/null +++ b/t/docs-maruku-unittest/loss.html @@ -0,0 +1 @@ +<br /> diff --git a/t/docs-maruku-unittest/loss.text b/t/docs-maruku-unittest/loss.text new file mode 100644 index 0000000..1f94fd6 --- /dev/null +++ b/t/docs-maruku-unittest/loss.text @@ -0,0 +1,2 @@ +<br/>123 + diff --git a/t/docs-maruku-unittest/misc_sw.html b/t/docs-maruku-unittest/misc_sw.html new file mode 100644 index 0000000..c1a7405 --- /dev/null +++ b/t/docs-maruku-unittest/misc_sw.html @@ -0,0 +1,79 @@ +<h3 id='general'>General</h3> + +<ul> +<li><em>Operating System</em> : <a href='http://www.apple.com/getamac/'>Mac OS X</a>: heaven, after the purgatory of Linux and the hell of Windows.</li> + +<li><em>Browser</em>: <a href='http://getfirefox.com/'>Firefox</a>. On a Mac, <a href='http://www.caminobrowser.org/'>Camino</a>.</li> + +<li><em>Email</em>: <a href='http://gmail.com/'>GMail</a>, “search, don’t sort” really works.</li> + +<li><em>Text Editor</em>: <a href='http://www.apple.com/getamac/'>TextMate</a>, you have to buy it, but it’s worth every penny. There are rumours that it’s been converting (recovering) Emacs users (addicts). Unfortunately, it’s Mac only. An alternative is <a href='http://www.jedit.org/'>jedit</a> (GPL, Java).</li> +</ul> + +<h3 id='development'>Development</h3> + +<ul> +<li> +<p><em>Build system</em>: <a href='http://www.cmake.org/'>cmake</a>, throw the <a href='http://sources.redhat.com/autobook/'>autotools</a> away.</p> +</li> + +<li> +<p><em>Source code control system</em>: ditch CVS for <a href='http://subversion.tigris.org'>subversion</a>.</p> +</li> + +<li> +<p><em>Project management</em>: <a href='http://trac.edgewall.org/'>Trac</a> tracks everything.</p> +</li> + +<li> +<p><em>Scripting language</em>: <a href='http://www.ruby-lang.org/'>Ruby</a> is Japanese pragmatism (and has a <a href='http://poignantguide.net/ruby/'>poignant</a> guide). Python, you say? Python is too academic and snob:</p> + +<pre><code>$ python +Python 2.4.1 (\#1, Jun 4 2005, 00:54:33) +Type "help", "copyright", "credits" or "license" for more information. +>>> exit +'Use Ctrl-D (i.e. EOF) to exit.' +>>> quit +'Use Ctrl-D (i.e. EOF) to exit.'</code></pre> +</li> + +<li> +<p><em>Java IDE</em>: <a href='http://www.borland.com/us/products/jbuilder/index.html'>JBuilder</a> is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained <a href='http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html'>generics</a> and got opensourced.</p> +</li> + +<li> +<p><em>Mark-up language</em>: HTML is so 2001, why don’t you take at look at <a href='http://en.wikipedia.org/wiki/Markdown'>Markdown</a>? <a href='data/misc_markdown.png'>Look at the source of this page</a>.</p> +</li> + +<li> +<p><em>C++ libraries</em>: * <a href='http://www.trolltech.no/'>QT</a> for GUIs. * <a href='http://www.gnu.org/software/gsl/'>GSL</a> for math. * <a href='http://www.imagemagick.org/Magick++/'>Magick++</a> for manipulating images. * <a href='http://cairographics.org/'>Cairo</a> for creating PDFs. * <a href='http://www.boost.org/'>Boost</a> for just about everything else.</p> +</li> +</ul> + +<h3 id='research'>Research</h3> + +<ul> +<li><em>Writing papers</em>: <a href='http://en.wikipedia.org/wiki/LaTeX'>LaTeX</a></li> + +<li><em>Writing papers & enjoying the process</em>: <a href='http://www.lyx.org'>LyX</a></li> + +<li><em>Handsome figures in your papers</em>: <a href='http://www.xfig.org/'>xfig</a> or, better, <a href='http://tams-www.informatik.uni-hamburg.de/applets/jfig/'>jfig</a>.</li> + +<li><em>The occasional presentation with many graphical content</em>: <a href='http://www.openoffice.org/product/impress.html'>OpenOffice Impress</a> (using the <a href='http://ooolatex.sourceforge.net/'>OOOlatex plugin</a>); the alternative is PowerPoint with the <a href='http://texpoint.necula.org/'>TexPoint</a> plugin.</li> + +<li><em>Managing BibTeX</em>: <a href='http://jabref.sourceforge.net/'>jabref</a>: multi-platform, for all your bibtex needs.</li> + +<li><em>IEEExplore and BibTeX</em>: convert citations using <a href='http://www.bibconverter.net/ieeexplore/'>BibConverter</a>.</li> +</ul> + +<h3 id='cool_websites'>Cool websites</h3> + +<ul> +<li><em>Best site in the wwworld</em>: <a href='http://en.wikipedia.org/'>Wikipedia</a></li> + +<li><a href='http://www.mutopiaproject.org/'>Mutopia</a> for sheet music; <a href='http://www.gutenberg.org/'>the Gutenberg Project</a> for books; <a href='http://www.liberliber.it/'>LiberLiber</a> for books in italian.</li> + +<li><em>Blogs</em>: <a href='http://bloglines.com/'>Bloglines</a></li> + +<li><em>Sharing photos</em>: <a href='http://www.flickr.com/'>flickr</a> exposes an API you can use.</li> +</ul> diff --git a/t/docs-maruku-unittest/misc_sw.text b/t/docs-maruku-unittest/misc_sw.text new file mode 100644 index 0000000..9dab62a --- /dev/null +++ b/t/docs-maruku-unittest/misc_sw.text @@ -0,0 +1,106 @@ +Subject: Software not painful to use +Subject_short: painless software +Topic: /misc/coolsw +Archive: no +Date: Nov 20 2006 +Order: -9.5 +inMenu: true + + +### General ### + +* *Operating System* : [Mac OS X][switch]: heaven, after the purgatory of Linux + and the hell of Windows. +* *Browser*: [Firefox][firefox]. On a Mac, [Camino][camino]. +* *Email*: [GMail][gmail], "search, don't sort" really works. +* *Text Editor*: [TextMate][textmate], you have to buy it, but it's worth every + penny. There are rumours that it's been converting (recovering) Emacs + users (addicts). Unfortunately, it's Mac only. An alternative is + [jedit][jedit] (GPL, Java). + +### Development ### + +* *Build system*: [cmake][cmake], throw the [autotools][autotools] away. +* *Source code control system*: ditch CVS for [subversion][subversion]. +* *Project management*: [Trac][trac] tracks everything. +* *Scripting language*: [Ruby][ruby] is Japanese pragmatism (and has a [poignant][poignant] guide). + Python, you say? Python is too academic and snob: + + $ python + Python 2.4.1 (\#1, Jun 4 2005, 00:54:33) + Type "help", "copyright", "credits" or "license" for more information. + >>> exit + 'Use Ctrl-D (i.e. EOF) to exit.' + >>> quit + 'Use Ctrl-D (i.e. EOF) to exit.' + +* *Java IDE*: [JBuilder][jbuilder] is great software and has a free version (IMHO better than Eclipse). Java + is not a pain anymore since it gained [generics][java-generics] and got opensourced. +* *Mark-up language*: HTML is so 2001, why don't you take at look at [Markdown][markdown]? [Look at the source of this page](data/misc_markdown.png). +* *C++ libraries*: + * [QT][qt] for GUIs. + * [GSL][gsl] for math. + * [Magick++][magick] for manipulating images. + * [Cairo][cairo] for creating PDFs. + * [Boost][boost] for just about everything else. + + +### Research ### + +* *Writing papers*: [LaTeX][latex] +* *Writing papers & enjoying the process*: [LyX][lyx] +* *Handsome figures in your papers*: [xfig][xfig] or, better, [jfig][jfig]. +* *The occasional presentation with many graphical content*: + [OpenOffice Impress][impress] (using the [OOOlatex plugin][ooolatex]); + the alternative is PowerPoint with the [TexPoint][texpoint] plugin. +* *Managing BibTeX*: [jabref][jabref]: multi-platform, for all your bibtex needs. +* *IEEExplore and BibTeX*: convert citations using [BibConverter][bibconverter]. + +### Cool websites ### + +* *Best site in the wwworld*: [Wikipedia][wikipedia] +* [Mutopia][mutopia] for sheet music; [the Gutenberg Project][gutenberg] for books; [LiberLiber][liberliber] for books in italian. +* *Blogs*: [Bloglines][bloglines] +* *Sharing photos*: [flickr][flickr] exposes an API you can use. + + +[firefox]: http://getfirefox.com/ +[gmail]: http://gmail.com/ +[bloglines]: http://bloglines.com/ +[wikipedia]: http://en.wikipedia.org/ +[ruby]: http://www.ruby-lang.org/ +[poignant]: http://poignantguide.net/ruby/ +[webgen]: http://webgen.rubyforge.org/ +[markdown]: http://daringfireball.net/projects/markdown/ +[latex]: http://en.wikipedia.org/wiki/LaTeX +[lyx]: http://www.lyx.org +[impress]: http://www.openoffice.org/product/impress.html +[ooolatex]: http://ooolatex.sourceforge.net/ +[texpoint]: http://texpoint.necula.org/ +[jabref]: http://jabref.sourceforge.net/ +[camino]: http://www.caminobrowser.org/ +[switch]: http://www.apple.com/getamac/ +[textmate]: http://www.apple.com/getamac/ +[cmake]: http://www.cmake.org/ +[xfig]: http://www.xfig.org/ +[jfig]: http://tams-www.informatik.uni-hamburg.de/applets/jfig/ +[subversion]: http://subversion.tigris.org +[jbuilder]: http://www.borland.com/us/products/jbuilder/index.html +[flickr]: http://www.flickr.com/ +[myflickr]: http://www.flickr.com/photos/censi +[bibconverter]: http://www.bibconverter.net/ieeexplore/ +[autotools]: http://sources.redhat.com/autobook/ +[jedit]: http://www.jedit.org/ +[qt]: http://www.trolltech.no/ +[gsl]: http://www.gnu.org/software/gsl/ +[magick]: http://www.imagemagick.org/Magick++/ +[cairo]: http://cairographics.org/ +[boost]: http://www.boost.org/ +[markdown]: http://en.wikipedia.org/wiki/Markdown +[trac]: http://trac.edgewall.org/ +[mutopia]: http://www.mutopiaproject.org/ +[liberliber]: http://www.liberliber.it/ +[gutenberg]: http://www.gutenberg.org/ +[java-generics]: http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html + + diff --git a/t/docs-maruku-unittest/olist.html b/t/docs-maruku-unittest/olist.html new file mode 100644 index 0000000..d349edb --- /dev/null +++ b/t/docs-maruku-unittest/olist.html @@ -0,0 +1,9 @@ +<p>This is a list:</p> + +<ol> +<li>one</li> + +<li>two</li> + +<li>three</li> +</ol> diff --git a/t/docs-maruku-unittest/olist.text b/t/docs-maruku-unittest/olist.text new file mode 100644 index 0000000..e68a659 --- /dev/null +++ b/t/docs-maruku-unittest/olist.text @@ -0,0 +1,5 @@ +This is a list: + +2. one +2. two +3. three diff --git a/t/docs-maruku-unittest/one.html b/t/docs-maruku-unittest/one.html new file mode 100644 index 0000000..e38afba --- /dev/null +++ b/t/docs-maruku-unittest/one.html @@ -0,0 +1 @@ +<p>One line</p> diff --git a/t/docs-maruku-unittest/one.text b/t/docs-maruku-unittest/one.text new file mode 100644 index 0000000..b8ab585 --- /dev/null +++ b/t/docs-maruku-unittest/one.text @@ -0,0 +1 @@ +One line diff --git a/t/docs-maruku-unittest/paragraph.html b/t/docs-maruku-unittest/paragraph.html new file mode 100644 index 0000000..b814fa2 --- /dev/null +++ b/t/docs-maruku-unittest/paragraph.html @@ -0,0 +1 @@ +<p>Paragraph</p> diff --git a/t/docs-maruku-unittest/paragraph.text b/t/docs-maruku-unittest/paragraph.text new file mode 100644 index 0000000..94258d1 --- /dev/null +++ b/t/docs-maruku-unittest/paragraph.text @@ -0,0 +1,2 @@ +Paragraph + diff --git a/t/docs-maruku-unittest/paragraphs.html b/t/docs-maruku-unittest/paragraphs.html new file mode 100644 index 0000000..1778533 --- /dev/null +++ b/t/docs-maruku-unittest/paragraphs.html @@ -0,0 +1,5 @@ +<p>Paragraph 1</p> + +<p>Paragraph 2</p> + +<p>Paragraph 3 Paragraph 4 Paragraph Br-><br />Paragraph 5</p> diff --git a/t/docs-maruku-unittest/paragraphs.text b/t/docs-maruku-unittest/paragraphs.text new file mode 100644 index 0000000..77b5ff8 --- /dev/null +++ b/t/docs-maruku-unittest/paragraphs.text @@ -0,0 +1,11 @@ +Paragraph 1 + +Paragraph 2 + + +Paragraph 3 +Paragraph 4 +Paragraph Br-> +Paragraph 5 + + diff --git a/t/docs-maruku-unittest/smartypants.html b/t/docs-maruku-unittest/smartypants.html new file mode 100644 index 0000000..cf0df19 --- /dev/null +++ b/t/docs-maruku-unittest/smartypants.html @@ -0,0 +1,17 @@ +<pre><code>'Twas a "test" to 'remember' in the '90s.</code></pre> + +<p>‘Twas a “test” to ‘remember’ in the ’90s.</p> + +<pre><code>It was --- in a sense --- really... interesting.</code></pre> + +<p>It was — in a sense — really… interesting.</p> + +<pre><code>I -- too -- met << some curly quotes >> there or <<here>>No space.</code></pre> + +<p>I – too – met « some curly quotes » there or «here»No space.</p> + +<pre><code>She was 6\"12\'.</code></pre> + +<blockquote> +<p>She was 6"12'.</p> +</blockquote> diff --git a/t/docs-maruku-unittest/smartypants.text b/t/docs-maruku-unittest/smartypants.text new file mode 100644 index 0000000..14478ea --- /dev/null +++ b/t/docs-maruku-unittest/smartypants.text @@ -0,0 +1,13 @@ + 'Twas a "test" to 'remember' in the '90s. +'Twas a "test" to 'remember' in the '90s. + + It was --- in a sense --- really... interesting. +It was --- in a sense --- really... interesting. + + I -- too -- met << some curly quotes >> there or <<here>>No space. +I -- too -- met << some curly quotes >> there or <<here>>No space. + + + She was 6\"12\'. +> She was 6\"12\'. + diff --git a/t/docs-maruku-unittest/syntax_hl.html b/t/docs-maruku-unittest/syntax_hl.html new file mode 100644 index 0000000..0c2ac27 --- /dev/null +++ b/t/docs-maruku-unittest/syntax_hl.html @@ -0,0 +1,11 @@ +<p>This is ruby code:</p> + +<pre><code>require 'maruku' + +puts Maruku.new($stdin).to_html</code></pre> + +<p>This is ruby code:</p> + +<pre><code class='ruby' lang='ruby'><span class='ident'>require</span> <span class='punct'>'</span><span class='string'>maruku</span><span class='punct'>'</span></code></pre> + +<pre><code>puts Maruku.new($stdin).to_html</code></pre> diff --git a/t/docs-maruku-unittest/syntax_hl.text b/t/docs-maruku-unittest/syntax_hl.text new file mode 100644 index 0000000..ec6d1a4 --- /dev/null +++ b/t/docs-maruku-unittest/syntax_hl.text @@ -0,0 +1,12 @@ +This is ruby code: + + require 'maruku' + + puts Maruku.new($stdin).to_html + +This is ruby code: + + require 'maruku' +{: lang=ruby html_use_syntax} + + puts Maruku.new($stdin).to_html diff --git a/t/docs-maruku-unittest/table_attributes.html b/t/docs-maruku-unittest/table_attributes.html new file mode 100644 index 0000000..5e6304d --- /dev/null +++ b/t/docs-maruku-unittest/table_attributes.html @@ -0,0 +1,2 @@ +<table cellspacing='2em' class='class1' border='3' rules='cols' frame='lhs' summary='Table summary' cellpadding='4px' width='50%' style='color:red'><thead><tr><th>h</th><th>h</th></tr></thead><tbody><tr><th scope='row' style='text-align: left;'> c1</th><td style='text-align: left;'>c2</td> +</tr></tbody></table> diff --git a/t/docs-maruku-unittest/table_attributes.text b/t/docs-maruku-unittest/table_attributes.text new file mode 100644 index 0000000..3dc217d --- /dev/null +++ b/t/docs-maruku-unittest/table_attributes.text @@ -0,0 +1,7 @@ + +h | h +----------|-- +{:t} c1 | c2 +{: summary="Table summary" .class1 style="color:red" border=3 width="50%" frame=lhs rules=cols cellspacing=2em cellpadding=4px} + +{:t: scope="row"} diff --git a/t/docs-maruku-unittest/test.html b/t/docs-maruku-unittest/test.html new file mode 100644 index 0000000..8494555 --- /dev/null +++ b/t/docs-maruku-unittest/test.html @@ -0,0 +1 @@ +<pre><code> $ python </code></pre> diff --git a/t/docs-maruku-unittest/test.text b/t/docs-maruku-unittest/test.text new file mode 100644 index 0000000..96c7f45 --- /dev/null +++ b/t/docs-maruku-unittest/test.text @@ -0,0 +1,5 @@ + + $ python + + + diff --git a/t/docs-maruku-unittest/wrapping.html b/t/docs-maruku-unittest/wrapping.html new file mode 100644 index 0000000..941a500 --- /dev/null +++ b/t/docs-maruku-unittest/wrapping.html @@ -0,0 +1,7 @@ +<p>Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break:<br />Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet.</p> + +<ul> +<li>Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break:<br />Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet</li> + +<li>Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet</li> +</ul> diff --git a/t/docs-maruku-unittest/wrapping.text b/t/docs-maruku-unittest/wrapping.text new file mode 100644 index 0000000..fcfdd9a --- /dev/null +++ b/t/docs-maruku-unittest/wrapping.text @@ -0,0 +1,8 @@ +Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break: +Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. + +* Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet + Lorem ipsum Break: + Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet +* Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet + diff --git a/t/docs-maruku-unittest/xml.html b/t/docs-maruku-unittest/xml.html new file mode 100644 index 0000000..8b39ac8 --- /dev/null +++ b/t/docs-maruku-unittest/xml.html @@ -0,0 +1,6 @@ +<svg:svg /><svg:svg height='400px' width='600px'> + <svg:g id='group'> + <svg:circle cy='3cm' id='circ1' r='1cm' cx='3cm' style='fill:red;' /> + <svg:circle cy='3cm' id='circ2' r='1cm' cx='7cm' style='fill:red;' /> + </svg:g> +</svg:svg> diff --git a/t/docs-maruku-unittest/xml.text b/t/docs-maruku-unittest/xml.text new file mode 100644 index 0000000..98fb57c --- /dev/null +++ b/t/docs-maruku-unittest/xml.text @@ -0,0 +1,11 @@ + +<svg:svg/> + +<svg:svg +width="600px" height="400px"> + <svg:g id="group"> + <svg:circle id="circ1" r="1cm" cx="3cm" cy="3cm" style="fill:red;"></svg:circle> + <svg:circle id="circ2" r="1cm" cx="7cm" cy="3cm" style="fill:red;" /> + </svg:g> +</svg:svg> + diff --git a/t/docs-maruku-unittest/xml2.html b/t/docs-maruku-unittest/xml2.html new file mode 100644 index 0000000..54fef9b --- /dev/null +++ b/t/docs-maruku-unittest/xml2.html @@ -0,0 +1,3 @@ +<!-- +< +--> diff --git a/t/docs-maruku-unittest/xml2.text b/t/docs-maruku-unittest/xml2.text new file mode 100644 index 0000000..54fef9b --- /dev/null +++ b/t/docs-maruku-unittest/xml2.text @@ -0,0 +1,3 @@ +<!-- +< +--> diff --git a/t/docs-maruku-unittest/xml3.html b/t/docs-maruku-unittest/xml3.html new file mode 100644 index 0000000..92c8a1f --- /dev/null +++ b/t/docs-maruku-unittest/xml3.html @@ -0,0 +1,4 @@ +<table>Blah<thead> + <td><em>em</em></td> + </thead> +</table> diff --git a/t/docs-maruku-unittest/xml3.text b/t/docs-maruku-unittest/xml3.text new file mode 100644 index 0000000..17553e1 --- /dev/null +++ b/t/docs-maruku-unittest/xml3.text @@ -0,0 +1,7 @@ +<table markdown='1'> + Blah + <thead> + <td>*em*</td> + </thead> +</table> + diff --git a/t/docs-maruku-unittest/xml_instruction.html b/t/docs-maruku-unittest/xml_instruction.html new file mode 100644 index 0000000..60f8aed --- /dev/null +++ b/t/docs-maruku-unittest/xml_instruction.html @@ -0,0 +1,4 @@ +<? noTarget?><?php ?><?xml ?><?mrk ?> +<p>Targets <? noTarget?> <?php ?> <?xml ?> <?mrk ?></p> + +<p>Inside: <?mrk puts "Inside: Hello"?> last</p> diff --git a/t/docs-maruku-unittest/xml_instruction.text b/t/docs-maruku-unittest/xml_instruction.text new file mode 100644 index 0000000..7e42a41 --- /dev/null +++ b/t/docs-maruku-unittest/xml_instruction.text @@ -0,0 +1,11 @@ + +<? noTarget?> +<?php ?> +<?xml ?> +<?mrk ?> + +Targets <? noTarget?> <?php ?> <?xml ?> <?mrk ?> + +Inside: <?mrk puts "Inside: Hello" ?> last + + diff --git a/t/docs-php-markdown-extra/Abbr.html b/t/docs-php-markdown-extra/Abbr.html new file mode 100644 index 0000000..89d618d --- /dev/null +++ b/t/docs-php-markdown-extra/Abbr.html @@ -0,0 +1,11 @@ +<p>Some text about <abbr title="Hyper Text Markup Language">HTML</abbr>, <abbr title="Standard Generalized Markup Language">SGML</abbr> and <abbr title="Hyper Text Markup Language version 4">HTML4</abbr>.</p> + +<p>Let's talk about the <abbr title="United States of America">U.S.A.</abbr>, (<abbr title="États-Unis d'Amérique">É.U.</abbr> or <abbr title="États-Unis d'Amérique">É.-U. d'A.</abbr> in French).</p> + +<p>And here we have a <abbr title="Compact Disk">CD</abbr>, some CDs, and some other <abbr title="Compact Disk">CD</abbr>'s.</p> + +<p>Let's transfert documents through <abbr title="Transmission Control Protocol">TCP</abbr>/<abbr title="Internet Protocol">IP</abbr>, using <abbr title="Transmission Control Protocol">TCP</abbr> packets.</p> + +<hr /> + +<p>Bienvenue sur <a href="http://www.bidulecms.com" title="Bidule CMS"><abbr title="Content Management System">CMS</abbr></a>.</p> diff --git a/t/docs-php-markdown-extra/Abbr.text b/t/docs-php-markdown-extra/Abbr.text new file mode 100644 index 0000000..5dd4ef2 --- /dev/null +++ b/t/docs-php-markdown-extra/Abbr.text @@ -0,0 +1,25 @@ +Some text about HTML, SGML and HTML4. + +Let's talk about the U.S.A., (É.U. or É.-U. d'A. in French). + +*[HTML4]: Hyper Text Markup Language version 4 +*[HTML]: Hyper Text Markup Language +*[SGML]: Standard Generalized Markup Language +*[U.S.A.]: United States of America +*[É.U.] : États-Unis d'Amérique +*[É.-U. d'A.] : États-Unis d'Amérique + +And here we have a CD, some CDs, and some other CD's. + +*[CD]: Compact Disk + +Let's transfert documents through TCP/IP, using TCP packets. + +*[IP]: Internet Protocol +*[TCP]: Transmission Control Protocol + + --- + +Bienvenue sur [CMS](http://www.bidulecms.com "Bidule CMS"). + +*[CMS]: Content Management System
\ No newline at end of file diff --git a/t/docs-php-markdown-extra/Definition_Lists.html b/t/docs-php-markdown-extra/Definition_Lists.html new file mode 100644 index 0000000..0ab9f40 --- /dev/null +++ b/t/docs-php-markdown-extra/Definition_Lists.html @@ -0,0 +1,142 @@ +<p>A simple definition list:</p> + +<dl> +<dt>Term 1</dt> +<dd>Definition 1</dd> + +<dt>Term 2</dt> +<dd>Definition 2</dd> +</dl> + +<p>With multiple terms:</p> + +<dl> +<dt>Term 1</dt> +<dt>Term 2</dt> +<dd>Definition 1</dd> + +<dt>Term 3</dt> +<dt>Term 4</dt> +<dd>Definition 2</dd> +</dl> + +<p>With multiple definitions:</p> + +<dl> +<dt>Term 1</dt> +<dd>Definition 1</dd> + +<dd>Definition 2</dd> + +<dt>Term 2</dt> +<dd>Definition 3</dd> + +<dd>Definition 4</dd> +</dl> + +<p>With multiple lines per definition:</p> + +<dl> +<dt>Term 1</dt> +<dd>Definition 1 line 1 ... +Definition 1 line 2</dd> + +<dd>Definition 2 line 1 ... +Definition 2 line 2</dd> + +<dt>Term 2</dt> +<dd>Definition 3 line 2 ... +Definition 3 line 2</dd> + +<dd>Definition 4 line 2 ... +Definition 4 line 2</dd> +</dl> + +<p>With paragraphs:</p> + +<dl> +<dt>Term 1</dt> +<dd> +<p>Definition 1 (paragraph)</p> +</dd> + +<dt>Term 2</dt> +<dd> +<p>Definition 2 (paragraph)</p> +</dd> +</dl> + +<p>With multiple paragraphs:</p> + +<dl> +<dt>Term 1</dt> +<dd> +<p>Definition 1 paragraph 1 line 1 ... +Definition 1 paragraph 1 line 2</p> + +<p>Definition 1 paragraph 2 line 1 ... +Definition 1 paragraph 2 line 2</p> +</dd> + +<dt>Term 2</dt> +<dd> +<p>Definition 1 paragraph 1 line 1 ... +Definition 1 paragraph 1 line 2 (lazy)</p> + +<p>Definition 1 paragraph 2 line 1 ... +Definition 1 paragraph 2 line 2 (lazy)</p> +</dd> +</dl> + +<hr /> + +<p>A mix:</p> + +<dl> +<dt>Term 1</dt> +<dt>Term 2</dt> +<dd> +<p>Definition 1 paragraph 1 line 1 ... +Definition 1 paragraph 1 line 2 (lazy)</p> + +<p>Definition 1 paragraph 2 line 1 ... +Definition 1 paragraph 2 line 2</p> +</dd> + +<dd> +<p>Definition 2 paragraph 1 line 1 ... +Definition 2 paragraph 1 line 2 (lazy)</p> +</dd> + +<dt>Term 3</dt> +<dd>Definition 3 (no paragraph)</dd> + +<dd>Definition 4 (no paragraph)</dd> + +<dd>Definition 5 line 1 ... +Definition 5 line 2 (no paragraph)</dd> + +<dd> +<p>Definition 6 paragraph 1 line 1 ... +Definition 6 paragraph 1 line 2</p> +</dd> + +<dd>Definition 7 (no paragraph)</dd> + +<dd> +<p>Definition 8 paragraph 1 line 1 (forced paragraph) ... +Definition 8 paragraph 1 line 2</p> + +<p>Definition 8 paragraph 2 line 1</p> +</dd> + +<dt>Term 4</dt> +<dd> +<p>Definition 9 paragraph 1 line 1 (forced paragraph) ... +Definition 9 paragraph 1 line 2</p> + +<p>Definition 9 paragraph 2 line 1</p> +</dd> + +<dd>Definition 10 (no paragraph)</dd> +</dl> diff --git a/t/docs-php-markdown-extra/Definition_Lists.text b/t/docs-php-markdown-extra/Definition_Lists.text new file mode 100644 index 0000000..eae1fb5 --- /dev/null +++ b/t/docs-php-markdown-extra/Definition_Lists.text @@ -0,0 +1,106 @@ +A simple definition list: + +Term 1 +: Definition 1 + +Term 2 +: Definition 2 + +With multiple terms: + +Term 1 +Term 2 +: Definition 1 + +Term 3 +Term 4 +: Definition 2 + +With multiple definitions: + +Term 1 +: Definition 1 +: Definition 2 + +Term 2 +: Definition 3 +: Definition 4 + +With multiple lines per definition: + +Term 1 +: Definition 1 line 1 ... +Definition 1 line 2 +: Definition 2 line 1 ... +Definition 2 line 2 + +Term 2 +: Definition 3 line 2 ... + Definition 3 line 2 +: Definition 4 line 2 ... + Definition 4 line 2 + +With paragraphs: + +Term 1 + +: Definition 1 (paragraph) + +Term 2 + +: Definition 2 (paragraph) + +With multiple paragraphs: + +Term 1 + +: Definition 1 paragraph 1 line 1 ... + Definition 1 paragraph 1 line 2 + + Definition 1 paragraph 2 line 1 ... + Definition 1 paragraph 2 line 2 + +Term 2 + +: Definition 1 paragraph 1 line 1 ... +Definition 1 paragraph 1 line 2 (lazy) + + Definition 1 paragraph 2 line 1 ... +Definition 1 paragraph 2 line 2 (lazy) + +* * * + +A mix: + +Term 1 +Term 2 + +: Definition 1 paragraph 1 line 1 ... +Definition 1 paragraph 1 line 2 (lazy) + + Definition 1 paragraph 2 line 1 ... + Definition 1 paragraph 2 line 2 + +: Definition 2 paragraph 1 line 1 ... +Definition 2 paragraph 1 line 2 (lazy) + +Term 3 +: Definition 3 (no paragraph) +: Definition 4 (no paragraph) +: Definition 5 line 1 ... + Definition 5 line 2 (no paragraph) + +: Definition 6 paragraph 1 line 1 ... +Definition 6 paragraph 1 line 2 +: Definition 7 (no paragraph) +: Definition 8 paragraph 1 line 1 (forced paragraph) ... + Definition 8 paragraph 1 line 2 + + Definition 8 paragraph 2 line 1 + +Term 4 +: Definition 9 paragraph 1 line 1 (forced paragraph) ... + Definition 9 paragraph 1 line 2 + + Definition 9 paragraph 2 line 1 +: Definition 10 (no paragraph)
\ No newline at end of file diff --git a/t/docs-php-markdown-extra/Emphasis.html b/t/docs-php-markdown-extra/Emphasis.html new file mode 100644 index 0000000..dfb11a7 --- /dev/null +++ b/t/docs-php-markdown-extra/Emphasis.html @@ -0,0 +1,72 @@ +<p>Combined emphasis:</p> + +<ol> +<li><strong><em>test test</em></strong></li> +<li><strong><em>test test</em></strong></li> +<li><em>test <strong>test</strong></em></li> +<li><strong>test <em>test</em></strong></li> +<li><strong><em>test</em> test</strong></li> +<li><em><strong>test</strong> test</em></li> +<li><strong><em>test</em> test</strong></li> +<li><strong>test <em>test</em></strong></li> +<li><em>test <strong>test</strong></em></li> +<li><em>test <strong>test</strong></em></li> +<li><strong>test <em>test</em></strong></li> +<li><strong><em>test</em> test</strong></li> +<li><em><strong>test</strong> test</em></li> +<li><strong><em>test</em> test</strong></li> +<li><strong>test <em>test</em></strong></li> +<li><em>test <strong>test</strong></em></li> +</ol> + +<p>Incorrect nesting:</p> + +<ol> +<li>*test <strong>test* test</strong></li> +<li>_test <strong>test_ test</strong></li> +<li>**test <em>test</em>* test*</li> +<li>__test <em>test</em>_ test_</li> +<li><em>test *test</em> test*</li> +<li><em>test _test</em> test_</li> +<li><strong>test <strong>test</strong> test</strong></li> +<li><strong>test <strong>test</strong> test</strong></li> +</ol> + +<p>No emphasis:</p> + +<ol> +<li>test* test *test</li> +<li>test** test **test</li> +<li>test_ test _test</li> +<li>test__ test __test</li> +</ol> + +<p>Middle-word emphasis (asterisks):</p> + +<ol> +<li><em>a</em>b</li> +<li>a<em>b</em></li> +<li>a<em>b</em>c</li> +<li><strong>a</strong>b</li> +<li>a<strong>b</strong></li> +<li>a<strong>b</strong>c</li> +</ol> + +<p>Middle-word emphasis (underscore):</p> + +<ol> +<li>_a_b</li> +<li>a_b_</li> +<li>a_b_c</li> +<li>__a__b</li> +<li>a__b__</li> +<li>a__b__c</li> +</ol> + +<p>my_precious_file.txt</p> + +<h2>Tricky Cases</h2> + +<p>E**. <strong>Test</strong> TestTestTest</p> + +<p>E**. <strong>Test</strong> Test Test Test</p> diff --git a/t/docs-php-markdown-extra/Emphasis.text b/t/docs-php-markdown-extra/Emphasis.text new file mode 100644 index 0000000..ec48dec --- /dev/null +++ b/t/docs-php-markdown-extra/Emphasis.text @@ -0,0 +1,69 @@ +Combined emphasis: + +1. ***test test*** +2. ___test test___ +3. *test **test*** +4. **test *test*** +5. ***test* test** +6. ***test** test* +7. ***test* test** +8. **test *test*** +9. *test **test*** +10. _test __test___ +11. __test _test___ +12. ___test_ test__ +13. ___test__ test_ +14. ___test_ test__ +15. __test _test___ +16. _test __test___ + + +Incorrect nesting: + +1. *test **test* test** +2. _test __test_ test__ +3. **test *test** test* +4. __test _test__ test_ +5. *test *test* test* +6. _test _test_ test_ +7. **test **test** test** +8. __test __test__ test__ + + + +No emphasis: + +1. test* test *test +2. test** test **test +3. test_ test _test +4. test__ test __test + + + +Middle-word emphasis (asterisks): + +1. *a*b +2. a*b* +3. a*b*c +4. **a**b +5. a**b** +6. a**b**c + + +Middle-word emphasis (underscore): + +1. _a_b +2. a_b_ +3. a_b_c +4. __a__b +5. a__b__ +6. a__b__c + +my_precious_file.txt + + +## Tricky Cases + +E**. **Test** TestTestTest + +E**. **Test** Test Test Test diff --git a/t/docs-php-markdown-extra/Footnotes.html b/t/docs-php-markdown-extra/Footnotes.html new file mode 100644 index 0000000..d689588 --- /dev/null +++ b/t/docs-php-markdown-extra/Footnotes.html @@ -0,0 +1,83 @@ +<p>This is the first paragraph.<sup id="fnref:first"><a href="#fn:first" rel="footnote">1</a></sup></p> + +<ul> +<li>List item one.<sup id="fnref:second"><a href="#fn:second" rel="footnote">2</a></sup></li> +<li>List item two.<sup id="fnref:third"><a href="#fn:third" rel="footnote">3</a></sup></li> +</ul> + +<h1>Header<sup id="fnref:fourth"><a href="#fn:fourth" rel="footnote">4</a></sup></h1> + +<p>Some paragraph with a footnote<sup id="fnref:1"><a href="#fn:1" rel="footnote">5</a></sup>, and another<sup id="fnref:2"><a href="#fn:2" rel="footnote">6</a></sup>.</p> + +<p>Another paragraph with a named footnote<sup id="fnref:fn-name"><a href="#fn:fn-name" rel="footnote">7</a></sup>.</p> + +<p>This paragraph should not have a footnote marker since +the footnote is undefined.[^3]</p> + +<p>This paragraph should not have a footnote marker since +the footnote has already been used before.[^1]</p> + +<p>This paragraph links to a footnote with plenty of +block-level content.<sup id="fnref:block"><a href="#fn:block" rel="footnote">8</a></sup></p> + +<p>This paragraph host the footnote reference within a +footnote test<sup id="fnref:reference"><a href="#fn:reference" rel="footnote">9</a></sup>.</p> + +<div class="footnotes"> +<hr /> +<ol> + +<li id="fn:first"> +<p>This is the first note. <a href="#fnref:first" rev="footnote">↩</a></p> +</li> + +<li id="fn:second"> +<p>This is the second note. <a href="#fnref:second" rev="footnote">↩</a></p> +</li> + +<li id="fn:third"> +<p>This is the third note, defined out of order. <a href="#fnref:third" rev="footnote">↩</a></p> +</li> + +<li id="fn:fourth"> +<p>This is the fourth note. <a href="#fnref:fourth" rev="footnote">↩</a></p> +</li> + +<li id="fn:1"> +<p>Content for fifth footnote. <a href="#fnref:1" rev="footnote">↩</a></p> +</li> + +<li id="fn:2"> +<p>Content for sixth footnote spaning on +three lines, with some span-level markup like +<em>emphasis</em>, a <a href="http://www.michelf.com/">link</a>. <a href="#fnref:2" rev="footnote">↩</a></p> +</li> + +<li id="fn:fn-name"> +<p>Footnote beginning on the line next to the marker. <a href="#fnref:fn-name" rev="footnote">↩</a></p> +</li> + +<li id="fn:block"> +<p>Paragraph.</p> + +<ul> +<li>List item</li> +</ul> + +<blockquote> + <p>Blockquote</p> +</blockquote> + +<pre><code>Code block +</code></pre> + +<p><a href="#fnref:block" rev="footnote">↩</a></p> +</li> + +<li id="fn:reference"> +<p>This footnote attemps to refer to another footnote. This +should be impossible.[^impossible] <a href="#fnref:reference" rev="footnote">↩</a></p> +</li> + +</ol> +</div> diff --git a/t/docs-php-markdown-extra/Footnotes.text b/t/docs-php-markdown-extra/Footnotes.text new file mode 100644 index 0000000..d2cadf1 --- /dev/null +++ b/t/docs-php-markdown-extra/Footnotes.text @@ -0,0 +1,55 @@ +This is the first paragraph.[^first] + +[^first]: This is the first note. + +* List item one.[^second] +* List item two.[^third] + +[^third]: This is the third note, defined out of order. +[^second]: This is the second note. +[^fourth]: This is the fourth note. + +# Header[^fourth] + +Some paragraph with a footnote[^1], and another[^2]. + +[^1]: Content for fifth footnote. +[^2]: Content for sixth footnote spaning on + three lines, with some span-level markup like + _emphasis_, a [link][]. + +[link]: http://www.michelf.com/ + +Another paragraph with a named footnote[^fn-name]. + +[^fn-name]: + Footnote beginning on the line next to the marker. + +This paragraph should not have a footnote marker since +the footnote is undefined.[^3] + +This paragraph should not have a footnote marker since +the footnote has already been used before.[^1] + +This paragraph links to a footnote with plenty of +block-level content.[^block] + +[^block]: + Paragraph. + + * List item + + > Blockquote + + Code block + +This paragraph host the footnote reference within a +footnote test[^reference]. + +[^reference]: + This footnote attemps to refer to another footnote. This + should be impossible.[^impossible] + +[^impossible]: + This footnote should not appear, as it is refered from + another footnote, which is not allowed. diff --git a/t/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.html b/t/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.html new file mode 100644 index 0000000..4751f78 --- /dev/null +++ b/t/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.html @@ -0,0 +1,125 @@ +<h1>Markdown inside code blocks</h1> + +<div> + +<p>foo</p> + +</div> + +<div> + +<p>foo</p> + +</div> + +<div> + +<p>foo</p> + +</div> + +<table> +<tr><td>test <em>emphasis</em> (span)</td></tr> +</table> + +<table> +<tr><td>test <em>emphasis</em> (span)</td></tr> +</table> + +<table> +<tr><td> + +<p>test <em>emphasis</em> (block)</p> + +</td></tr> +</table> + +<h2>More complicated</h2> + +<table> +<tr><td> +* this is <em>not</em> a list item</td></tr> +<tr><td> +* this is <em>not</em> a list item</td></tr> +<tr><td> + +<ul> +<li>this <em>is</em> a list item</li> +</ul> + +</td></tr> +</table> + +<h2>With indent</h2> + +<div> + <div> + +<p>This text is no code block: if it was, the +closing <code><div></code> would be too and the HTML block +would be invalid.</p> + +<p>Markdown content in HTML blocks is assumed to be +indented the same as the block opening tag.</p> + +<p><strong>This should be the third paragraph after the header.</strong></p> + +</div> +</div> + +<h2>Code block with rogue <code></div></code>s in Markdown code span and block</h2> + +<div> + <div> + +<p>This is a code block however:</p> + +<pre><code></div> +</code></pre> + +<p>Funny isn't it? Here is a code span: <code></div></code>.</p> + +</div> +</div> + +<div> + <div> + +<ul> +<li>List item, not a code block</li> +</ul> + +<p>Some text</p> + +<pre><code>This is a code block. +</code></pre> + +</div> +</div> + +<h2>No code block in markdown span mode</h2> + +<p> + This is not a code block since Markdown parse paragraph + content as span. Code spans like <code></p></code> are allowed though. +</p> + +<p><em>Hello</em> <em>world</em></p> + +<h2>Preserving attributes and tags on more than one line:</h2> + +<p class="test" +id="12"> +Some <em>span</em> content. +</p> + +<h2>Header confusion bug</h2> + +<table class="canvas"> +<tr> +<td id="main">Hello World! +============ + +Hello World!</td> +</tr> +</table>
\ No newline at end of file diff --git a/t/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.text b/t/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.text new file mode 100644 index 0000000..1eb5450 --- /dev/null +++ b/t/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.text @@ -0,0 +1,104 @@ +# Markdown inside code blocks + +<div markdown="1"> +foo +</div> + +<div markdown='1'> +foo +</div> + +<div markdown=1> +foo +</div> + +<table> +<tr><td markdown="1">test _emphasis_ (span)</td></tr> +</table> + +<table> +<tr><td markdown="span">test _emphasis_ (span)</td></tr> +</table> + +<table> +<tr><td markdown="block">test _emphasis_ (block)</td></tr> +</table> + +## More complicated + +<table> +<tr><td markdown="1"> +* this is _not_ a list item</td></tr> +<tr><td markdown="span"> +* this is _not_ a list item</td></tr> +<tr><td markdown="block"> +* this _is_ a list item +</td></tr> +</table> + +## With indent + +<div> + <div markdown="1"> + This text is no code block: if it was, the + closing `<div>` would be too and the HTML block + would be invalid. + + Markdown content in HTML blocks is assumed to be + indented the same as the block opening tag. + + **This should be the third paragraph after the header.** + </div> +</div> + +## Code block with rogue `</div>`s in Markdown code span and block + +<div> + <div markdown="1"> + + This is a code block however: + + </div> + + Funny isn't it? Here is a code span: `</div>`. + + </div> +</div> + +<div> + <div markdown="1"> + * List item, not a code block + +Some text + + This is a code block. + </div> +</div> + +## No code block in markdown span mode + +<p markdown="1"> + This is not a code block since Markdown parse paragraph + content as span. Code spans like `</p>` are allowed though. +</p> + +<p markdown="1">_Hello_ _world_</p> + +## Preserving attributes and tags on more than one line: + +<p class="test" markdown="1" +id="12"> +Some _span_ content. +</p> + + +## Header confusion bug + +<table class="canvas"> +<tr> +<td id="main" markdown="1">Hello World! +============ + +Hello World!</td> +</tr> +</table> diff --git a/t/docs-php-markdown-extra/Tables.html b/t/docs-php-markdown-extra/Tables.html new file mode 100644 index 0000000..e36286c --- /dev/null +++ b/t/docs-php-markdown-extra/Tables.html @@ -0,0 +1,310 @@ +<h1>Simple tables</h1> + +<table> +<thead> +<tr> + <th>Header 1</th> + <th>Header 2</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell 1</td> + <td>Cell 2</td> +</tr> +<tr> + <td>Cell 3</td> + <td>Cell 4</td> +</tr> +</tbody> +</table> + +<p>With leading pipes:</p> + +<table> +<thead> +<tr> + <th>Header 1</th> + <th>Header 2</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell 1</td> + <td>Cell 2</td> +</tr> +<tr> + <td>Cell 3</td> + <td>Cell 4</td> +</tr> +</tbody> +</table> + +<p>With tailing pipes:</p> + +<table> +<thead> +<tr> + <th>Header 1</th> + <th>Header 2</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell 1</td> + <td>Cell 2</td> +</tr> +<tr> + <td>Cell 3</td> + <td>Cell 4</td> +</tr> +</tbody> +</table> + +<p>With leading and tailing pipes:</p> + +<table> +<thead> +<tr> + <th>Header 1</th> + <th>Header 2</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell 1</td> + <td>Cell 2</td> +</tr> +<tr> + <td>Cell 3</td> + <td>Cell 4</td> +</tr> +</tbody> +</table> + +<hr /> + +<h1>One-column one-row table</h1> + +<p>With leading pipes:</p> + +<table> +<thead> +<tr> + <th>Header</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell</td> +</tr> +</tbody> +</table> + +<p>With tailing pipes:</p> + +<table> +<thead> +<tr> + <th>Header</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell</td> +</tr> +</tbody> +</table> + +<p>With leading and tailing pipes:</p> + +<table> +<thead> +<tr> + <th>Header</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell</td> +</tr> +</tbody> +</table> + +<hr /> + +<p>Table alignement:</p> + +<table> +<thead> +<tr> + <th>Default</th> + <th align="left">Right</th> + <th align="center">Center</th> + <th align="right">Left</th> +</tr> +</thead> +<tbody> +<tr> + <td>Long Cell</td> + <td align="left">Long Cell</td> + <td align="center">Long Cell</td> + <td align="right">Long Cell</td> +</tr> +<tr> + <td>Cell</td> + <td align="left">Cell</td> + <td align="center">Cell</td> + <td align="right">Cell</td> +</tr> +</tbody> +</table> + +<p>Table alignement (alternate spacing):</p> + +<table> +<thead> +<tr> + <th>Default</th> + <th align="left">Right</th> + <th align="center">Center</th> + <th align="right">Left</th> +</tr> +</thead> +<tbody> +<tr> + <td>Long Cell</td> + <td align="left">Long Cell</td> + <td align="center">Long Cell</td> + <td align="right">Long Cell</td> +</tr> +<tr> + <td>Cell</td> + <td align="left">Cell</td> + <td align="center">Cell</td> + <td align="right">Cell</td> +</tr> +</tbody> +</table> + +<hr /> + +<h1>Empty cells</h1> + +<table> +<thead> +<tr> + <th>Header 1</th> + <th>Header 2</th> +</tr> +</thead> +<tbody> +<tr> + <td>A</td> + <td>B</td> +</tr> +<tr> + <td>C</td> + <td></td> +</tr> +</tbody> +</table> + +<table> +<thead> +<tr> + <th>Header 1</th> + <th>Header 2</th> +</tr> +</thead> +<tbody> +<tr> + <td>A</td> + <td>B</td> +</tr> +<tr> + <td></td> + <td>D</td> +</tr> +</tbody> +</table> + +<hr /> + +<h1>Missing tailing pipe</h1> + +<table> +<thead> +<tr> + <th>Header 1</th> + <th>Header 2</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell</td> + <td>Cell</td> +</tr> +<tr> + <td>Cell</td> + <td>Cell</td> +</tr> +</tbody> +</table> + +<table> +<thead> +<tr> + <th>Header 1</th> + <th>Header 2</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell</td> + <td>Cell</td> +</tr> +<tr> + <td>Cell</td> + <td>Cell</td> +</tr> +</tbody> +</table> + +<table> +<thead> +<tr> + <th>Header 1</th> + <th>Header 2</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell</td> + <td>Cell</td> +</tr> +<tr> + <td>Cell</td> + <td>Cell</td> +</tr> +</tbody> +</table> + +<table> +<thead> +<tr> + <th>Header 1</th> + <th>Header 2</th> +</tr> +</thead> +<tbody> +<tr> + <td>Cell</td> + <td>Cell</td> +</tr> +<tr> + <td>Cell</td> + <td>Cell</td> +</tr> +</tbody> +</table>
\ No newline at end of file diff --git a/t/docs-php-markdown-extra/Tables.text b/t/docs-php-markdown-extra/Tables.text new file mode 100644 index 0000000..71b93ca --- /dev/null +++ b/t/docs-php-markdown-extra/Tables.text @@ -0,0 +1,104 @@ +# Simple tables + +Header 1 | Header 2 +--------- | --------- +Cell 1 | Cell 2 +Cell 3 | Cell 4 + +With leading pipes: + +| Header 1 | Header 2 +| --------- | --------- +| Cell 1 | Cell 2 +| Cell 3 | Cell 4 + +With tailing pipes: + +Header 1 | Header 2 | +--------- | --------- | +Cell 1 | Cell 2 | +Cell 3 | Cell 4 | + +With leading and tailing pipes: + +| Header 1 | Header 2 | +| --------- | --------- | +| Cell 1 | Cell 2 | +| Cell 3 | Cell 4 | + +* * * + +# One-column one-row table + +With leading pipes: + +| Header +| ------- +| Cell + +With tailing pipes: + +Header | +------- | +Cell | + +With leading and tailing pipes: + +| Header | +| ------- | +| Cell | + +* * * + +Table alignement: + +| Default | Right | Center | Left | +| --------- |:--------- |:---------:| ---------:| +| Long Cell | Long Cell | Long Cell | Long Cell | +| Cell | Cell | Cell | Cell | + +Table alignement (alternate spacing): + +| Default | Right | Center | Left | +| --------- | :-------- | :-------: | --------: | +| Long Cell | Long Cell | Long Cell | Long Cell | +| Cell | Cell | Cell | Cell | + +* * * + +# Empty cells + +| Header 1 | Header 2 | +| --------- | --------- | +| A | B | +| C | | + +Header 1 | Header 2 +--------- | --------- +A | B + | D + +* * * + +# Missing tailing pipe + +Header 1 | Header 2 +--------- | --------- | +Cell | Cell | +Cell | Cell | + +Header 1 | Header 2 | +--------- | --------- +Cell | Cell | +Cell | Cell | + +Header 1 | Header 2 | +--------- | --------- | +Cell | Cell +Cell | Cell | + +Header 1 | Header 2 | +--------- | --------- | +Cell | Cell | +Cell | Cell + diff --git a/t/docs-php-markdown-todo/Email_auto_links.html b/t/docs-php-markdown-todo/Email_auto_links.html new file mode 100644 index 0000000..a32c408 --- /dev/null +++ b/t/docs-php-markdown-todo/Email_auto_links.html @@ -0,0 +1,3 @@ +<p><a href="mailto:michel.fortin@michelf.com">michel.fortin@michelf.com</a></p> + +<p>International domain names: <a href="mailto:help@tūdaliņ.lv">help@tūdaliņ.lv</a></p> diff --git a/t/docs-php-markdown-todo/Email_auto_links.text b/t/docs-php-markdown-todo/Email_auto_links.text new file mode 100644 index 0000000..a8af4ec --- /dev/null +++ b/t/docs-php-markdown-todo/Email_auto_links.text @@ -0,0 +1,3 @@ +<michel.fortin@michelf.com> + +International domain names: <help@tūdaliņ.lv>
\ No newline at end of file diff --git a/t/docs-php-markdown-todo/Emphasis.html b/t/docs-php-markdown-todo/Emphasis.html new file mode 100644 index 0000000..7399132 --- /dev/null +++ b/t/docs-php-markdown-todo/Emphasis.html @@ -0,0 +1,72 @@ +<p>Combined emphasis:</p> + +<ol> +<li><strong><em>test test</em></strong></li> +<li><strong><em>test test</em></strong></li> +<li><em>test <strong>test</strong></em></li> +<li><strong>test <em>test</em></strong></li> +<li><strong><em>test</em> test</strong></li> +<li><em><strong>test</strong> test</em></li> +<li><strong><em>test</em> test</strong></li> +<li><strong>test <em>test</em></strong></li> +<li><em>test <strong>test</strong></em></li> +<li><em>test <strong>test</strong></em></li> +<li><strong>test <em>test</em></strong></li> +<li><strong><em>test</em> test</strong></li> +<li><em><strong>test</strong> test</em></li> +<li><strong><em>test</em> test</strong></li> +<li><strong>test <em>test</em></strong></li> +<li><em>test <strong>test</strong></em></li> +</ol> + +<p>Incorrect nesting:</p> + +<ol> +<li>*test <strong>test* test</strong></li> +<li>_test <strong>test_ test</strong></li> +<li>**test <em>test</em>* test*</li> +<li>__test <em>test</em>_ test_</li> +<li><em>test *test</em> test*</li> +<li><em>test _test</em> test_</li> +<li><strong>test <strong>test</strong> test</strong></li> +<li><strong>test <strong>test</strong> test</strong></li> +</ol> + +<p>No emphasis:</p> + +<ol> +<li>test* test *test</li> +<li>test** test **test</li> +<li>test_ test _test</li> +<li>test__ test __test</li> +</ol> + +<p>Middle-word emphasis (asterisks):</p> + +<ol> +<li><em>a</em>b</li> +<li>a<em>b</em></li> +<li>a<em>b</em>c</li> +<li><strong>a</strong>b</li> +<li>a<strong>b</strong></li> +<li>a<strong>b</strong>c</li> +</ol> + +<p>Middle-word emphasis (underscore):</p> + +<ol> +<li><em>a</em>b</li> +<li>a<em>b</em></li> +<li>a<em>b</em>c</li> +<li><strong>a</strong>b</li> +<li>a<strong>b</strong></li> +<li>a<strong>b</strong>c</li> +</ol> + +<p>my<em>precious</em>file.txt</p> + +<h2>Tricky Cases</h2> + +<p>E**. <strong>Test</strong> TestTestTest</p> + +<p>E**. <strong>Test</strong> Test Test Test</p> diff --git a/t/docs-php-markdown-todo/Emphasis.text b/t/docs-php-markdown-todo/Emphasis.text new file mode 100644 index 0000000..ec48dec --- /dev/null +++ b/t/docs-php-markdown-todo/Emphasis.text @@ -0,0 +1,69 @@ +Combined emphasis: + +1. ***test test*** +2. ___test test___ +3. *test **test*** +4. **test *test*** +5. ***test* test** +6. ***test** test* +7. ***test* test** +8. **test *test*** +9. *test **test*** +10. _test __test___ +11. __test _test___ +12. ___test_ test__ +13. ___test__ test_ +14. ___test_ test__ +15. __test _test___ +16. _test __test___ + + +Incorrect nesting: + +1. *test **test* test** +2. _test __test_ test__ +3. **test *test** test* +4. __test _test__ test_ +5. *test *test* test* +6. _test _test_ test_ +7. **test **test** test** +8. __test __test__ test__ + + + +No emphasis: + +1. test* test *test +2. test** test **test +3. test_ test _test +4. test__ test __test + + + +Middle-word emphasis (asterisks): + +1. *a*b +2. a*b* +3. a*b*c +4. **a**b +5. a**b** +6. a**b**c + + +Middle-word emphasis (underscore): + +1. _a_b +2. a_b_ +3. a_b_c +4. __a__b +5. a__b__ +6. a__b__c + +my_precious_file.txt + + +## Tricky Cases + +E**. **Test** TestTestTest + +E**. **Test** Test Test Test diff --git a/t/docs-php-markdown-todo/Inline_HTML_(Span).html b/t/docs-php-markdown-todo/Inline_HTML_(Span).html new file mode 100644 index 0000000..4d18aff --- /dev/null +++ b/t/docs-php-markdown-todo/Inline_HTML_(Span).html @@ -0,0 +1,4 @@ +<p><abbr title="` **Attribute Content Is Not A Code Span** `">ACINACS</abbr></p> + +<p><abbr title="`first backtick!">SB</abbr> +<abbr title="`second backtick!">SB</abbr></p>
\ No newline at end of file diff --git a/t/docs-php-markdown-todo/Inline_HTML_(Span).text b/t/docs-php-markdown-todo/Inline_HTML_(Span).text new file mode 100644 index 0000000..19028bb --- /dev/null +++ b/t/docs-php-markdown-todo/Inline_HTML_(Span).text @@ -0,0 +1,4 @@ +<abbr title="` **Attribute Content Is Not A Code Span** `">ACINACS</abbr> + +<abbr title="`first backtick!">SB</abbr> +<abbr title="`second backtick!">SB</abbr>
\ No newline at end of file diff --git a/t/docs-php-markdown-todo/Ins_and_del.text b/t/docs-php-markdown-todo/Ins_and_del.text new file mode 100644 index 0000000..2d54c66 --- /dev/null +++ b/t/docs-php-markdown-todo/Ins_and_del.text @@ -0,0 +1,17 @@ +Here is a block tag ins: + +<ins> +<p>Some text</p> +</ins> + +<ins>And here it is inside a paragraph.</ins> + +And here it is <ins>in the middle of</ins> a paragraph. + +<del> +<p>Some text</p> +</del> + +<del>And here is ins as a paragraph.</del> + +And here it is <del>in the middle of</del> a paragraph. diff --git a/t/docs-php-markdown-todo/Ins_and_del.xhtml b/t/docs-php-markdown-todo/Ins_and_del.xhtml new file mode 100644 index 0000000..60e8c5f --- /dev/null +++ b/t/docs-php-markdown-todo/Ins_and_del.xhtml @@ -0,0 +1,17 @@ +<p>Here is a block tag ins:</p> + +<ins> +<p>Some text</p> +</ins> + +<p><ins>And here it is inside a paragraph.</ins></p> + +<p>And here it is <ins>in the middle of</ins> a paragraph.</p> + +<del> +<p>Some text</p> +</del> + +<p><del>And here is ins as a paragraph.</del></p> + +<p>And here it is <del>in the middle of</del> a paragraph.</p> diff --git a/t/docs-php-markdown-todo/Links_inline_style.html b/t/docs-php-markdown-todo/Links_inline_style.html new file mode 100644 index 0000000..d3e4d11 --- /dev/null +++ b/t/docs-php-markdown-todo/Links_inline_style.html @@ -0,0 +1 @@ +<p><a href="?}]*+|&)">silly URL w/ angle brackets</a>.</p> diff --git a/t/docs-php-markdown-todo/Links_inline_style.text b/t/docs-php-markdown-todo/Links_inline_style.text new file mode 100644 index 0000000..600a044 --- /dev/null +++ b/t/docs-php-markdown-todo/Links_inline_style.text @@ -0,0 +1 @@ +[silly URL w/ angle brackets](<?}]*+|&)>). diff --git a/t/docs-php-markdown-todo/Nesting.html b/t/docs-php-markdown-todo/Nesting.html new file mode 100644 index 0000000..37845d3 --- /dev/null +++ b/t/docs-php-markdown-todo/Nesting.html @@ -0,0 +1,11 @@ +<p>Valid nesting:</p> + +<p><strong><a href="url">Link</a></strong></p> + +<p><a href="url"><strong>Link</strong></a></p> + +<p><strong><a href="url"><strong>Link</strong></a></strong></p> + +<p>Invalid nesting:</p> + +<p><a href="url">[Link](url)</a></p> diff --git a/t/docs-php-markdown-todo/Nesting.text b/t/docs-php-markdown-todo/Nesting.text new file mode 100644 index 0000000..791538c --- /dev/null +++ b/t/docs-php-markdown-todo/Nesting.text @@ -0,0 +1,11 @@ +Valid nesting: + +**[Link](url)** + +[**Link**](url) + +**[**Link**](url)** + +Invalid nesting: + +[[Link](url)](url)
\ No newline at end of file diff --git a/t/docs-php-markdown-todo/Parens_in_URL.html b/t/docs-php-markdown-todo/Parens_in_URL.html new file mode 100644 index 0000000..a81aa02 --- /dev/null +++ b/t/docs-php-markdown-todo/Parens_in_URL.html @@ -0,0 +1,11 @@ +<p><a href="/url(test)" title="title">Inline link 1 with parens</a>.</p> + +<p><a href="/url(test)" title="title">Inline link 2 with parens</a>.</p> + +<p><a href="/url(test)" title="title">Inline link 3 with non-escaped parens</a>.</p> + +<p><a href="/url(test)" title="title">Inline link 4 with non-escaped parens</a>.</p> + +<p><a href="/url(test)" title="title">Reference link 1 with parens</a>.</p> + +<p><a href="/url(test)" title="title">Reference link 2 with parens</a>.</p>
\ No newline at end of file diff --git a/t/docs-php-markdown-todo/Parens_in_URL.text b/t/docs-php-markdown-todo/Parens_in_URL.text new file mode 100644 index 0000000..bb7be4f --- /dev/null +++ b/t/docs-php-markdown-todo/Parens_in_URL.text @@ -0,0 +1,14 @@ +[Inline link 1 with parens](/url\(test\) "title"). + +[Inline link 2 with parens](</url\(test\)> "title"). + +[Inline link 3 with non-escaped parens](/url(test) "title"). + +[Inline link 4 with non-escaped parens](</url(test)> "title"). + +[Reference link 1 with parens][1]. + +[Reference link 2 with parens][2]. + + [1]: /url(test) "title" + [2]: </url(test)> "title" diff --git a/t/docs-php-markdown/Backslash_escapes.html b/t/docs-php-markdown/Backslash_escapes.html new file mode 100644 index 0000000..c5dbcfc --- /dev/null +++ b/t/docs-php-markdown/Backslash_escapes.html @@ -0,0 +1,9 @@ +<p>Tricky combinaisons:</p> + +<p>backslash with \-- two dashes</p> + +<p>backslash with \> greater than</p> + +<p>\[test](not a link)</p> + +<p>\*no emphasis*</p> diff --git a/t/docs-php-markdown/Backslash_escapes.text b/t/docs-php-markdown/Backslash_escapes.text new file mode 100644 index 0000000..a5e769b --- /dev/null +++ b/t/docs-php-markdown/Backslash_escapes.text @@ -0,0 +1 @@ +Tricky combinaisons:
backslash with \\-- two dashes
backslash with \\> greater than
\\\[test](not a link)
\\\*no emphasis*
\ No newline at end of file diff --git a/t/docs-php-markdown/Code_Spans.html b/t/docs-php-markdown/Code_Spans.html new file mode 100644 index 0000000..9ed0df8 --- /dev/null +++ b/t/docs-php-markdown/Code_Spans.html @@ -0,0 +1,6 @@ +<p>From <code><!--</code> to <code>--></code> +on two lines.</p> + +<p>From <code><!--</code> +to <code>--></code> +on three lines.</p> diff --git a/t/docs-php-markdown/Code_Spans.text b/t/docs-php-markdown/Code_Spans.text new file mode 100644 index 0000000..43f2bcf --- /dev/null +++ b/t/docs-php-markdown/Code_Spans.text @@ -0,0 +1,6 @@ +From `<!--` to `-->` +on two lines. + +From `<!--` +to `-->` +on three lines. diff --git a/t/docs-php-markdown/Code_block_in_a_list_item.html b/t/docs-php-markdown/Code_block_in_a_list_item.html new file mode 100644 index 0000000..8ac5d83 --- /dev/null +++ b/t/docs-php-markdown/Code_block_in_a_list_item.html @@ -0,0 +1,11 @@ +<ul> +<li><p>List Item:</p> + +<pre><code>code block + + +with a blank line +</code></pre> + +<p>within a list item.</p></li> +</ul>
\ No newline at end of file diff --git a/t/docs-php-markdown/Code_block_in_a_list_item.text b/t/docs-php-markdown/Code_block_in_a_list_item.text new file mode 100644 index 0000000..3fa24c3 --- /dev/null +++ b/t/docs-php-markdown/Code_block_in_a_list_item.text @@ -0,0 +1,8 @@ + +* List Item: + + code block + + with a blank line + + within a list item.
\ No newline at end of file diff --git a/t/docs-php-markdown/Headers.html b/t/docs-php-markdown/Headers.html new file mode 100644 index 0000000..3adb470 --- /dev/null +++ b/t/docs-php-markdown/Headers.html @@ -0,0 +1,39 @@ +<h1>Header</h1> + +<h2>Header</h2> + +<h3>Header</h3> + +<hr /> + +<h1>Header</h1> + +<p>Paragraph</p> + +<h2>Header</h2> + +<p>Paragraph</p> + +<h3>Header</h3> + +<p>Paragraph</p> + +<hr /> + +<p>Paragraph</p> + +<h1>Header</h1> + +<p>Paragraph</p> + +<p>Paragraph</p> + +<h2>Header</h2> + +<p>Paragraph</p> + +<p>Paragraph</p> + +<h3>Header</h3> + +<p>Paragraph</p> diff --git a/t/docs-php-markdown/Headers.text b/t/docs-php-markdown/Headers.text new file mode 100644 index 0000000..3a39174 --- /dev/null +++ b/t/docs-php-markdown/Headers.text @@ -0,0 +1,9 @@ +Header
======
Header
------
### Header + + - - - + +Header
======
Paragraph
Header
------
Paragraph
### Header
Paragraph + + - - - + +Paragraph
Header
======
Paragraph
Paragraph
Header
------
Paragraph
Paragraph
### Header
Paragraph
\ No newline at end of file diff --git a/t/docs-php-markdown/Images_(Untitled).html b/t/docs-php-markdown/Images_(Untitled).html new file mode 100644 index 0000000..1b9bc04 --- /dev/null +++ b/t/docs-php-markdown/Images_(Untitled).html @@ -0,0 +1,5 @@ +<p><img src="/url/" alt="alt text" /></p> + +<p><img src="/url/" alt="alt text" /></p> + +<p><img src="/url/" alt="alt text" /></p> diff --git a/t/docs-php-markdown/Images_(Untitled).text b/t/docs-php-markdown/Images_(Untitled).text new file mode 100644 index 0000000..cb481de --- /dev/null +++ b/t/docs-php-markdown/Images_(Untitled).text @@ -0,0 +1,7 @@ + + + + +![alt text][foo] + + [foo]: /url/
\ No newline at end of file diff --git a/t/docs-php-markdown/Inline_HTML_(Simple).html b/t/docs-php-markdown/Inline_HTML_(Simple).html new file mode 100644 index 0000000..facfefb --- /dev/null +++ b/t/docs-php-markdown/Inline_HTML_(Simple).html @@ -0,0 +1,15 @@ +<p>With some attributes:</p> + +<div id="test"> + foo +</div> + +<div id="test" + class="nono"> + foo +</div> + +<p>Hr's:</p> + +<hr class="foo" + id="bar" >
\ No newline at end of file diff --git a/t/docs-php-markdown/Inline_HTML_(Simple).text b/t/docs-php-markdown/Inline_HTML_(Simple).text new file mode 100644 index 0000000..9177105 --- /dev/null +++ b/t/docs-php-markdown/Inline_HTML_(Simple).text @@ -0,0 +1,15 @@ +With some attributes: + +<div id="test"> + foo +</div> + +<div id="test" + class="nono"> + foo +</div> + +Hr's: + +<hr class="foo" + id="bar" > diff --git a/t/docs-php-markdown/Inline_HTML_comments.html b/t/docs-php-markdown/Inline_HTML_comments.html new file mode 100644 index 0000000..b45f014 --- /dev/null +++ b/t/docs-php-markdown/Inline_HTML_comments.html @@ -0,0 +1,9 @@ +<p>Paragraph one.</p> + +<!-- double--dash (invalid SGML comment) --> + +<p>Paragraph two.</p> + +<!-- enclosed tag </div> --> + +<p>The end.</p> diff --git a/t/docs-php-markdown/Inline_HTML_comments.text b/t/docs-php-markdown/Inline_HTML_comments.text new file mode 100644 index 0000000..d57d00a --- /dev/null +++ b/t/docs-php-markdown/Inline_HTML_comments.text @@ -0,0 +1,9 @@ +Paragraph one. + +<!-- double--dash (invalid SGML comment) --> + +Paragraph two. + +<!-- enclosed tag </div> --> + +The end. diff --git a/t/docs-php-markdown/PHP-Specific_Bugs.html b/t/docs-php-markdown/PHP-Specific_Bugs.html new file mode 100644 index 0000000..c982417 --- /dev/null +++ b/t/docs-php-markdown/PHP-Specific_Bugs.html @@ -0,0 +1,17 @@ +<p>This tests for a bug where quotes escaped by PHP when using +<code>preg_replace</code> with the <code>/e</code> modifier must be correctly unescaped +(hence the <code>_UnslashQuotes</code> function found only in PHP Markdown).</p> + +<p>Headers below should appear exactly as they are typed (no backslash +added or removed).</p> + +<h1>Header "quoted\" again \""</h1> + +<h2>Header "quoted\" again \""</h2> + +<h3>Header "quoted\" again \""</h3> + +<p>Test with tabs for <code>_Detab</code>:</p> + +<pre><code>Code 'block' with some "tabs" and "quotes" +</code></pre> diff --git a/t/docs-php-markdown/PHP-Specific_Bugs.text b/t/docs-php-markdown/PHP-Specific_Bugs.text new file mode 100644 index 0000000..246b60d --- /dev/null +++ b/t/docs-php-markdown/PHP-Specific_Bugs.text @@ -0,0 +1,22 @@ +This tests for a bug where quotes escaped by PHP when using +`preg_replace` with the `/e` modifier must be correctly unescaped +(hence the `_UnslashQuotes` function found only in PHP Markdown). + + + +Headers below should appear exactly as they are typed (no backslash +added or removed). + +Header "quoted\" again \\"" +=========================== + +Header "quoted\" again \\"" +--------------------------- + +### Header "quoted\" again \\"" ### + + + +Test with tabs for `_Detab`: + + Code 'block' with some "tabs" and "quotes" diff --git a/t/docs-php-markdown/Tight_blocks.html b/t/docs-php-markdown/Tight_blocks.html new file mode 100644 index 0000000..8655430 --- /dev/null +++ b/t/docs-php-markdown/Tight_blocks.html @@ -0,0 +1,21 @@ +<p>Paragraph and no space: +* ciao</p> + +<p>Paragraph and 1 space: + * ciao</p> + +<p>Paragraph and 3 spaces: + * ciao</p> + +<p>Paragraph and 4 spaces: + * ciao</p> + +<p>Paragraph before header:</p> + +<h1>Header</h1> + +<p>Paragraph before blockquote:</p> + +<blockquote> + <p>Some quote.</p> +</blockquote> diff --git a/t/docs-php-markdown/Tight_blocks.text b/t/docs-php-markdown/Tight_blocks.text new file mode 100644 index 0000000..ae4cdcb --- /dev/null +++ b/t/docs-php-markdown/Tight_blocks.text @@ -0,0 +1 @@ +Paragraph and no space:
* ciao
Paragraph and 1 space:
* ciao
Paragraph and 3 spaces:
* ciao
Paragraph and 4 spaces:
* ciao
Paragraph before header:
#Header
Paragraph before blockquote:
>Some quote.
\ No newline at end of file diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/auto_link.html b/t/docs-pythonmarkdown2-tm-cases-pass/auto_link.html new file mode 100644 index 0000000..e4dde05 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/auto_link.html @@ -0,0 +1,3 @@ +<p>I can has autolink? <a href="http://icanhascheeseburger.com">http://icanhascheeseburger.com</a></p> + +<p>Ask garfield: <a href="mailto:garfield@example.com">garfield@example.com</a></p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/auto_link.text b/t/docs-pythonmarkdown2-tm-cases-pass/auto_link.text new file mode 100644 index 0000000..e5354cd --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/auto_link.text @@ -0,0 +1,3 @@ +I can has autolink? <http://icanhascheeseburger.com> + +Ask garfield: <garfield@example.com> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.html b/t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.html new file mode 100644 index 0000000..e4dde05 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.html @@ -0,0 +1,3 @@ +<p>I can has autolink? <a href="http://icanhascheeseburger.com">http://icanhascheeseburger.com</a></p> + +<p>Ask garfield: <a href="mailto:garfield@example.com">garfield@example.com</a></p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.opts b/t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.opts new file mode 100644 index 0000000..ccb6a09 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.opts @@ -0,0 +1 @@ +{'safe_mode': True} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.text b/t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.text new file mode 100644 index 0000000..e5354cd --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.text @@ -0,0 +1,3 @@ +I can has autolink? <http://icanhascheeseburger.com> + +Ask garfield: <garfield@example.com> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.html b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.html new file mode 100644 index 0000000..393e9d2 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.html @@ -0,0 +1,5 @@ +<p>blah [HTML_REMOVED] blah</p> + +<p>[HTML_REMOVED]yowzer![HTML_REMOVED]</p> + +<p>blah</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.opts b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.opts new file mode 100644 index 0000000..e74c7cc --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.opts @@ -0,0 +1,2 @@ +# Use the old (for-compat-only) way of specifying "replace" safe mode. +{"safe_mode": True} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.text b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.text new file mode 100644 index 0000000..ee04231 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.text @@ -0,0 +1,5 @@ +blah <img src="dangerous"> blah + +<div>yowzer!</div> + +blah diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.html b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.html new file mode 100644 index 0000000..af24510 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.html @@ -0,0 +1,5 @@ +<p>blah <img src="dangerous"> blah</p> + +<p><div>yowzer!</div></p> + +<p>blah</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.opts b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.opts new file mode 100644 index 0000000..ad487c0 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.opts @@ -0,0 +1 @@ +{"safe_mode": "escape"} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.text b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.text new file mode 100644 index 0000000..ee04231 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.text @@ -0,0 +1,5 @@ +blah <img src="dangerous"> blah + +<div>yowzer!</div> + +blah diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/blockquote.html b/t/docs-pythonmarkdown2-tm-cases-pass/blockquote.html new file mode 100644 index 0000000..5cde1cb --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/blockquote.html @@ -0,0 +1,11 @@ +<p>[Trent wrote]</p> + +<blockquote> + <p>no way</p> +</blockquote> + +<p>[Jeff wrote]</p> + +<blockquote> + <p>way</p> +</blockquote> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/blockquote.text b/t/docs-pythonmarkdown2-tm-cases-pass/blockquote.text new file mode 100644 index 0000000..3bcecaa --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/blockquote.text @@ -0,0 +1,5 @@ +[Trent wrote] +> no way + +[Jeff wrote] +> way diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.html b/t/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.html new file mode 100644 index 0000000..d03cc78 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.html @@ -0,0 +1,9 @@ +<blockquote> + <p>Markdown indents blockquotes a couple of spaces + necessitating some tweaks for pre-blocks in that + blockquote:</p> + +<pre><code>here is a check +for that +</code></pre> +</blockquote> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.text b/t/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.text new file mode 100644 index 0000000..e61b82f --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.text @@ -0,0 +1,6 @@ +> Markdown indents blockquotes a couple of spaces +> necessitating some tweaks for pre-blocks in that +> blockquote: +> +> here is a check +> for that diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.html b/t/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.html new file mode 100644 index 0000000..6c32e46 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.html @@ -0,0 +1,4 @@ +<p>Test with tabs for <code>_Detab</code>:</p> + +<pre><code>Code 'block' with some "tabs" and "quotes" +</code></pre> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.text b/t/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.text new file mode 100644 index 0000000..bcf94c4 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.text @@ -0,0 +1,3 @@ +Test with tabs for `_Detab`: + + Code 'block' with some "tabs" and "quotes" diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.html b/t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.html new file mode 100644 index 0000000..f53e6a5 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.html @@ -0,0 +1,2 @@ +<p>This is <em>italic</em> and this is <strong>bold</strong>. +This is NOT _italic_ and this is __bold__ because --code-safe is turned on.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.opts b/t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.opts new file mode 100644 index 0000000..cd0b9d6 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.opts @@ -0,0 +1 @@ +{"extras": ["code-friendly"]} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.text b/t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.text new file mode 100644 index 0000000..6e9df74 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.text @@ -0,0 +1,2 @@ +This is *italic* and this is **bold**.
+This is NOT _italic_ and this is __bold__ because --code-safe is turned on.
diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/codeblock.html b/t/docs-pythonmarkdown2-tm-cases-pass/codeblock.html new file mode 100644 index 0000000..bf7f5c2 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/codeblock.html @@ -0,0 +1,8 @@ +<pre><code>some code +</code></pre> + +<p>some 'splaining</p> + +<pre><code>some more code +2 > 1 +</code></pre> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/codeblock.text b/t/docs-pythonmarkdown2-tm-cases-pass/codeblock.text new file mode 100644 index 0000000..d374216 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/codeblock.text @@ -0,0 +1,7 @@ + some code + +some 'splaining + + some more code + 2 > 1 + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/codespans.html b/t/docs-pythonmarkdown2-tm-cases-pass/codespans.html new file mode 100644 index 0000000..3528bcd --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/codespans.html @@ -0,0 +1,2 @@ +<p><code>This</code> is a code span. +And <code>This is one with an `embedded backtick`</code>.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/codespans.text b/t/docs-pythonmarkdown2-tm-cases-pass/codespans.text new file mode 100644 index 0000000..67015a9 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/codespans.text @@ -0,0 +1,2 @@ +`This` is a code span. +And ``This is one with an `embedded backtick` ``. diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.html b/t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.html new file mode 100644 index 0000000..3528bcd --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.html @@ -0,0 +1,2 @@ +<p><code>This</code> is a code span. +And <code>This is one with an `embedded backtick`</code>.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.opts b/t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.opts new file mode 100644 index 0000000..ccb6a09 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.opts @@ -0,0 +1 @@ +{'safe_mode': True} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.text b/t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.text new file mode 100644 index 0000000..67015a9 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.text @@ -0,0 +1,2 @@ +`This` is a code span. +And ``This is one with an `embedded backtick` ``. diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.html b/t/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.html new file mode 100644 index 0000000..b194eb9 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.html @@ -0,0 +1,4 @@ +<!-- -*- markdown-extras: code-friendly -*- --> + +<p>This sentence talks about the Python __init__ method, which I'd rather not be +interpreted as Markdown's strong.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.text b/t/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.text new file mode 100644 index 0000000..2d05ab8 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.text @@ -0,0 +1,4 @@ +<!-- -*- markdown-extras: code-friendly -*- --> + +This sentence talks about the Python __init__ method, which I'd rather not be +interpreted as Markdown's strong. diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.html b/t/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.html new file mode 100644 index 0000000..8b47011 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.html @@ -0,0 +1,8 @@ +<p>This sentence talks about the Python __init__ method, which I'd rather not be +interpreted as Markdown's strong.</p> + +<!-- + Local Variables: + markdown-extras: code-friendly + End: + --> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.text b/t/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.text new file mode 100644 index 0000000..400d2eb --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.text @@ -0,0 +1,8 @@ +This sentence talks about the Python __init__ method, which I'd rather not be +interpreted as Markdown's strong. + +<!-- + Local Variables: + markdown-extras: code-friendly + End: + --> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/emphasis.html b/t/docs-pythonmarkdown2-tm-cases-pass/emphasis.html new file mode 100644 index 0000000..a850dc9 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/emphasis.html @@ -0,0 +1,2 @@ +<p>This is <em>italic</em> and this is <strong>bold</strong>. +This is also <em>italic</em> and this is <strong>bold</strong>.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/emphasis.text b/t/docs-pythonmarkdown2-tm-cases-pass/emphasis.text new file mode 100644 index 0000000..99c324e --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/emphasis.text @@ -0,0 +1,2 @@ +This is *italic* and this is **bold**.
+This is also _italic_ and this is __bold__.
diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/escapes.html b/t/docs-pythonmarkdown2-tm-cases-pass/escapes.html new file mode 100644 index 0000000..9670548 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/escapes.html @@ -0,0 +1,3 @@ +<p>**don't shout**</p> + +<p>*don't emphasize*</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/escapes.text b/t/docs-pythonmarkdown2-tm-cases-pass/escapes.text new file mode 100644 index 0000000..a79164e --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/escapes.text @@ -0,0 +1,3 @@ +\*\*don't shout\*\* + +\*don't emphasize\* diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes.html b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes.html new file mode 100644 index 0000000..37c6d8b --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes.html @@ -0,0 +1,27 @@ +<p>This is a para with a footnote.<sup class="footnote-ref" id="fnref-1"><a href="#fn-1">1</a></sup></p> + +<p>This is another para with a footnote<sup class="footnote-ref" id="fnref-2"><a href="#fn-2">2</a></sup> in it. Actually it has two<sup class="footnote-ref" id="fnref-3"><a href="#fn-3">3</a></sup> of +them. No, three<sup class="footnote-ref" id="fnref-4"><a href="#fn-4">4</a></sup>.</p> + +<div class="footnotes"> +<hr /> +<ol> +<li id="fn-1"> +<p>Here is the body of the first footnote. <a href="#fnref-1" class="footnoteBackLink" title="Jump back to footnote 1 in the text.">↩</a></p> +</li> + +<li id="fn-2"> +<p>And of the second footnote.</p> + +<p>This one has multiple paragraphs. <a href="#fnref-2" class="footnoteBackLink" title="Jump back to footnote 2 in the text.">↩</a></p> +</li> + +<li id="fn-3"> +<p>Here is a footnote body that starts on next line. <a href="#fnref-3" class="footnoteBackLink" title="Jump back to footnote 3 in the text.">↩</a></p> +</li> + +<li id="fn-4"> +<p>quickie "that looks like a link ref if not careful" <a href="#fnref-4" class="footnoteBackLink" title="Jump back to footnote 4 in the text.">↩</a></p> +</li> +</ol> +</div> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes.opts b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes.opts new file mode 100644 index 0000000..9dfee9e --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes.opts @@ -0,0 +1 @@ +{"extras": ["footnotes"]} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes.text b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes.text new file mode 100644 index 0000000..7d6e716 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes.text @@ -0,0 +1,18 @@ +This is a para with a footnote.[^1] + +This is another para with a footnote[^2] in it. Actually it has two[^3] of +them. No, three[^4]. + + +[^1]: Here is the body of the first footnote. + +[^2]: And of the second footnote. + + This one has multiple paragraphs. + +[^3]: + Here is a footnote body that starts on next line. + +[^4]: quickie "that looks like a link ref if not careful" + + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.html b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.html new file mode 100644 index 0000000..3702606 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.html @@ -0,0 +1,23 @@ +<p>This is a para with a footnote.<sup class="footnote-ref" id="fnref-foo"><a href="#fn-foo">1</a></sup></p> + +<p>This is another para with a footnote<sup class="footnote-ref" id="fnref-hyphen-ated"><a href="#fn-hyphen-ated">2</a></sup> in it. Actually it has two<sup class="footnote-ref" id="fnref-Capital"><a href="#fn-Capital">3</a></sup> of +them.</p> + +<div class="footnotes"> +<hr /> +<ol> +<li id="fn-foo"> +<p>Here is the body of the first footnote. <a href="#fnref-foo" class="footnoteBackLink" title="Jump back to footnote 1 in the text.">↩</a></p> +</li> + +<li id="fn-hyphen-ated"> +<p>And of the second footnote.</p> + +<p>This one has multiple paragraphs. <a href="#fnref-hyphen-ated" class="footnoteBackLink" title="Jump back to footnote 2 in the text.">↩</a></p> +</li> + +<li id="fn-Capital"> +<p>Here is a footnote body that starts on next line. <a href="#fnref-Capital" class="footnoteBackLink" title="Jump back to footnote 3 in the text.">↩</a></p> +</li> +</ol> +</div> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.opts b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.opts new file mode 100644 index 0000000..9dfee9e --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.opts @@ -0,0 +1 @@ +{"extras": ["footnotes"]} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.text b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.text new file mode 100644 index 0000000..431a96b --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.text @@ -0,0 +1,15 @@ +This is a para with a footnote.[^foo] + +This is another para with a footnote[^hyphen-ated] in it. Actually it has two[^Capital] of +them. + + +[^foo]: Here is the body of the first footnote. + +[^hyphen-ated]: And of the second footnote. + + This one has multiple paragraphs. + +[^Capital]: + Here is a footnote body that starts on next line. + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.html b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.html new file mode 100644 index 0000000..f365041 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.html @@ -0,0 +1,22 @@ +<p>This is a para with a footnote.<sup class="footnote-ref" id="fnref-1"><a href="#fn-1">1</a></sup></p> + +<p>This is another para with a footnote.<sup class="footnote-ref" id="fnref-2"><a href="#fn-2">2</a></sup></p> + +<div class="footnotes"> +<hr /> +<ol> +<li id="fn-1"> +<p>And the <strong>body</strong> of the footnote has <code>markup</code>. For example, +a <a href="http://digg.com">link to digg</a>. And some code:</p> + +<pre><code>print "Hello, World!" +</code></pre> + +<p><a href="#fnref-1" class="footnoteBackLink" title="Jump back to footnote 1 in the text.">↩</a></p> +</li> + +<li id="fn-2"> +<p>This body has markup too, <em>but</em> doesn't end with a code block. <a href="#fnref-2" class="footnoteBackLink" title="Jump back to footnote 2 in the text.">↩</a></p> +</li> +</ol> +</div> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.opts b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.opts new file mode 100644 index 0000000..9dfee9e --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.opts @@ -0,0 +1 @@ +{"extras": ["footnotes"]} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.text b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.text new file mode 100644 index 0000000..07b5922 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.text @@ -0,0 +1,10 @@ +This is a para with a footnote.[^1] + +This is another para with a footnote.[^2] + +[^1]: And the **body** of the footnote has `markup`. For example, + a [link to digg](http://digg.com). And some code: + + print "Hello, World!" + +[^2]: This body has markup too, *but* doesn't end with a code block. diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.html b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.html new file mode 100644 index 0000000..6bce5a7 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.html @@ -0,0 +1,12 @@ +<p>This is a para with a footnote.<sup class="footnote-ref" id="fnref-1"><a href="#fn-1">1</a></sup></p> + +<div class="footnotes"> +<hr /> +<ol> +<li id="fn-1"> +<p>Here is the <em>body</em> of <span class="yo">the</span> footnote.</p> + +<p><div class="blah">And here is the second para of the footnote.</div> <a href="#fnref-1" class="footnoteBackLink" title="Jump back to footnote 1 in the text.">↩</a></p> +</li> +</ol> +</div> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.opts b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.opts new file mode 100644 index 0000000..9d97404 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.opts @@ -0,0 +1 @@ +{"safe_mode": "escape", "extras": ["footnotes"]} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.text b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.text new file mode 100644 index 0000000..ae8e4e7 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.text @@ -0,0 +1,6 @@ +This is a para with a footnote.[^1] + +[^1]: Here is the <em>body</em> of <span class="yo">the</span> footnote. + + <div class="blah">And here is the second para of the footnote.</div> + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/header.html b/t/docs-pythonmarkdown2-tm-cases-pass/header.html new file mode 100644 index 0000000..90fc68a --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/header.html @@ -0,0 +1,7 @@ +<h1>an h1</h1> + +<h2>an h2</h2> + +<h1>another h1</h1> + +<h2>another h2</h2> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/header.text b/t/docs-pythonmarkdown2-tm-cases-pass/header.text new file mode 100644 index 0000000..b20ad13 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/header.text @@ -0,0 +1,9 @@ +# an h1
+
+## an h2
+
+another h1
+==========
+
+another h2
+----------
diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/hr.html b/t/docs-pythonmarkdown2-tm-cases-pass/hr.html new file mode 100644 index 0000000..442117e --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/hr.html @@ -0,0 +1,12 @@ +<p>Dashes:</p> + +<hr /> + +<hr /> + +<hr /> + +<hr /> + +<pre><code>--- +</code></pre> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/hr.text b/t/docs-pythonmarkdown2-tm-cases-pass/hr.text new file mode 100644 index 0000000..765b735 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/hr.text @@ -0,0 +1,12 @@ +Dashes: + +--- + + --- + + --- + + --- + + --- + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/img_in_link.html b/t/docs-pythonmarkdown2-tm-cases-pass/img_in_link.html new file mode 100644 index 0000000..09db27a --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/img_in_link.html @@ -0,0 +1,4 @@ +<p>This example from +<a href="http://orestis.gr/en/blog/2007/05/28/python-markdown-problems/">http://orestis.gr/en/blog/2007/05/28/python-markdown-problems/</a>:</p> + +<p><a href="http://www.google.com/" title="click to visit Google.com"><img src="http://www.google.com/images/logo.gif" alt="the google logo" /></a></p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/img_in_link.text b/t/docs-pythonmarkdown2-tm-cases-pass/img_in_link.text new file mode 100644 index 0000000..98f6075 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/img_in_link.text @@ -0,0 +1,7 @@ +This example from
+<http://orestis.gr/en/blog/2007/05/28/python-markdown-problems/>:
+
+[![the google logo][logo]][google]
+[logo]: http://www.google.com/images/logo.gif
+[google]: http://www.google.com/ "click to visit Google.com"
+
diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/inline_links.html b/t/docs-pythonmarkdown2-tm-cases-pass/inline_links.html new file mode 100644 index 0000000..ad2aa72 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/inline_links.html @@ -0,0 +1,7 @@ +<p>an inline <a href="/url/">link</a></p> + +<p>a <a href="/url/" title="title">link "with" title</a></p> + +<p>an inline <img src="/url/" alt="image link" /></p> + +<p>an <img src="/url/" alt="image "with" title" title="title" /></p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/inline_links.text b/t/docs-pythonmarkdown2-tm-cases-pass/inline_links.text new file mode 100644 index 0000000..444a997 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/inline_links.text @@ -0,0 +1,7 @@ +an inline [link](/url/) + +a [link "with" title](/url/ "title") + +an inline  + +an  diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.html b/t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.html new file mode 100644 index 0000000..c36b6d9 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.html @@ -0,0 +1,5 @@ +<h2>Heading 2</h2> + +<p>blah [HTML_REMOVED]alert('this should be removed')[HTML_REMOVED] <strong>blah</strong></p> + +<p>[HTML_REMOVED]alert('as should this')[HTML_REMOVED]</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.opts b/t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.opts new file mode 100644 index 0000000..fd31b4e --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.opts @@ -0,0 +1 @@ +{"safe_mode": "replace"} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.text b/t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.text new file mode 100644 index 0000000..38cb2b5 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.text @@ -0,0 +1,6 @@ +## Heading 2 + +blah <script>alert('this should be removed')</script> **blah** + +<script>alert('as should this')</script> + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.html b/t/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.html new file mode 100644 index 0000000..57871fb --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.html @@ -0,0 +1,3 @@ +<p>Alternative delimiters for <a href="http://daringfireball.net/projects/markdown/syntax#link" title="link syntax">link definitions</a> are allowed -- as of +Markdown 1.0.2, I think. Hence, <a href="http://daringfireball.net/projects/markdown/syntax#link" title="link syntax">this link</a> and <a href="http://daringfireball.net/projects/markdown/syntax#link" title="link syntax">this link</a> work +too.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.text b/t/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.text new file mode 100644 index 0000000..3d62b11 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.text @@ -0,0 +1,7 @@ +Alternative delimiters for [link definitions][link1] are allowed -- as of +Markdown 1.0.2, I think. Hence, [this link][link2] and [this link][link3] work +too. + +[link1]: http://daringfireball.net/projects/markdown/syntax#link "link syntax" +[link2]: http://daringfireball.net/projects/markdown/syntax#link 'link syntax' +[link3]: http://daringfireball.net/projects/markdown/syntax#link (link syntax) diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.html b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.html new file mode 100644 index 0000000..6c98ea9 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.html @@ -0,0 +1 @@ +<p><a href="http://code.activestate.com/recipes/123/">Recipe 123</a> and <a href="http://bugs.activestate.com/show_bug.cgi?id=234">Komodo bug 234</a> are related.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.opts b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.opts new file mode 100644 index 0000000..bd85ea9 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.opts @@ -0,0 +1,7 @@ +{"extras": ["link-patterns"], + "link_patterns": [ + (re.compile("recipe\s+(\d+)", re.I), r"http://code.activestate.com/recipes/\1/"), + (re.compile("(?:komodo\s+)?bug\s+(\d+)", re.I), r"http://bugs.activestate.com/show_bug.cgi?id=\1"), + ], +} + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.text b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.text new file mode 100644 index 0000000..d8a4081 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns.text @@ -0,0 +1 @@ +Recipe 123 and Komodo bug 234 are related. diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.html b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.html new file mode 100644 index 0000000..4402dcf --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.html @@ -0,0 +1 @@ +<p>There once was a <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=123">Mozilla bug 123</a> and a <a href="http://bugs.activestate.com/show_bug.cgi?id=123">Komodo bug 123</a>.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.opts b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.opts new file mode 100644 index 0000000..d64982d --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.opts @@ -0,0 +1,7 @@ +{"extras": ["link-patterns"], + "link_patterns": [ + (re.compile(r'mozilla\s+bug\s+(\d+)', re.I), r'http://bugzilla.mozilla.org/show_bug.cgi?id=\1'), + (re.compile("(?:komodo\s+)?bug\s+(\d+)", re.I), r"http://bugs.activestate.com/show_bug.cgi?id=\1"), + ], +} + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.text b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.text new file mode 100644 index 0000000..29868b8 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.text @@ -0,0 +1 @@ +There once was a Mozilla bug 123 and a Komodo bug 123. diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.html b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.html new file mode 100644 index 0000000..ffd0a72 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.html @@ -0,0 +1 @@ +<p><a href="http://foo.com/blah_blah_blah/123">Blah 123</a> becomes a line with two underscores.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.opts b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.opts new file mode 100644 index 0000000..99ce0f7 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.opts @@ -0,0 +1,6 @@ +{"extras": ["link-patterns"], + "link_patterns": [ + (re.compile("Blah\s+(\d+)", re.I), r"http://foo.com/blah_blah_blah/\1"), + ], +} + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.text b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.text new file mode 100644 index 0000000..d1fb62c --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.text @@ -0,0 +1 @@ +Blah 123 becomes a line with two underscores. diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/lists.html b/t/docs-pythonmarkdown2-tm-cases-pass/lists.html new file mode 100644 index 0000000..f34c900 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/lists.html @@ -0,0 +1,15 @@ +<p>count:</p> + +<ul> +<li>one</li> +<li>two</li> +<li>three</li> +</ul> + +<p>count in spanish:</p> + +<ol> +<li>uno</li> +<li>dos</li> +<li>tres</li> +</ol> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/lists.text b/t/docs-pythonmarkdown2-tm-cases-pass/lists.text new file mode 100644 index 0000000..8d2b43c --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/lists.text @@ -0,0 +1,11 @@ +count: + +* one +* two +* three + +count in spanish: + +1. uno +2. dos +3. tres diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.html b/t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.html new file mode 100644 index 0000000..7ac7bfd --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.html @@ -0,0 +1,16 @@ +<p>This is sentence has a footnote foo<sup class="footnote-ref" id="fnref-foo"><a href="#fn-foo">1</a></sup> and whamo[^whamo].</p> + +<p>This is another para with a numbered footnote<sup class="footnote-ref" id="fnref-6"><a href="#fn-6">2</a></sup>.</p> + +<div class="footnotes"> +<hr /> +<ol> +<li id="fn-foo"> +<p>Here is the body of the footnote foo. <a href="#fnref-foo" class="footnoteBackLink" title="Jump back to footnote 1 in the text.">↩</a></p> +</li> + +<li id="fn-6"> +<p>Here is the body of the footnote 6. <a href="#fnref-6" class="footnoteBackLink" title="Jump back to footnote 2 in the text.">↩</a></p> +</li> +</ol> +</div> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.opts b/t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.opts new file mode 100644 index 0000000..9dfee9e --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.opts @@ -0,0 +1 @@ +{"extras": ["footnotes"]} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.text b/t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.text new file mode 100644 index 0000000..d679192 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.text @@ -0,0 +1,9 @@ +This is sentence has a footnote foo[^foo] and whamo[^whamo]. + +This is another para with a numbered footnote[^6]. + + +[^foo]: Here is the body of the footnote foo. +[^bar]: Here is the body of the footnote bar. +[^6]: Here is the body of the footnote 6. + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.html b/t/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.html new file mode 100644 index 0000000..2f8a9e8 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.html @@ -0,0 +1 @@ +<p>This is a [missing link][missing] and a <a href="http://foo.com">used link</a>.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.text b/t/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.text new file mode 100644 index 0000000..817677f --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.text @@ -0,0 +1,7 @@ + +This is a [missing link][missing] and a [used link][used]. + + +[used]: http://foo.com +[unused]: http://foo.com + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/nested_list.html b/t/docs-pythonmarkdown2-tm-cases-pass/nested_list.html new file mode 100644 index 0000000..c0617e4 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/nested_list.html @@ -0,0 +1,15 @@ +<p>shopping list:</p> + +<ul> +<li>veggies +<ul> +<li>carrots</li> +<li>lettuce</li> +</ul></li> +<li>fruits +<ul> +<li>oranges</li> +<li>apples</li> +<li><em>peaches</em></li> +</ul></li> +</ul> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/nested_list.text b/t/docs-pythonmarkdown2-tm-cases-pass/nested_list.text new file mode 100644 index 0000000..a37a195 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/nested_list.text @@ -0,0 +1,9 @@ +shopping list: + +- veggies + + carrots + + lettuce +- fruits + + oranges + + apples + + *peaches* diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.html b/t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.html new file mode 100644 index 0000000..c0617e4 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.html @@ -0,0 +1,15 @@ +<p>shopping list:</p> + +<ul> +<li>veggies +<ul> +<li>carrots</li> +<li>lettuce</li> +</ul></li> +<li>fruits +<ul> +<li>oranges</li> +<li>apples</li> +<li><em>peaches</em></li> +</ul></li> +</ul> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.opts b/t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.opts new file mode 100644 index 0000000..ccb6a09 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.opts @@ -0,0 +1 @@ +{'safe_mode': True} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.text b/t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.text new file mode 100644 index 0000000..a37a195 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.text @@ -0,0 +1,9 @@ +shopping list: + +- veggies + + carrots + + lettuce +- fruits + + oranges + + apples + + *peaches* diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.html b/t/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.html new file mode 100644 index 0000000..6535e80 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.html @@ -0,0 +1 @@ +<p><a href="/url(test)" title="title">Inline link 4 with non-escaped parens</a>.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.text b/t/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.text new file mode 100644 index 0000000..5dfb9ab --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.text @@ -0,0 +1 @@ +[Inline link 4 with non-escaped parens](</url(test)> "title"). diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/raw_html.html b/t/docs-pythonmarkdown2-tm-cases-pass/raw_html.html new file mode 100644 index 0000000..ec135c6 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/raw_html.html @@ -0,0 +1,5 @@ +<p>Hi, <span foo="*bar*"><em>there</em></span>. <!-- *blah* --> blah</p> + +<div> + **ack** +</div> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/raw_html.text b/t/docs-pythonmarkdown2-tm-cases-pass/raw_html.text new file mode 100644 index 0000000..13cde37 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/raw_html.text @@ -0,0 +1,6 @@ + +Hi, <span foo="*bar*">*there*</span>. <!-- *blah* --> blah + +<div> + **ack** +</div> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/ref_links.html b/t/docs-pythonmarkdown2-tm-cases-pass/ref_links.html new file mode 100644 index 0000000..406f8b5 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/ref_links.html @@ -0,0 +1 @@ +<p><a href="http://www.google.com/">Google</a> is fast <img src="/img/star.png" alt="star" />.</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/ref_links.text b/t/docs-pythonmarkdown2-tm-cases-pass/ref_links.text new file mode 100644 index 0000000..4df8c01 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/ref_links.text @@ -0,0 +1,6 @@ +[Google][] is fast ![star][]. + +[google]: http://www.google.com/ +[star]: /img/star.png + + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/sublist-para.html b/t/docs-pythonmarkdown2-tm-cases-pass/sublist-para.html new file mode 100644 index 0000000..a2f551b --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/sublist-para.html @@ -0,0 +1,17 @@ +<p>Some quick thoughts from a coder's perspective:</p> + +<ul> +<li><p>The source will be available in a Mercurial ...</p></li> +<li><p>Komodo is a Mozilla-based application...</p> + +<ul> +<li>Get a slightly tweaked mozilla build (C++, JavaScript, XUL).</li> +<li>Get a slightly tweaks Python build (C).</li> +<li>Add a bunch of core logic (Python)...</li> +<li>Add Komodo chrome (XUL, JavaScript, CSS, DTDs).</li> +</ul> + +<p><p>What this means is that work on and add significant functionality...</p></li> +<li><p>Komodo uses the same extension mechanisms as Firefox...</p></li> +<li><p>Komodo builds and runs on Windows, Linux and ...</p></li> +</ul></p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/sublist-para.text b/t/docs-pythonmarkdown2-tm-cases-pass/sublist-para.text new file mode 100644 index 0000000..7bf07ba --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/sublist-para.text @@ -0,0 +1,17 @@ +Some quick thoughts from a coder's perspective: + +- The source will be available in a Mercurial ... + +- Komodo is a Mozilla-based application... + + - Get a slightly tweaked mozilla build (C++, JavaScript, XUL). + - Get a slightly tweaks Python build (C). + - Add a bunch of core logic (Python)... + - Add Komodo chrome (XUL, JavaScript, CSS, DTDs). + + What this means is that work on and add significant functionality... + +- Komodo uses the same extension mechanisms as Firefox... + +- Komodo builds and runs on Windows, Linux and ... + diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.html b/t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.html new file mode 100644 index 0000000..2e172c1 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.html @@ -0,0 +1,15 @@ +<p>Here is some sample code:</p> + +<div class="codehilite"><pre><code><span class="k">import</span> <span class="nn">sys</span> +<span class="k">def</span> <span class="nf">main</span><span class="p">(</span><span class="n">argv</span><span class="o">=</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">):</span> + <span class="n">logging</span><span class="o">.</span><span class="n">basicConfig</span><span class="p">()</span> + <span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">'hi'</span><span class="p">)</span> +</code></pre></div> + +<p>and:</p> + +<div class="codehilite"><pre><code><span class="n">use</span> <span class="s1">'zlib'</span> +<span class="nb">sub</span> <span class="n">main</span><span class="p">(</span><span class="n">argv</span><span class="p">)</span> + <span class="nb">puts</span> <span class="s1">'hi'</span> +<span class="k">end</span> +</code></pre></div> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.opts b/t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.opts new file mode 100644 index 0000000..95dfd41 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.opts @@ -0,0 +1 @@ +{"extras": ["code-color"]} diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.text b/t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.text new file mode 100644 index 0000000..b4b30e5 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/syntax_color.text @@ -0,0 +1,15 @@ +Here is some sample code: + + :::python + import sys + def main(argv=sys.argv): + logging.basicConfig() + log.info('hi') + +and: + + :::ruby + use 'zlib' + sub main(argv) + puts 'hi' + end diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.html b/t/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.html new file mode 100644 index 0000000..0ec6204 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.html @@ -0,0 +1,11 @@ +<p><a href="/url/">with [brackets][] in text</a></p> + +<p><a href="/url/" title="a title">with [[brackets][]] in text</a></p> + +<p><a href="/url/">full link [like](/this/) in text</a></p> + +<p><a href="/url/">full link to img <img src="/this/" alt="like" /> is ok</a></p> + +<p>[only open <a href="/url/" title="a title">bracket(/in/) text</a></p> + +<p><a href="/in/">only close bracket</a> text](/url/)</p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.text b/t/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.text new file mode 100644 index 0000000..217f685 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.text @@ -0,0 +1,11 @@ +[with [brackets][] in text](/url/) + +[with [[brackets][]] in text](/url/ "a title") + +[full link [like](/this/) in text](/url/) + +[full link to img  is ok](/url/) + +[only open [bracket(/in/) text](/url/ 'a title') + +[only close bracket](/in/) text](/url/) diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.html b/t/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.html new file mode 100644 index 0000000..9fef884 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.html @@ -0,0 +1,2 @@ +<p>Eric wrote up a (long) intro to writing UDL definitions a while back on +his blog: <a href="http://blogs.activestate.com/ericp/2007/01/kid_adding_a_ne.html">http://blogs.activestate.com/ericp/2007/01/kid_adding_a_ne.html</a></p> diff --git a/t/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.text b/t/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.text new file mode 100644 index 0000000..58ae3e0 --- /dev/null +++ b/t/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.text @@ -0,0 +1,2 @@ +Eric wrote up a (long) intro to writing UDL definitions a while back on +his blog: <http://blogs.activestate.com/ericp/2007/01/kid_adding_a_ne.html> diff --git a/t/rt37909.t b/t/rt37909.t new file mode 100644 index 0000000..dcd50be --- /dev/null +++ b/t/rt37909.t @@ -0,0 +1,10 @@ +use strict; +use warnings; +use Test::More tests => 2; + +use_ok( 'Text::Markdown', 'markdown' ); + +my $m = Text::Markdown->new; +my $html1 = $m->markdown('<a+b@c.org>'); +like( $html1, qr/<p><a href=".+&#.+">.+&#.+<\/a><\/p>/ ); + diff --git a/t/rt48943.t b/t/rt48943.t new file mode 100644 index 0000000..bce9330 --- /dev/null +++ b/t/rt48943.t @@ -0,0 +1,11 @@ +use strict; +use warnings; +use Test::More tests => 2; + +use_ok( 'Text::Markdown', 'markdown' ); + +my $str = '<h1 class=center>foo</h1>'; +my $m = Text::Markdown->new; +my $html1 = $m->markdown($str); +like( $html1, qr/^$str/ ); + |
