pax_global_header00006660000000000000000000000064124735612750014526gustar00rootroot0000000000000052 comment=90d590a462dc9df66793334438568e33ae381380 pegdown-1.5.0/000077500000000000000000000000001247356127500131745ustar00rootroot00000000000000pegdown-1.5.0/.gitignore000066400000000000000000000004631247356127500151670ustar00rootroot00000000000000*.class *.log # SBT test-output/ .cache/ .history/ .lib/ dist/* target/ lib_managed/ src_managed/ project/boot/ project/plugins/project/ # IDEA .idea/ *.iml *.ipr *.iws out/ # Scala-IDE specific .scala_dependencies .worksheet .cache .classpath .project .settings .target/ # Mac .DS_Store # Other *.pyc pegdown-1.5.0/CHANGELOG000066400000000000000000000141511247356127500144100ustar00rootroot00000000000000Version 1.5.0 (2013-12-0) -------------------------- - Upgraded to parboiled 1.1.7 - Fixed problem with recognizing Wikilinks - Fixed problem in image tag HTML rendering - Added anchor links to headers - Added timeout check in label rule (#104) - Added new helper method to PegDownProcessor to supply list of ToHtmlSerializerPlugin's to ToHtmlSerializer. Version 1.4.2 (2013-12-09) -------------------------- - Fix autolinks not ending at `<` character (#102) - Enable LinkRenderer to influence image rendering (#95) - Add STRIKETHROUGH extension - Upgrade to parboiled 1.1.6 Version 1.4.1 (2013-07-20) -------------------------- - Added support for extending SpecialChar rule via plugin Version 1.4.0 (2013-06-23) -------------------------- - Added basic plugin support (see #77, thx to James Roper and also Jakub Jirutka) Version 1.3.0 (2013-06-04) -------------------------- - Upgraded to parboiled 1.1.5 - Improved handling of emph/strong (fixes #43, #65 and #78, thx a lot to Elmer van Chastelet for the patch!) - Added extensible, type-specific serialization for code blocks (thx to Jared Bunting) Version 1.2.1 (2012-11-27) -------------------------- - Upgraded to parboiled 1.1.4 - Added support for caption on tables (thx to Geoffrey Picron) Version 1.2.0 (2012-10-05) -------------------------- - Upgraded to parboiled 1.1.3 - Implemented parsing timeout, closes #42 - Fixed IndexOutOfBoundsException in ToHtmlSerializer, closes #39 - Changed parser to not swallow backslash before non-special characters, fixes #35 - Added test for fenced code blocks containing an empty line, closes #61 - Migrated all tests from TestNG to specs2 - Switched build tool from Apache Buildr to SBT Version 1.1.0 (2011-10-05) -------------------------- - Upgraded to parboiled 1.0.2 - Introduced LinkRenderer layer for easy customization of HTML link rendering - Added support for [[Wiki-style]] links, thx to Brett Porter - Fixed #27 (Missing emphasis when paragraph has multiple lines) - Fixed #28 (Parser not fully extensible) - Fixed #32, #33 (HTML tags with attribute names containing underscores are not recognized as tags, thx to Edward Samson) - Fixed #34 (Pathologically slow parsing when strong and italics emphasis are applied together) Version 1.0.2 (2011-07-05) -------------------------- - Simplify custom extensions by making `private` fields/methods of ToHtmlSerializer and Parser `protected` - Fixed #20 (support GFM fenced code blocks) - Fixed #21 (simplify integration of custom code transformers) - Fixed #22 (some characters/sequences break links when AutoLinks extensions is on) - Fixed broken Java 1.5 compatibility (thx to Julien Nicoulaud) - Fixed maven build: add testng and jtidy deps for tests, and configure the compiler plugin for java 5 (thx to Lukas Theussl) Version 1.0.1 (2011-05-17) -------------------------- - Fixed #18 (code blocks in list items split by lines) Version 1.0.0 (2011-05-13) -------------------------- - Closed #3 (PhpMarkdownExtra-style definition lists) - closed #14 (superfluous paragraph breaks) - Closed #15 (email obfuscation) - Closed #16 (PhpMarkdownExtra-style fenced code blocks) - Closed #17 ('nofollow' links) - Added buffer indices to AST nodes, enabling markdown syntax highlighting - Removed tabstop expansion (prevented proper AST node index building) - Improved single quoting rules for Smartypants extension - Completely refactored list parsing for code size, performance and simplicity - Fixed small problem with AutoLink delimiters - Upgraded to parboiled 1.0.0 Version 0.9.2 (2011-04-06) -------------------------- - Fix: special characters not encoded correctly in plain text sections - Fix: HTML hex entities incorrectly parsed - Add indices into underlying buffer to AST nodes - Upgraded to parboiled 0.11.1 Version 0.9.1 (2011-03-21) -------------------------- - Upgraded to parboiled 0.11.0 Version 0.9.0 (2011-02-11) -------------------------- - Completely overhauled and cleaned up general architecture, split out HTML serialization into AST visitor (thanks to Ravindar Reddy) - Fixed bug causing the disappearance of text elements in certain list constructs - Fixed excessive backtracking bug on parsing larger blocks of 'opening-tags-only' HTML - Fixed file name casing problem causing certain tests to fail on case-sensitive file systems - Implemented various smaller performance improvements resulting in a general speed-up by 10-30% - Opened up PegDownProcessor and Parser to custom extensions - Switched from Ant to Buildr, changed to maven-style project layout - Changed to 3 part version numbering in preparation of the coming semantic versioning compatibility (http://semver.org) - Upgraded to parboiled 0.10.1 Version 0.8.5.4 (2010-10-04) ---------------------------- - Switched off superfluous parse tree building resulting in nearly doubled parsing performance - Upgraded to parboiled 0.9.9.0 Version 0.8.5.3 (2010-08-13) ---------------------------- - Added HTML suppression options - Upgraded to parboiled 0.9.8.2 (another ~ 5% performance increase by using a few @MemoMismatches annotations) Version 0.8.5.2 (2010-08-12) ---------------------------- - Upgraded to parboiled 0.9.8.1 (~ 10% performance increase, slightly simplified parser) Version 0.8.5.1 (2010-06-19) ---------------------------- - Fixed several problems, especially with regard to image links (thanks to Nick Ewing for the report) - Added support for double angle quotes to the QUOTES extension - Further increased test coverage Version 0.8.5.0 (2010-06-14) ---------------------------- - Completely rewrote AST implementation improving maintainability and simplifying further extensions - Fixed different problems, mainly related to the ABBREVIATIONS extension - Added TABLES extension - Added simple benchmarking "test" Version 0.8.1.0 (2010-06-08) ---------------------------- - Fixed problem with SetextHeading2 - Fixed performance problem in inputs with complex emphasis constructs - Added ABBREVIATIONS extension - Added HARDWRAPS extension - Added AUTOLINKS extension - Added support for parens in link urls (must be escaped in explicit links) - Expanded test coverage Version 0.8.0.1 (2010-04-30) ---------------------------- first public release pegdown-1.5.0/LICENSE000066400000000000000000000261351247356127500142100ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. pegdown-1.5.0/NOTICE000066400000000000000000000002761247356127500141050ustar00rootroot00000000000000pegdown Copyright (C) 2010-2011 Mathias Doenitz Based on peg-markdown - markdown in c, implemented using PEG grammar Copyright (c) 2008 John MacFarlane (http://github.com/jgm/peg-markdown) pegdown-1.5.0/README.markdown000066400000000000000000000216751247356127500157100ustar00rootroot00000000000000Introduction ------------ _pegdown_ is a pure Java library for clean and lightweight [Markdown] processing based on a [parboiled] PEG parser. _pegdown_ is nearly 100% compatible with the original Markdown specification and fully passes the original Markdown test suite. On top of the standard Markdown feature set _pegdown_ implements a number of extensions similar to what other popular Markdown processors offer. You can also extend _pegdown_ by your own plugins! Currently _pegdown_ supports the following extensions over standard Markdown: * SMARTS: Beautifies apostrophes, ellipses ("..." and ". . .") and dashes ("--" and "---") * QUOTES: Beautifies single quotes, double quotes and double angle quotes (« and ») * SMARTYPANTS: Convenience extension enabling both, SMARTS and QUOTES, at once. * ABBREVIATIONS: Abbreviations in the way of [PHP Markdown Extra](http://michelf.com/projects/php-markdown/extra/#abbr). * HARDWRAPS: Alternative handling of newlines, see [Github-flavoured-Markdown] * AUTOLINKS: Plain (undelimited) autolinks the way [Github-flavoured-Markdown] implements them. * TABLES: Tables similar to [MultiMarkdown](http://fletcherpenney.net/multimarkdown/) (which is in turn like the [PHP Markdown Extra](http://michelf.com/projects/php-markdown/extra/#table) tables, but with colspan support). * DEFINITION LISTS: Definition lists in the way of [PHP Markdown Extra](http://michelf.com/projects/php-markdown/extra/#def-list). * FENCED CODE BLOCKS: Fenced Code Blocks in the way of [PHP Markdown Extra](http://michelf.com/projects/php-markdown/extra/#fenced-code-blocks) or [Github-flavoured-Markdown]. * HTML BLOCK SUPPRESSION: Suppresses the output of HTML blocks. * INLINE HTML SUPPRESSION: Suppresses the output of inline HTML elements. * WIKILINKS: Support `[[Wiki-style links]]` with a customizable URL rendering logic. * STRIKETHROUGH: Support ~~strikethroughs~~ as supported in Pandoc and Github. Note: _pegdown_ differs from the original Markdown in that it ignores in-word emphasis as in > my_cool_file.txt > 2*3*4=5 Currently this "extension" cannot be switched off. Installation ------------ You have two options: * Download the JAR for the latest version from [here](http://repo1.maven.org/maven2/org/pegdown/pegdown/). _pegdown_ 1.5.0 has only one dependency: [parboiled for Java][parboiled], version 1.1.7. * The pegdown artifact is also available from maven central with group id **org.pegdown** and artifact-id **pegdown**. Usage ----- Using _pegdown_ is very simple: Just create a new instance of a [PegDownProcessor] and call one of its `markdownToHtml` methods to convert the given Markdown source to an HTML string. If you'd like to customize the rendering of HTML links (Auto-Links, Explicit-Links, Mail-Links, Reference-Links and/or Wiki-Links), e.g. for adding `rel="nofollow"` attributes based on some logic you can supply your own instance of a [LinkRenderer] with the call to `markdownToHtml`. You can also use pegdown only for the actual parsing of the Markdown source and do the serialization to the target format (e.g. XML) yourself. To do this just call the `parseMarkdown` method of the [PegDownProcessor] to obtain the root node of the Abstract Syntax Tree for the document. With a custom [Visitor] implementation you can do whatever serialization you want. As an example you might want to take a look at the [sources of the ToHtmlSerializer][ToHtmlSerializer]. Note that the first time you create a [PegDownProcessor] it can take up to a few hundred milliseconds to prepare the underlying parboiled parser instance. However, once the first processor has been built all further instantiations will be fast. Also, you can reuse an existing [PegDownProcessor] instance as often as you want, as long as you prevent concurrent accesses, since neither the [PegDownProcessor] nor the underlying parser is thread-safe. See for the pegdown API documentation. Plugins ------- Since parsing and serialisation are two different things there are two different plugin mechanisms, one for the parser, and one for the [ToHtmlSerializer]. Most plugins would probably implement both, but it is possible that a plugin might just implement the parser plugin interface. For the parser there are two plugin points, one for inline plugins (inside a paragraph) and one for block plugins. These are provided to the parser using the [PegDownPlugins] class. For convenience of use this comes with its own builder. You can either pass individual rules to this builder (which is what you probably would do if you were using Scala rules), but you can also pass it a parboiled Java parser class which implements either [InlinePluginParser] or [BlockPluginParser] or both. [PegDownPlugins] will enhance this parser for you, so as a user of a plugin you just need to pass the class to it (and the arguments for that classes constructor, if any). To implement the plugin, you would write a normal parboiled parser, and implement the appropriate parser plugin interface. You can extend the pegdown parser, this is useful if you want to reuse any of its rules. For the serializer there is [ToHtmlSerializerPlugin] interface. It is called when a node that the [ToHtmlSerializer] doesn't know how to process is encountered (i.e. one produced by a parser plugin). Its `accept` method is passed the node, the visitor (so if the node contains child nodes they can be rendered using the parent) and the printer for the plugin to print to. The `accept` method returns true if it knew how to handle the node or false if otherwise and the [ToHtmlSerializer] loops through each plugin breaking when it reaches one that returns true and if it finds none throws an exception like it used to. As an very simple example you might want to take a look at the [sources of the PluginParser test class][PluginParser]. Parsing Timeouts ---------------- Since Markdown has no official grammar and contains a number of ambiguities the parsing of Markdown source, especially with enabled language extensions, can be "hard" and result, in certain corner cases, in exponential parsing time. In order to provide a somewhat predictable behavior *pegdown* therefore supports the specification of a parsing timeout, which you can supply to the [PegDownProcessor] constructor. If the parser happens to run longer than the specified timeout period it terminates itself with an exception, which causes the `markdownToHtml` method to return `null`. Your application should then deal with this case accordingly and, for example, inform the user. The default timeout, if not explicitly specified, is 2 seconds. IDE Support ----------- The excellent [idea-markdown plugin] for IntelliJ IDEA, RubyMine, PhpStorm, WebStorm, PyCharm and appCode uses _pegdown_ as its underlying parsing engine. The plugin gives you proper syntax-highlighting for markdown source and shows you exactly, how _pegdown_ will parse your texts. Credits ------- A large part of the underlying PEG grammar was developed by John MacFarlane and made available with his tool [peg-markdown](http://github.com/jgm/peg-markdown). License ------- _pegdown_ is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0). Patch Policy ------------ Feedback and contributions to the project, no matter what kind, are always very welcome. However, patches can only be accepted from their original author. Along with any patches, please state that the patch is your original work and that you license the work to the pegdown project under the project’s open source license. [Markdown]: http://daringfireball.net/projects/markdown/ "Main Markdown site" [parboiled]: http://www.parboiled.org [Github-flavoured-Markdown]: http://github.github.com/github-flavored-markdown/ [MultiMarkdown]: http://fletcherpenney.net/multimarkdown/users_guide/multimarkdown_syntax_guide/ [PegDownProcessor]: http://www.decodified.com/pegdown/api/org/pegdown/PegDownProcessor.html [LinkRenderer]: http://www.decodified.com/pegdown/api/org/pegdown/LinkRenderer.html [Visitor]: http://www.decodified.com/pegdown/api/org/pegdown/ast/Visitor.html [ToHtmlSerializer]: https://github.com/sirthias/pegdown/blob/master/src/main/java/org/pegdown/ToHtmlSerializer.java [idea-markdown plugin]: https://github.com/nicoulaj/idea-markdown [SBT]: http://www.scala-sbt.org/ [Node]: http://www.decodified.com/pegdown/api/org/pegdown/ast/Node.html [PegDownPlugins]: http://github.com/sirthias/pegdown/blob/master/src/main/java/org/pegdown/plugins/PegDownPlugins.java [InlinePluginParser]: http://github.com/sirthias/pegdown/blob/master/src/main/java/org/pegdown/plugins/InlinePluginParser.java [BlockPluginParser]: http://github.com/sirthias/pegdown/blob/master/src/main/java/org/pegdown/plugins/BlockPluginParser.java [ToHtmlSerializerPlugin]: http://github.com/sirthias/pegdown/blob/master/src/main/java/org/pegdown/plugins/ToHtmlSerializerPlugin.java [PluginParser]: http://github.com/sirthias/pegdown/blob/master/src/test/java/org/pegdown/PluginParser.java pegdown-1.5.0/build.sbt000066400000000000000000000032561247356127500150130ustar00rootroot00000000000000name := "pegdown" version := "1.5.0" homepage := Some(new URL("http://pegdown.org")) organization := "org.pegdown" organizationHomepage := Some(new URL("http://pegdown.org")) description := "A Java 1.6+ library providing a clean and lightweight markdown processor" startYear := Some(2009) licenses := Seq("Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt")) javacOptions ++= Seq( "-g", // required for byte-code rewriting in parboiled-java! "-deprecation", "-target", "1.6", "-source", "1.6", "-encoding", "utf8", "-Xlint:unchecked" ) javacOptions in doc := Seq( "-source", "1.6", "-encoding", "utf8" ) scalaVersion := "2.11.5" scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8") libraryDependencies ++= Seq( "org.parboiled" % "parboiled-java" % "1.1.7", "net.sf.jtidy" % "jtidy" % "r938" % "test", "org.specs2" %% "specs2-core" % "2.4.16" % "test" ) // publishing crossPaths := false autoScalaLibrary := false publishMavenStyle := true publishArtifact in Test := false pomIncludeRepository := { _ => false } useGpg := true pgpSigningKey := Some(-2321133875171851978L) publishTo <<= version { v: String => val nexus = "https://oss.sonatype.org/" if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots") else Some("releases" at nexus + "service/local/staging/deploy/maven2") } pomExtra := git@github.com:sirthias/pegdown.git scm:git:git@github.com:sirthias/pegdown.git sirthias Mathias Doenitz pegdown-1.5.0/project/000077500000000000000000000000001247356127500146425ustar00rootroot00000000000000pegdown-1.5.0/project/build.properties000066400000000000000000000000221247356127500200510ustar00rootroot00000000000000sbt.version=0.13.7pegdown-1.5.0/project/plugins.sbt000066400000000000000000000000621247356127500170330ustar00rootroot00000000000000addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")pegdown-1.5.0/src/000077500000000000000000000000001247356127500137635ustar00rootroot00000000000000pegdown-1.5.0/src/main/000077500000000000000000000000001247356127500147075ustar00rootroot00000000000000pegdown-1.5.0/src/main/java/000077500000000000000000000000001247356127500156305ustar00rootroot00000000000000pegdown-1.5.0/src/main/java/org/000077500000000000000000000000001247356127500164175ustar00rootroot00000000000000pegdown-1.5.0/src/main/java/org/pegdown/000077500000000000000000000000001247356127500200625ustar00rootroot00000000000000pegdown-1.5.0/src/main/java/org/pegdown/DefaultVerbatimSerializer.java000066400000000000000000000020271247356127500260360ustar00rootroot00000000000000package org.pegdown; import org.parboiled.common.StringUtils; import org.pegdown.ast.VerbatimNode; public class DefaultVerbatimSerializer implements VerbatimSerializer { public static final DefaultVerbatimSerializer INSTANCE = new DefaultVerbatimSerializer(); @Override public void serialize(final VerbatimNode node, final Printer printer) { printer.println().print("
");
        String text = node.getText();
        // print HTML breaks for all initial newlines
        while (text.charAt(0) == '\n') {
            printer.print("
"); text = text.substring(1); } printer.printEncoded(text); printer.print("
"); } private void printAttribute(final Printer printer, final String name, final String value) { printer.print(' ').print(name).print('=').print('"').print(value).print('"'); } } pegdown-1.5.0/src/main/java/org/pegdown/Extensions.java000066400000000000000000000101711247356127500230640ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown; public interface Extensions { /** * The default, standard markup mode without any extensions. */ static final int NONE = 0x00; /** * Pretty ellipses, dashes and apostrophes. */ static final int SMARTS = 0x01; /** * Pretty single and double quotes. */ static final int QUOTES = 0x02; /** * All of the smartypants prettyfications. Equivalent to SMARTS + QUOTES. * * @see Smartypants */ static final int SMARTYPANTS = SMARTS + QUOTES; /** * PHP Markdown Extra style abbreviations. * * @see PHP Markdown Extra */ static final int ABBREVIATIONS = 0x04; /** * Enables the parsing of hard wraps as HTML linebreaks. Similar to what github does. * * @see Github-flavored-Markdown */ static final int HARDWRAPS = 0x08; /** * Enables plain autolinks the way github flavoured markdown implements them. * With this extension enabled pegdown will intelligently recognize URLs and email addresses * without any further delimiters and mark them as the respective link type. * * @see Github-flavored-Markdown */ static final int AUTOLINKS = 0x10; /** * Table support similar to what Multimarkdown offers. * * @see MultiMarkdown */ static final int TABLES = 0x20; /** * PHP Markdown Extra style definition lists. * Additionally supports the small extension proposed in the article referenced below. * * @see PHP Markdown Extra * @see Extension proposal */ static final int DEFINITIONS = 0x40; /** * PHP Markdown Extra style fenced code blocks. * * @see PHP Markdown Extra */ static final int FENCED_CODE_BLOCKS = 0x80; /** * Support [[Wiki-style links]]. URL rendering is performed by the active {@link LinkRenderer}. * * @see Github-flavored-Markdown */ static final int WIKILINKS = 0x100; /** * Support ~~strikethroughs~~ as supported in Pandoc and Github. */ static final int STRIKETHROUGH = 0x200; /** * Enables anchor links in headers. */ static final int ANCHORLINKS = 0x300; /** * All available extensions excluding the SUPPRESS_... options. */ static final int ALL = 0x0000FFFF; /** * Suppresses HTML blocks. They will be accepted in the input but not be contained in the output. */ static final int SUPPRESS_HTML_BLOCKS = 0x00010000; /** * Suppresses inline HTML tags. They will be accepted in the input but not be contained in the output. */ static final int SUPPRESS_INLINE_HTML = 0x00020000; /** * Suppresses HTML blocks as well as inline HTML tags. * Both will be accepted in the input but not be contained in the output. */ static final int SUPPRESS_ALL_HTML = 0x00030000; } pegdown-1.5.0/src/main/java/org/pegdown/FastEncoder.java000066400000000000000000000053661247356127500231340ustar00rootroot00000000000000package org.pegdown; import org.parboiled.common.StringUtils; import java.util.Random; /** * Static class holding simple HTML encoding logic. */ public class FastEncoder { private FastEncoder() {} public static String encode(String string) { if (StringUtils.isNotEmpty(string)) { for (int i = 0; i < string.length(); i++) { if (encode(string.charAt(i)) != null) { // we have at least one character that needs encoding, so do it one by one StringBuilder sb = new StringBuilder(); for (i = 0; i < string.length(); i++) { char c = string.charAt(i); String encoded = encode(c); if (encoded != null) sb.append(encoded); else sb.append(c); } return sb.toString(); } } return string; } else return ""; } public static void encode(String string, StringBuilder sb) { if (StringUtils.isNotEmpty(string)) { for (int i = 0; i < string.length(); i++) { if (encode(string.charAt(i)) != null) { // we have at least one character that needs encoding, so do it one by one for (i = 0; i < string.length(); i++) { char c = string.charAt(i); String encoded = encode(c); if (encoded != null) sb.append(encoded); else sb.append(c); } return; } } sb.append(string); } } public static String encode(char c) { switch (c) { case '&': return "&"; case '<': return "<"; case '>': return ">"; case '"': return """; case '\'': return "'"; } return null; } private static Random random = new Random(0x2626); public static String obfuscate(String email) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < email.length(); i++) { char c = email.charAt(i); switch (random.nextInt(5)) { case 0: case 1: sb.append("&#").append((int) c).append(';'); break; case 2: case 3: sb.append("&#x").append(Integer.toHexString(c)).append(';'); break; case 4: String encoded = encode(c); if (encoded != null) sb.append(encoded); else sb.append(c); } } return sb.toString(); } } pegdown-1.5.0/src/main/java/org/pegdown/LinkRenderer.java000066400000000000000000000070331247356127500233140ustar00rootroot00000000000000package org.pegdown; import org.parboiled.common.StringUtils; import org.pegdown.ast.*; import static org.pegdown.FastEncoder.*; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; /** * A LinkRenderer is responsible for turning an AST node representing a link into a {@link LinkRenderer.Rendering} * instance, which hold the actual properties of the link as it is going to be rendered. * If you'd like to apply custom logic to link rendering (e.g. for selectively adding "nofollow" attributes) you * should derive a custom LinkRenderer from this class and override the respective methods. */ public class LinkRenderer { /** * Simple model class for an HTML tag attribute. */ public static class Attribute { public static final Attribute NO_FOLLOW = new Attribute("rel", "nofollow"); public final String name; public final String value; public Attribute(String name, String value) { this.name = name; this.value = value; } } /** * Simple model class for holding the `href`, link text as well as other tag attributes of an HTML link. */ public static class Rendering { public final String href; public final String text; public final List attributes = new ArrayList(2); public Rendering(String href, String text) { this.href = href; this.text = text; } public Rendering withAttribute(String name, String value) { return withAttribute(new Attribute(name, value)); } public Rendering withAttribute(Attribute attr) { attributes.add(attr); return this; } } public Rendering render(AnchorLinkNode node) { String name = node.getName(); return new Rendering('#' + name, node.getText()).withAttribute("name", name); } public Rendering render(AutoLinkNode node) { return new Rendering(node.getText(), node.getText()); } public Rendering render(ExpLinkNode node, String text) { Rendering rendering = new Rendering(node.url, text); return StringUtils.isEmpty(node.title) ? rendering : rendering.withAttribute("title", encode(node.title)); } public Rendering render(ExpImageNode node, String text) { Rendering rendering = new Rendering(node.url, text); return StringUtils.isEmpty(node.title) ? rendering : rendering.withAttribute("title", encode(node.title)); } public Rendering render(MailLinkNode node) { String obfuscated = obfuscate(node.getText()); return new Rendering("mailto:" + obfuscated, obfuscated); } public Rendering render(RefLinkNode node, String url, String title, String text) { Rendering rendering = new Rendering(url, text); return StringUtils.isEmpty(title) ? rendering : rendering.withAttribute("title", encode(title)); } public Rendering render(RefImageNode node, String url, String title, String alt) { Rendering rendering = new Rendering(url, alt); return StringUtils.isEmpty(title) ? rendering : rendering.withAttribute("title", encode(title)); } public Rendering render(WikiLinkNode node) { try { String url = "./" + URLEncoder.encode(node.getText().replace(' ', '-'), "UTF-8") + ".html"; return new Rendering(url, node.getText()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(); } } } pegdown-1.5.0/src/main/java/org/pegdown/Parser.java000066400000000000000000001476331247356127500221770ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown; import org.parboiled.BaseParser; import org.parboiled.Context; import org.parboiled.Rule; import org.parboiled.annotations.*; import org.parboiled.common.ArrayBuilder; import org.parboiled.common.ImmutableList; import org.parboiled.parserunners.ParseRunner; import org.parboiled.parserunners.ReportingParseRunner; import org.parboiled.support.ParsingResult; import org.parboiled.support.StringBuilderVar; import org.parboiled.support.StringVar; import org.parboiled.support.Var; import org.pegdown.ast.*; import org.pegdown.ast.SimpleNode.Type; import org.pegdown.plugins.PegDownPlugins; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import static org.parboiled.errors.ErrorUtils.printParseErrors; import static org.parboiled.common.StringUtils.repeat; /** * Parboiled parser for the standard and extended markdown syntax. * Builds an Abstract Syntax Tree (AST) of {@link Node} objects. */ @SuppressWarnings( {"InfiniteRecursion"}) public class Parser extends BaseParser implements Extensions { protected static final char CROSSED_OUT = '\uffff'; public interface ParseRunnerProvider { ParseRunner get(Rule rule); } public static ParseRunnerProvider DefaultParseRunnerProvider = new Parser.ParseRunnerProvider() { public ParseRunner get(Rule rule) { return new ReportingParseRunner(rule); } }; protected final int options; protected final long maxParsingTimeInMillis; protected final ParseRunnerProvider parseRunnerProvider; protected final PegDownPlugins plugins; final List abbreviations = new ArrayList(); final List references = new ArrayList(); long parsingStartTimeStamp = 0L; public Parser(Integer options, Long maxParsingTimeInMillis, ParseRunnerProvider parseRunnerProvider, PegDownPlugins plugins) { this.options = options; this.maxParsingTimeInMillis = maxParsingTimeInMillis; this.parseRunnerProvider = parseRunnerProvider; this.plugins = plugins; } public Parser(Integer options, Long maxParsingTimeInMillis, ParseRunnerProvider parseRunnerProvider) { this(options, maxParsingTimeInMillis, parseRunnerProvider, PegDownPlugins.NONE); } public RootNode parse(char[] source) { try { RootNode root = parseInternal(source); root.setAbbreviations(ImmutableList.copyOf(abbreviations)); root.setReferences(ImmutableList.copyOf(references)); return root; } finally { abbreviations.clear(); references.clear(); } } //************* BLOCKS **************** public Rule Root() { return NodeSequence( push(new RootNode()), ZeroOrMore(Block(), addAsChild()) ); } public Rule Block() { return Sequence( ZeroOrMore(BlankLine()), FirstOf(new ArrayBuilder() .add(plugins.getBlockPluginRules()) .add(BlockQuote(), Verbatim()) .addNonNulls(ext(ABBREVIATIONS) ? Abbreviation() : null) .add(Reference(), HorizontalRule(), Heading(), OrderedList(), BulletList(), HtmlBlock()) .addNonNulls(ext(TABLES) ? Table() : null) .addNonNulls(ext(DEFINITIONS) ? DefinitionList() : null) .addNonNulls(ext(FENCED_CODE_BLOCKS) ? FencedCodeBlock() : null) .add(Para(), Inlines()) .get() ) ); } public Rule Para() { return NodeSequence( NonindentSpace(), Inlines(), push(new ParaNode(popAsNode())), OneOrMore(BlankLine()) ); } public Rule BlockQuote() { StringBuilderVar inner = new StringBuilderVar(); return NodeSequence( OneOrMore( CrossedOut(Sequence('>', Optional(' ')), inner), Line(inner), ZeroOrMore( TestNot('>'), TestNot(BlankLine()), Line(inner) ), ZeroOrMore(BlankLine(), inner.append(match())) ), // trigger a recursive parsing run on the inner source we just built // and attach the root of the inner parses AST push(new BlockQuoteNode(withIndicesShifted(parseInternal(inner), (Integer)peek()).getChildren())) ); } public Rule Verbatim() { StringBuilderVar text = new StringBuilderVar(); StringBuilderVar line = new StringBuilderVar(); return NodeSequence( OneOrMore( ZeroOrMore(BlankLine(), line.append("\n")), Indent(), push(currentIndex()), OneOrMore( FirstOf( Sequence('\t', line.append(repeat(' ', 4-(currentIndex()-1-(Integer)peek())%4))), Sequence(NotNewline(), ANY, line.append(matchedChar())) ) ), Newline(), text.appended(line.getString()).append('\n') && line.clearContents() && drop() ), push(new VerbatimNode(text.getString())) ); } public Rule FencedCodeBlock() { StringBuilderVar text = new StringBuilderVar(); Var markerLength = new Var(); return NodeSequence( CodeFence(markerLength), TestNot(CodeFence(markerLength)), // prevent empty matches ZeroOrMore(BlankLine(), text.append('\n')), OneOrMore(TestNot(Newline(), CodeFence(markerLength)), ANY, text.append(matchedChar())), Newline(), push(new VerbatimNode(text.appended('\n').getString(), popAsString())), CodeFence(markerLength), drop() ); } @Cached public Rule CodeFence(Var markerLength) { return Sequence( FirstOf(NOrMore('~', 3), NOrMore('`', 3)), (markerLength.isSet() && matchLength() == markerLength.get()) || (markerLength.isNotSet() && markerLength.set(matchLength())), Sp(), ZeroOrMore(TestNot(Newline()), ANY), // GFM code type identifier push(match()), Newline() ); } public Rule HorizontalRule() { return NodeSequence( NonindentSpace(), FirstOf(HorizontalRule('*'), HorizontalRule('-'), HorizontalRule('_')), Sp(), Newline(), OneOrMore(BlankLine()), push(new SimpleNode(Type.HRule)) ); } public Rule HorizontalRule(char c) { return Sequence(c, Sp(), c, Sp(), c, ZeroOrMore(Sp(), c)); } //************* HEADINGS **************** public Rule Heading() { return NodeSequence(FirstOf(AtxHeading(), SetextHeading())); } public Rule AtxHeading() { return Sequence( AtxStart(), Optional(Sp()), OneOrMore(AtxInline(), addAsChild()), wrapInAnchor(), Optional(Sp(), ZeroOrMore('#'), Sp()), Newline() ); } public Rule AtxStart() { return Sequence( FirstOf("######", "#####", "####", "###", "##", "#"), push(new HeaderNode(match().length())) ); } public Rule AtxInline() { return Sequence( TestNot(Newline()), TestNot(Optional(Sp()), ZeroOrMore('#'), Sp(), Newline()), Inline() ); } public Rule SetextHeading() { return Sequence( // test for successful setext heading before actually building it to reduce backtracking Test(OneOrMore(NotNewline(), ANY), Newline(), FirstOf(NOrMore('=', 3), NOrMore('-', 3)), Newline()), FirstOf(SetextHeading1(), SetextHeading2()) ); } public Rule SetextHeading1() { return Sequence( SetextInline(), push(new HeaderNode(1, popAsNode())), ZeroOrMore(SetextInline(), addAsChild()), wrapInAnchor(), Newline(), NOrMore('=', 3), Newline() ); } public Rule SetextHeading2() { return Sequence( SetextInline(), push(new HeaderNode(2, popAsNode())), ZeroOrMore(SetextInline(), addAsChild()), wrapInAnchor(), Newline(), NOrMore('-', 3), Newline() ); } public Rule SetextInline() { return Sequence(TestNot(Endline()), Inline()); } public boolean wrapInAnchor() { if (ext(ANCHORLINKS)) { SuperNode node = (SuperNode) peek(); List children = node.getChildren(); if (children.size() == 1) { Node child = children.get(0); if (child instanceof TextNode) { AnchorLinkNode anchor = new AnchorLinkNode(((TextNode) child).getText()); anchor.setStartIndex(child.getStartIndex()); anchor.setEndIndex(child.getEndIndex()); children.set(0, anchor); } } } return true; } //************** Definition Lists ************ public Rule DefinitionList() { return NodeSequence( // test for successful definition list match before actually building it to reduce backtracking TestNot(Spacechar()), Test( OneOrMore(TestNot(BlankLine()), TestNot(DefListBullet()), OneOrMore(NotNewline(), ANY), Newline()), Optional(BlankLine()), DefListBullet() ), push(new DefinitionListNode()), OneOrMore( push(new SuperNode()), OneOrMore(DefListTerm(), addAsChild()), OneOrMore(Definition(), addAsChild()), ((SuperNode)peek(1)).getChildren().addAll(popAsNode().getChildren()), Optional(BlankLine()) ) ); } public Rule DefListTerm() { return NodeSequence( TestNot(Spacechar()), TestNot(DefListBullet()), push(new DefinitionTermNode()), OneOrMore(DefTermInline(), addAsChild()), Optional(':'), Newline() ); } public Rule DefTermInline() { return Sequence( NotNewline(), TestNot(':', Newline()), Inline() ); } public Rule Definition() { SuperNodeCreator itemNodeCreator = new SuperNodeCreator() { public SuperNode create(Node child) { return new DefinitionNode(child); } }; return ListItem(DefListBullet(), itemNodeCreator); } public Rule DefListBullet() { return Sequence(NonindentSpace(), AnyOf(":~"), OneOrMore(Spacechar())); } //************* LISTS **************** public Rule BulletList() { SuperNodeCreator itemNodeCreator = new SuperNodeCreator() { public SuperNode create(Node child) { return new ListItemNode(child); } }; return NodeSequence( ListItem(Bullet(), itemNodeCreator), push(new BulletListNode(popAsNode())), ZeroOrMore(ListItem(Bullet(), itemNodeCreator), addAsChild()), ZeroOrMore(BlankLine()) ); } public Rule OrderedList() { SuperNodeCreator itemNodeCreator = new SuperNodeCreator() { public SuperNode create(Node child) { return new ListItemNode(child); } }; return NodeSequence( ListItem(Enumerator(), itemNodeCreator), push(new OrderedListNode(popAsNode())), ZeroOrMore(ListItem(Enumerator(), itemNodeCreator), addAsChild()), ZeroOrMore(BlankLine()) ); } @Cached public Rule ListItem(Rule itemStart, SuperNodeCreator itemNodeCreator) { // for a simpler parser design we use a recursive parsing strategy for list items: // we collect a number of markdown source blocks for an item, run complete parsing cycle on these and attach // the roots of the inner parsing results AST to the outer AST tree StringBuilderVar block = new StringBuilderVar(); StringBuilderVar temp = new StringBuilderVar(); Var tight = new Var(false); Var tightFirstItem = new Var(); return Sequence( push(getContext().getCurrentIndex()), FirstOf(CrossedOut(BlankLine(), block), tight.set(true)), CrossedOut(itemStart, block), Line(block), ZeroOrMore( Optional(CrossedOut(Indent(), temp)), NotItem(), Line(temp), block.append(temp.getString()) && temp.clearContents() ), tight.get() ? push(tightFirstItem.setAndGet(itemNodeCreator.create(parseListBlock(block)))) : fixFirstItem((SuperNode) peek(1)) && push(itemNodeCreator.create(parseListBlock(block.appended("\n\n")))), ZeroOrMore( push(getContext().getCurrentIndex()), FirstOf(Sequence(CrossedOut(BlankLine(), block), tight.set(false)), tight.set(true)), CrossedOut(Indent(), block), FirstOf( DoubleIndentedBlocks(block), IndentedBlock(block) ), (tight.get() ? push(parseListBlock(block)) : (tightFirstItem.isNotSet() || wrapFirstItemInPara(tightFirstItem.get())) && push(parseListBlock(block.appended("\n\n"))) ) && addAsChild() ), setListItemIndices() ); } public Rule CrossedOut(Rule rule, StringBuilderVar block) { return Sequence(rule, appendCrossed(block)); } public Rule DoubleIndentedBlocks(StringBuilderVar block) { StringBuilderVar line = new StringBuilderVar(); return Sequence( Indent(), TestNot(BlankLine()), block.append(" "), Line(block), ZeroOrMore( ZeroOrMore(BlankLine(), line.append(match())), CrossedOut(Indent(), line), Indent(), line.append(" "), Line(line), block.append(line.getString()) && line.clearContents() ) ); } public Rule IndentedBlock(StringBuilderVar block) { return Sequence( Line(block), ZeroOrMore( FirstOf( Sequence(TestNot(BlankLine()), CrossedOut(Indent(), block)), NotItem() ), Line(block) ) ); } public Rule NotItem() { return TestNot( FirstOf(new ArrayBuilder() .add(Bullet(), Enumerator(), BlankLine(), HorizontalRule()) .addNonNulls(ext(DEFINITIONS) ? DefListBullet() : null) .get() ) ); } public Rule Enumerator() { return Sequence(NonindentSpace(), OneOrMore(Digit()), '.', OneOrMore(Spacechar())); } public Rule Bullet() { return Sequence(TestNot(HorizontalRule()), NonindentSpace(), AnyOf("+*-"), OneOrMore(Spacechar())); } //************* LIST ITEM ACTIONS **************** boolean appendCrossed(StringBuilderVar block) { for (int i = 0; i < matchLength(); i++) { block.append(CROSSED_OUT); } return true; } Node parseListBlock(StringBuilderVar block) { Context context = getContext(); Node innerRoot = parseInternal(block); setContext(context); // we need to save and restore the context since we might be recursing block.clearContents(); return withIndicesShifted(innerRoot, (Integer) context.getValueStack().pop()); } Node withIndicesShifted(Node node, int delta) { ((AbstractNode) node).shiftIndices(delta); for (Node subNode : node.getChildren()) { withIndicesShifted(subNode, delta); } return node; } boolean fixFirstItem(SuperNode listNode) { List items = listNode.getChildren(); if (items.size() == 1 && items.get(0) instanceof ListItemNode) { wrapFirstItemInPara((SuperNode) items.get(0)); } return true; } boolean wrapFirstItemInPara(SuperNode item) { Node firstItemFirstChild = item.getChildren().get(0); ParaNode paraNode = new ParaNode(firstItemFirstChild.getChildren()); paraNode.setStartIndex(firstItemFirstChild.getStartIndex()); paraNode.setEndIndex(firstItemFirstChild.getEndIndex()); item.getChildren().set(0, paraNode); return true; } boolean setListItemIndices() { SuperNode listItem = (SuperNode) getContext().getValueStack().peek(); List children = listItem.getChildren(); listItem.setStartIndex(children.get(0).getStartIndex()); listItem.setEndIndex(children.get(children.size() - 1).getEndIndex()); return true; } //************* HTML BLOCK **************** public Rule HtmlBlock() { return NodeSequence( FirstOf(HtmlBlockInTags(), HtmlComment(), HtmlBlockSelfClosing()), push(new HtmlBlockNode(ext(SUPPRESS_HTML_BLOCKS) ? "" : match())), OneOrMore(BlankLine()) ); } public Rule HtmlBlockInTags() { StringVar tagName = new StringVar(); return Sequence( Test(HtmlBlockOpen(tagName)), // get the type of tag if there is one HtmlTagBlock(tagName) // specifically match that type of tag ); } @Cached public Rule HtmlTagBlock(StringVar tagName) { return Sequence( HtmlBlockOpen(tagName), ZeroOrMore( FirstOf( HtmlTagBlock(tagName), Sequence(TestNot(HtmlBlockClose(tagName)), ANY) ) ), HtmlBlockClose(tagName) ); } public Rule HtmlBlockSelfClosing() { StringVar tagName = new StringVar(); return Sequence('<', Spn1(), DefinedHtmlTagName(tagName), Spn1(), ZeroOrMore(HtmlAttribute()), Optional('/'), Spn1(), '>'); } public Rule HtmlBlockOpen(StringVar tagName) { return Sequence('<', Spn1(), DefinedHtmlTagName(tagName), Spn1(), ZeroOrMore(HtmlAttribute()), '>'); } @DontSkipActionsInPredicates public Rule HtmlBlockClose(StringVar tagName) { return Sequence('<', Spn1(), '/', OneOrMore(Alphanumeric()), match().equals(tagName.get()), Spn1(), '>'); } @Cached public Rule DefinedHtmlTagName(StringVar tagName) { return Sequence( OneOrMore(Alphanumeric()), tagName.isSet() && match().equals(tagName.get()) || tagName.isNotSet() && tagName.set(match().toLowerCase()) && isHtmlTag(tagName.get()) ); } public boolean isHtmlTag(String string) { return Arrays.binarySearch(HTML_TAGS, string) >= 0; } protected static final String[] HTML_TAGS = new String[] { "address", "blockquote", "center", "dd", "dir", "div", "dl", "dt", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "isindex", "li", "menu", "noframes", "noscript", "ol", "p", "pre", "script", "style", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "ul" }; //************* INLINES **************** public Rule Inlines() { return NodeSequence( InlineOrIntermediateEndline(), push(new SuperNode(popAsNode())), ZeroOrMore(InlineOrIntermediateEndline(), addAsChild()), Optional(Endline(), drop()) ); } public Rule InlineOrIntermediateEndline() { return FirstOf( Sequence(TestNot(Endline()), Inline()), Sequence(Endline(), Test(Inline())) ); } @MemoMismatches public Rule Inline() { return Sequence( checkForParsingTimeout(), FirstOf(Link(), NonLinkInline()) ); } public Rule NonAutoLinkInline() { return FirstOf(NonAutoLink(), NonLinkInline()); } public Rule NonLinkInline() { return FirstOf(new ArrayBuilder() .add(plugins.getInlinePluginRules()) .add(Str(), Endline(), UlOrStarLine(), Space(), StrongOrEmph(), Image(), Code(), InlineHtml(), Entity(), EscapedChar()) .addNonNulls(ext(QUOTES) ? new Rule[]{SingleQuoted(), DoubleQuoted(), DoubleAngleQuoted()} : null) .addNonNulls(ext(SMARTS) ? new Rule[]{Smarts()} : null) .addNonNulls(ext(STRIKETHROUGH) ? new Rule[]{Strike()} : null) .add(Symbol()) .get() ); } @MemoMismatches public Rule Endline() { return NodeSequence(FirstOf(LineBreak(), TerminalEndline(), NormalEndline())); } public Rule LineBreak() { return Sequence(" ", NormalEndline(), poke(new SimpleNode(Type.Linebreak))); } public Rule TerminalEndline() { return NodeSequence(Sp(), Newline(), Test(EOI), push(new TextNode("\n"))); } public Rule NormalEndline() { return Sequence( Sp(), Newline(), TestNot( FirstOf( BlankLine(), '>', AtxStart(), Sequence(ZeroOrMore(NotNewline(), ANY), Newline(), FirstOf(NOrMore('=', 3), NOrMore('-', 3)), Newline()) ) ), ext(HARDWRAPS) ? toRule(push(new SimpleNode(Type.Linebreak))) : toRule(push(new TextNode(" "))) ); } //************* EMPHASIS / STRONG **************** @MemoMismatches public Rule UlOrStarLine() { // This keeps the parser from getting bogged down on long strings of '*', '_' or '~', // or strings of '*', '_' or '~' with space on each side: return NodeSequence( FirstOf(CharLine('_'), CharLine('*'), CharLine('~')), push(new TextNode(match())) ); } public Rule CharLine(char c) { return FirstOf(NOrMore(c, 4), Sequence(Spacechar(), OneOrMore(c), Test(Spacechar()))); } public Rule StrongOrEmph() { return Sequence( Test(AnyOf("*_")), FirstOf(Strong(), Emph()) ); } public Rule Emph() { return NodeSequence( FirstOf( EmphOrStrong("*"), EmphOrStrong("_") ) ); } public Rule Strong() { return NodeSequence( FirstOf( EmphOrStrong("**"), EmphOrStrong("__") ) ); } public Rule Strike() { return NodeSequence( EmphOrStrong("~~"), push(new StrikeNode(popAsNode().getChildren())) ); } @Cached public Rule EmphOrStrong(String chars) { return Sequence( Test(mayEnterEmphOrStrong(chars)), EmphOrStrongOpen(chars), push(new StrongEmphSuperNode(chars)), OneOrMore( TestNot(EmphOrStrongClose(chars)), Inline(), FirstOf( Sequence( //if current inline ends with a closing char for a current strong node: Test(isStrongCloseCharStolen( chars )), //and composes a valid strong close: chars.substring(0, 1), //which is not followed by another closing char (e.g. in __strong _nestedemph___): TestNot(chars.substring(0, 1)), //degrade current inline emph to unclosed and mark current strong node for closing stealBackStrongCloseChar() ), addAsChild() ) ), Optional(Sequence(EmphOrStrongClose(chars), setClosed())) ); } public Rule EmphOrStrongOpen(String chars) { return Sequence( TestNot(CharLine(chars.charAt(0))), chars, TestNot(Spacechar()), NotNewline() ); } @Cached public Rule EmphOrStrongClose(String chars) { return Sequence( Test(isLegalEmphOrStrongClosePos()), FirstOf( Sequence( Test(ValidEmphOrStrongCloseNode.class.equals( peek(0).getClass() )), drop() ), Sequence( TestNot(Spacechar()), NotNewline(), chars, FirstOf((chars.length()==2),TestNot(Alphanumeric())) ) ) ); } /** * This method checks if the parser can enter an emph or strong sequence * Emph only allows Strong as direct child, Strong only allows Emph as * direct child. */ protected boolean mayEnterEmphOrStrong(String chars){ if( !isLegalEmphOrStrongStartPos() ){ return false; } Object parent = peek(2); boolean isStrong = ( chars.length()==2 ); if( StrongEmphSuperNode.class.equals( parent.getClass() ) ){ if( ((StrongEmphSuperNode) parent).isStrong() == isStrong ) return false; } return true; } /** * This method checks if current position is a legal start position for a * strong or emph sequence by checking the last parsed character(-sequence). */ protected boolean isLegalEmphOrStrongStartPos(){ if( currentIndex() == 0 ) return true; Object lastItem = peek(1); Class lastClass = lastItem.getClass(); SuperNode supernode; while( SuperNode.class.isAssignableFrom(lastClass) ) { supernode = (SuperNode) lastItem; if(supernode.getChildren().size() < 1 ) return true; lastItem = supernode.getChildren().get( supernode.getChildren().size()-1 ); lastClass = lastItem.getClass(); } return ( TextNode.class.equals(lastClass) && ( (TextNode) lastItem).getText().endsWith(" ") ) || ( SimpleNode.class.equals(lastClass) ) || ( java.lang.Integer.class.equals(lastClass) ); } /** * Mark the current StrongEmphSuperNode as closed sequence */ protected boolean setClosed(){ StrongEmphSuperNode node = (StrongEmphSuperNode) peek(); node.setClosed(true); return true; } /** * This method checks if current parent is a strong parent based on param `chars`. If so, it checks if the * latest inline node to be added as child does not end with a closing character of the parent. When this * is true, a next test should check if the closing character(s) of the child should become (part of) the * closing character(s) of the parent. */ protected boolean isStrongCloseCharStolen( String chars ){ if(chars.length() < 2 ) return false; Object childClass = peek().getClass(); //checks if last `inline` to be added as child is not a StrongEmphSuperNode //that eats up a closing character for the parent StrongEmphSuperNode if( StrongEmphSuperNode.class.equals( childClass ) ){ StrongEmphSuperNode child = (StrongEmphSuperNode) peek(); if (!child.isClosed()) return false; if( child.getChars().endsWith( chars.substring(0, 1) ) ){ //The nested child ends with closing char for the parent, allow stealing it back return true; } } return false; } /** * Steals the last close char by marking a previously closed emph/strong node as unclosed. */ protected boolean stealBackStrongCloseChar(){ StrongEmphSuperNode child = (StrongEmphSuperNode) peek(); child.setClosed(false); addAsChild(); //signal parser to close StrongEmphSuperNode in next check for close char push(new ValidEmphOrStrongCloseNode()); return true; } /** * This method checks if the last parsed character or sequence is a valid prefix for a closing char for * an emph or strong sequence. */ protected boolean isLegalEmphOrStrongClosePos(){ Object lastItem = peek(); if ( StrongEmphSuperNode.class.equals( lastItem.getClass() ) ){ List children = ((StrongEmphSuperNode) lastItem).getChildren(); if(children.size() < 1) return true; lastItem = children.get( children.size()-1 ); Class lastClass = lastItem.getClass(); if( TextNode.class.equals(lastClass) ) return !((TextNode) lastItem).getText().endsWith(" "); if( SimpleNode.class.equals(lastClass) ) return !((SimpleNode) lastItem).getType().equals(SimpleNode.Type.Linebreak); } return true; } //************* LINKS **************** public Rule Image() { return NodeSequence( '!', Label(), FirstOf(ExplicitLink(true), ReferenceLink(true)) ); } @MemoMismatches public Rule Link() { return NodeSequence( FirstOf(new ArrayBuilder() .addNonNulls(ext(WIKILINKS) ? new Rule[]{WikiLink()} : null) .add(Sequence(Label(), FirstOf(ExplicitLink(false), ReferenceLink(false)))) .add(AutoLink()) .get() ) ); } public Rule NonAutoLink() { return NodeSequence(Sequence(Label(), FirstOf(ExplicitLink(false), ReferenceLink(false)))); } @Cached public Rule ExplicitLink(boolean image) { return Sequence( Spn1(), '(', Sp(), LinkSource(), Spn1(), FirstOf(LinkTitle(), push("")), Sp(), ')', push(image ? new ExpImageNode(popAsString(), popAsString(), popAsNode()) : new ExpLinkNode(popAsString(), popAsString(), popAsNode()) ) ); } public Rule ReferenceLink(boolean image) { return Sequence( FirstOf( Sequence( Spn1(), push(match()), FirstOf( Label(), // regular reference link Sequence("[]", push(null)) // implicit reference link ) ), Sequence(push(null), push(null)) // implicit referencelink without trailing [] ), push(image ? new RefImageNode((SuperNode)popAsNode(), popAsString(), popAsNode()) : new RefLinkNode((SuperNode)popAsNode(), popAsString(), popAsNode()) ) ); } @Cached public Rule LinkSource() { StringBuilderVar url = new StringBuilderVar(); return FirstOf( Sequence('(', LinkSource(), ')'), Sequence('<', LinkSource(), '>'), Sequence( OneOrMore( FirstOf( Sequence('\\', AnyOf("()"), url.append(matchedChar())), Sequence(TestNot(AnyOf("()>")), Nonspacechar(), url.append(matchedChar())) ) ), push(url.getString()) ), push("") ); } public Rule LinkTitle() { return FirstOf(LinkTitle('\''), LinkTitle('"')); } public Rule LinkTitle(char delimiter) { return Sequence( delimiter, ZeroOrMore(TestNot(delimiter, Sp(), FirstOf(')', Newline())), NotNewline(), ANY), push(match()), delimiter ); } public Rule AutoLink() { return Sequence( ext(AUTOLINKS) ? Optional('<') : Ch('<'), FirstOf(AutoLinkUrl(), AutoLinkEmail()), ext(AUTOLINKS) ? Optional('>') : Ch('>') ); } public Rule WikiLink() { return Sequence( "[[", OneOrMore(TestNot(Sequence(']',']')), ANY), // might have to restrict from ANY push(new WikiLinkNode(match())), "]]" ); } public Rule AutoLinkUrl() { return Sequence( Sequence(OneOrMore(Letter()), "://", AutoLinkEnd()), push(new AutoLinkNode(match())) ); } public Rule AutoLinkEmail() { return Sequence( Sequence(OneOrMore(FirstOf(Alphanumeric(), AnyOf("-+_."))), '@', AutoLinkEnd()), push(new MailLinkNode(match())) ); } public Rule AutoLinkEnd() { return OneOrMore( TestNot(Newline()), ext(AUTOLINKS) ? TestNot( FirstOf( AnyOf("<>"), Sequence(Optional(AnyOf(".,;:)}]\"'")), FirstOf(Spacechar(), Newline())) ) ) : TestNot('>'), ANY ); } //************* REFERENCE **************** public Rule Label() { return Sequence( '[', checkForParsingTimeout(), push(new SuperNode()), OneOrMore(TestNot(']'), NonAutoLinkInline(), addAsChild()), ']' ); } public Rule Reference() { Var ref = new Var(); return NodeSequence( NonindentSpace(), Label(), push(ref.setAndGet(new ReferenceNode(popAsNode()))), ':', Spn1(), RefSrc(ref), Sp(), Optional(RefTitle(ref)), Sp(), Newline(), ZeroOrMore(BlankLine()), references.add(ref.get()) ); } public Rule RefSrc(Var ref) { return FirstOf( Sequence('<', RefSrcContent(ref), '>'), RefSrcContent(ref) ); } public Rule RefSrcContent(Var ref) { return Sequence(OneOrMore(TestNot('>'), Nonspacechar()), ref.get().setUrl(match())); } public Rule RefTitle(Var ref) { return FirstOf(RefTitle('\'', '\'', ref), RefTitle('"', '"', ref), RefTitle('(', ')', ref)); } public Rule RefTitle(char open, char close, Var ref) { return Sequence( open, ZeroOrMore(TestNot(close, Sp(), Newline()), NotNewline(), ANY), ref.get().setTitle(match()), close ); } //************* CODE **************** public Rule Code() { return NodeSequence( Test('`'), FirstOf( Code(Ticks(1)), Code(Ticks(2)), Code(Ticks(3)), Code(Ticks(4)), Code(Ticks(5)) ) ); } public Rule Code(Rule ticks) { return Sequence( ticks, Sp(), OneOrMore( FirstOf( Sequence(TestNot('`'), Nonspacechar()), Sequence(TestNot(ticks), OneOrMore('`')), Sequence(TestNot(Sp(), ticks), FirstOf(Spacechar(), Sequence(Newline(), TestNot(BlankLine())))) ) ), push(new CodeNode(match())), Sp(), ticks ); } public Rule Ticks(int count) { return Sequence(repeat('`', count), TestNot('`')); } //************* RAW HTML **************** public Rule InlineHtml() { return NodeSequence( FirstOf(HtmlComment(), HtmlTag()), push(new InlineHtmlNode(ext(SUPPRESS_INLINE_HTML) ? "" : match())) ); } public Rule HtmlComment() { return Sequence(""), ANY), "-->"); } public Rule HtmlTag() { return Sequence('<', Spn1(), Optional('/'), OneOrMore(Alphanumeric()), Spn1(), ZeroOrMore(HtmlAttribute()), Optional('/'), Spn1(), '>'); } public Rule HtmlAttribute() { return Sequence( OneOrMore(FirstOf(Alphanumeric(), '-', '_')), Spn1(), Optional('=', Spn1(), FirstOf(Quoted(), OneOrMore(TestNot('>'), Nonspacechar()))), Spn1() ); } public Rule Quoted() { return FirstOf( Sequence('"', ZeroOrMore(TestNot('"'), ANY), '"'), Sequence('\'', ZeroOrMore(TestNot('\''), ANY), '\'') ); } //************* LINES **************** public Rule BlankLine() { return Sequence(Sp(), Newline()); } public Rule Line(StringBuilderVar sb) { return Sequence( Sequence(ZeroOrMore(NotNewline(), ANY), Newline()), sb.append(match()) ); } //************* ENTITIES **************** public Rule Entity() { return NodeSequence( Sequence('&', FirstOf(HexEntity(), DecEntity(), CharEntity()), ';'), push(new TextNode(match())) ); } public Rule HexEntity() { return Sequence('#', IgnoreCase('x'), OneOrMore(FirstOf(Digit(), CharRange('a', 'f'), CharRange('A', 'F')))); } public Rule DecEntity() { return Sequence('#', OneOrMore(Digit())); } public Rule CharEntity() { return OneOrMore(Alphanumeric()); } //************* BASICS **************** public Rule Str() { return NodeSequence(OneOrMore(NormalChar()), push(new TextNode(match()))); } public Rule Space() { return NodeSequence(OneOrMore(Spacechar()), push(new TextNode(" "))); } public Rule Spn1() { return Sequence(Sp(), Optional(Newline(), Sp())); } public Rule Sp() { return ZeroOrMore(Spacechar()); } public Rule Spacechar() { return AnyOf(" \t"); } public Rule Nonspacechar() { return Sequence(TestNot(Spacechar()), NotNewline(), ANY); } @MemoMismatches public Rule NormalChar() { return Sequence(TestNot(SpecialChar()), TestNot(Spacechar()), NotNewline(), ANY); } public Rule EscapedChar() { return NodeSequence('\\', AnyOf("*_`&[]<>!#\\'\".+-(){}:|~"), push(new SpecialTextNode(match()))); } public Rule Symbol() { return NodeSequence(SpecialChar(), push(new SpecialTextNode(match()))); } public Rule SpecialChar() { String chars = "*_`&[]<>!#\\"; if (ext(QUOTES)) { chars += "'\""; } if (ext(SMARTS)) { chars += ".-"; } if (ext(AUTOLINKS)) { chars += "(){}"; } if (ext(DEFINITIONS)) { chars += ":"; } if (ext(TABLES)) { chars += "|"; } if (ext(DEFINITIONS) | ext(FENCED_CODE_BLOCKS)) { chars += "~"; } for (Character ch : plugins.getSpecialChars()) { if (!chars.contains(ch.toString())) { chars += ch; } } return AnyOf(chars); } public Rule NotNewline() { return TestNot(AnyOf("\n\r")); } public Rule Newline() { return FirstOf('\n', Sequence('\r', Optional('\n'))); } public Rule NonindentSpace() { return FirstOf(" ", " ", " ", EMPTY); } public Rule Indent() { return FirstOf('\t', " "); } public Rule Alphanumeric() { return FirstOf(Letter(), Digit()); } public Rule Letter() { return FirstOf(CharRange('a', 'z'), CharRange('A', 'Z')); } public Rule Digit() { return CharRange('0', '9'); } //************* ABBREVIATIONS **************** public Rule Abbreviation() { Var node = new Var(); return NodeSequence( NonindentSpace(), '*', Label(), push(node.setAndGet(new AbbreviationNode(popAsNode()))), Sp(), ':', Sp(), AbbreviationText(node), ZeroOrMore(BlankLine()), abbreviations.add(node.get()) ); } public Rule AbbreviationText(Var node) { return Sequence( NodeSequence( push(new SuperNode()), ZeroOrMore(NotNewline(), Inline(), addAsChild()) ), node.get().setExpansion(popAsNode()) ); } //************* TABLES **************** public Rule Table() { Var node = new Var(); return NodeSequence( push(node.setAndGet(new TableNode())), Optional( NodeSequence( TableRow(), push(1, new TableHeaderNode()) && addAsChild(), ZeroOrMore(TableRow(), addAsChild()) ), addAsChild() // add the TableHeaderNode to the TableNode ), TableDivider(node), Optional( NodeSequence( TableRow(), push(1, new TableBodyNode()) && addAsChild(), ZeroOrMore(TableRow(), addAsChild()) ), addAsChild() // add the TableHeaderNode to the TableNode ), // only accept as table if we have at least one header or at least one body Optional(TableCaption(), addAsChild()), !node.get().getChildren().isEmpty() ); } public Rule TableCaption() { return Sequence( CaptionStart(), Optional(Sp()), OneOrMore(CaptionInline(), addAsChild()), Optional(Sp(), Optional(']'), Sp()), Newline() ); } public Rule CaptionStart() { return Sequence( "[", push(new TableCaptionNode()) ); } public Rule CaptionInline() { return Sequence( TestNot(Newline()), TestNot(Optional(Sp()), Optional(']'), Sp(), Newline()), Inline() ); } public Rule TableDivider(Var tableNode) { Var pipeSeen = new Var(Boolean.FALSE); return Sequence( Optional('|', pipeSeen.set(Boolean.TRUE)), OneOrMore(TableColumn(tableNode, pipeSeen)), pipeSeen.get() || tableNode.get().hasTwoOrMoreDividers(), Sp(), Newline() ); } public Rule TableColumn(Var tableNode, Var pipeSeen) { Var node = new Var(new TableColumnNode()); return Sequence( Sp(), Optional(':', node.get().markLeftAligned()), Sp(), OneOrMore('-'), Sp(), Optional(':', node.get().markRightAligned()), Sp(), Optional('|', pipeSeen.set(Boolean.TRUE)), tableNode.get().addColumn(node.get()) ); } public Rule TableRow() { Var leadingPipe = new Var(Boolean.FALSE); return NodeSequence( push(new TableRowNode()), Optional('|', leadingPipe.set(Boolean.TRUE)), OneOrMore(TableCell(), addAsChild()), leadingPipe.get() || ((Node) peek()).getChildren().size() > 1 || getContext().getInputBuffer().charAt(matchEnd() - 1) == '|', Sp(), Newline() ); } public Rule TableCell() { return NodeSequence( push(new TableCellNode()), TestNot(Sp(), Optional(':'), Sp(), OneOrMore('-'), Sp(), Optional(':'), Sp(), FirstOf('|', Newline())), Optional(Sp(), TestNot('|'), NotNewline()), OneOrMore( TestNot('|'), TestNot(Sp(), Newline()), Inline(), addAsChild(), Optional(Sp(), Test('|'), Test(Newline())) ), ZeroOrMore('|'), ((TableCellNode) peek()).setColSpan(Math.max(1, matchLength())) ); } //************* SMARTS **************** public Rule Smarts() { return NodeSequence( FirstOf( Sequence(FirstOf("...", ". . ."), push(new SimpleNode(Type.Ellipsis))), Sequence("---", push(new SimpleNode(Type.Emdash))), Sequence("--", push(new SimpleNode(Type.Endash))), Sequence('\'', push(new SimpleNode(Type.Apostrophe))) ) ); } //************* QUOTES **************** public Rule SingleQuoted() { return NodeSequence( !Character.isLetter(getContext().getInputBuffer().charAt(getContext().getCurrentIndex() - 1)), '\'', push(new QuotedNode(QuotedNode.Type.Single)), OneOrMore(TestNot(SingleQuoteEnd()), Inline(), addAsChild()), SingleQuoteEnd() ); } public Rule SingleQuoteEnd() { return Sequence('\'', TestNot(Alphanumeric())); } public Rule DoubleQuoted() { return NodeSequence( '"', push(new QuotedNode(QuotedNode.Type.Double)), OneOrMore(TestNot('"'), Inline(), addAsChild()), '"' ); } public Rule DoubleAngleQuoted() { return NodeSequence( "<<", push(new QuotedNode(QuotedNode.Type.DoubleAngle)), Optional(NodeSequence(Spacechar(), push(new SimpleNode(Type.Nbsp))), addAsChild()), OneOrMore( FirstOf( Sequence(NodeSequence(OneOrMore(Spacechar()), Test(">>"), push(new SimpleNode(Type.Nbsp))), addAsChild()), Sequence(TestNot(">>"), Inline(), addAsChild()) ) ), ">>" ); } //************* HELPERS **************** public Rule NOrMore(char c, int n) { return Sequence(repeat(c, n), ZeroOrMore(c)); } public Rule NodeSequence(Object... nodeRules) { return Sequence( push(getContext().getCurrentIndex()), Sequence(nodeRules), setIndices() ); } public boolean setIndices() { AbstractNode node = (AbstractNode) peek(); node.setStartIndex((Integer)pop(1)); node.setEndIndex(currentIndex()); return true; } public boolean addAsChild() { SuperNode parent = (SuperNode) peek(1); List children = parent.getChildren(); Node child = popAsNode(); if (child.getClass() == TextNode.class && !children.isEmpty()) { Node lastChild = children.get(children.size() - 1); if (lastChild.getClass() == TextNode.class) { // collapse peer TextNodes TextNode last = (TextNode) lastChild; TextNode current = (TextNode) child; last.append(current.getText()); last.setEndIndex(current.getEndIndex()); return true; } } children.add(child); return true; } public Node popAsNode() { return (Node) pop(); } public String popAsString() { return (String) pop(); } public boolean ext(int extension) { return (options & extension) > 0; } // called for inner parses for list items and blockquotes public RootNode parseInternal(StringBuilderVar block) { char[] chars = block.getChars(); int[] ixMap = new int[chars.length + 1]; // map of cleaned indices to original indices // strip out CROSSED_OUT characters and build index map StringBuilder clean = new StringBuilder(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (c != CROSSED_OUT) { ixMap[clean.length()] = i; clean.append(c); } } ixMap[clean.length()] = chars.length; // run inner parse char[] cleaned = new char[clean.length()]; clean.getChars(0, cleaned.length, cleaned, 0); RootNode rootNode = parseInternal(cleaned); // correct AST indices with index map fixIndices(rootNode, ixMap); return rootNode; } protected void fixIndices(Node node, int[] ixMap) { ((AbstractNode) node).mapIndices(ixMap); for (Node subNode : node.getChildren()) { fixIndices(subNode, ixMap); } } public RootNode parseInternal(char[] source) { ParsingResult result = parseToParsingResult(source); if (result.hasErrors()) { throw new RuntimeException("Internal error during markdown parsing:\n--- ParseErrors ---\n" + printParseErrors(result)/* + "\n--- ParseTree ---\n" + printNodeTree(result)*/ ); } return (RootNode) result.resultValue; } ParsingResult parseToParsingResult(char[] source) { parsingStartTimeStamp = System.currentTimeMillis(); return parseRunnerProvider.get(Root()).run(source); } protected boolean checkForParsingTimeout() { if (System.currentTimeMillis() - parsingStartTimeStamp > maxParsingTimeInMillis) throw new ParsingTimeoutException(); return true; } protected interface SuperNodeCreator { SuperNode create(Node child); } } pegdown-1.5.0/src/main/java/org/pegdown/ParsingTimeoutException.java000066400000000000000000000001271247356127500255560ustar00rootroot00000000000000package org.pegdown; public class ParsingTimeoutException extends RuntimeException {} pegdown-1.5.0/src/main/java/org/pegdown/PegDownProcessor.java000066400000000000000000000163331247356127500241760ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown; import java.util.Collections; import java.util.List; import java.util.Map; import org.parboiled.Parboiled; import org.pegdown.ast.RootNode; import org.pegdown.plugins.PegDownPlugins; import org.pegdown.plugins.ToHtmlSerializerPlugin; /** * A clean and lightweight Markdown-to-HTML filter based on a PEG parser implemented with parboiled. * Note: A PegDownProcessor is not thread-safe (since it internally reused the parboiled parser instance). * If you need to process markdown source in parallel create one PegDownProcessor per thread! * * @see Markdown * @see parboiled.org */ public class PegDownProcessor { public static final long DEFAULT_MAX_PARSING_TIME = 2000; public final Parser parser; /** * Creates a new processor instance without any enabled extensions and the default parsing timeout. */ public PegDownProcessor() { this(DEFAULT_MAX_PARSING_TIME); } /** * Creates a new processor instance without any enabled extensions and the given parsing timeout. */ public PegDownProcessor(long maxParsingTimeInMillis) { this(Extensions.NONE, maxParsingTimeInMillis); } /** * Creates a new processor instance with the given {@link org.pegdown.Extensions} and the default parsing timeout. * * @param options the flags of the extensions to enable as a bitmask */ public PegDownProcessor(int options) { this(options, DEFAULT_MAX_PARSING_TIME, PegDownPlugins.NONE); } /** * Creates a new processor instance with the given {@link org.pegdown.Extensions} and parsing timeout. * * @param options the flags of the extensions to enable as a bitmask * @param maxParsingTimeInMillis the parsing timeout */ public PegDownProcessor(int options, long maxParsingTimeInMillis) { this(options, maxParsingTimeInMillis, PegDownPlugins.NONE); } /** * Creates a new processor instance with the given {@link org.pegdown.Extensions} and plugins. * * @param options the flags of the extensions to enable as a bitmask * @param plugins the plugins to use */ public PegDownProcessor(int options, PegDownPlugins plugins) { this(options, DEFAULT_MAX_PARSING_TIME, plugins); } /** * Creates a new processor instance with the given {@link org.pegdown.Extensions}, parsing timeout and plugins. * * @param options the flags of the extensions to enable as a bitmask * @param maxParsingTimeInMillis the parsing timeout * @param plugins the plugins to use */ public PegDownProcessor(int options, long maxParsingTimeInMillis, PegDownPlugins plugins) { this(Parboiled.createParser(Parser.class, options, maxParsingTimeInMillis, Parser.DefaultParseRunnerProvider, plugins)); } /** * Creates a new processor instance using the given Parser. * * @param parser the parser instance to use */ public PegDownProcessor(Parser parser) { this.parser = parser; } /** * Converts the given markdown source to HTML. * If the input cannot be parsed within the configured parsing timeout the method returns null. * * @param markdownSource the markdown source to convert * @return the HTML */ public String markdownToHtml(String markdownSource) { return markdownToHtml(markdownSource.toCharArray()); } /** * Converts the given markdown source to HTML. * If the input cannot be parsed within the configured parsing timeout the method returns null. * * @param markdownSource the markdown source to convert * @param linkRenderer the LinkRenderer to use * @return the HTML */ public String markdownToHtml(String markdownSource, LinkRenderer linkRenderer) { return markdownToHtml(markdownSource.toCharArray(), linkRenderer); } public String markdownToHtml(String markdownSource, LinkRenderer linkRenderer, Map verbatimSerializerMap) { return markdownToHtml(markdownSource.toCharArray(), linkRenderer, verbatimSerializerMap); } /** * Converts the given markdown source to HTML. * If the input cannot be parsed within the configured parsing timeout the method returns null. * * @param markdownSource the markdown source to convert * @return the HTML */ public String markdownToHtml(char[] markdownSource) { return markdownToHtml(markdownSource, new LinkRenderer()); } /** * Converts the given markdown source to HTML. * If the input cannot be parsed within the configured parsing timeout the method returns null. * * @param markdownSource the markdown source to convert * @param linkRenderer the LinkRenderer to use * @return the HTML */ public String markdownToHtml(char[] markdownSource, LinkRenderer linkRenderer) { return markdownToHtml(markdownSource, linkRenderer, Collections.emptyMap()); } public String markdownToHtml(char[] markdownSource, LinkRenderer linkRenderer, Map verbatimSerializerMap) { return markdownToHtml(markdownSource, linkRenderer, verbatimSerializerMap, parser.plugins.getHtmlSerializerPlugins()); } public String markdownToHtml(char[] markdownSource, LinkRenderer linkRenderer, Map verbatimSerializerMap, List plugins) { try { RootNode astRoot = parseMarkdown(markdownSource); return new ToHtmlSerializer(linkRenderer, verbatimSerializerMap, plugins).toHtml(astRoot); } catch(ParsingTimeoutException e) { return null; } } /** * Parses the given markdown source and returns the root node of the generated Abstract Syntax Tree. * If the input cannot be parsed within the configured parsing timeout the method throws a ParsingTimeoutException. * * @param markdownSource the markdown source to convert * @return the AST root */ public RootNode parseMarkdown(char[] markdownSource) { return parser.parse(prepareSource(markdownSource)); } /** * Adds two trailing newlines. * * @param source the markdown source to process * @return the processed source */ public char[] prepareSource(char[] source) { char[] src = new char[source.length + 2]; System.arraycopy(source, 0, src, 0, source.length); src[source.length] = '\n'; src[source.length + 1] = '\n'; return src; } } pegdown-1.5.0/src/main/java/org/pegdown/Printer.java000066400000000000000000000031741247356127500223550ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown; /** * Encapsulates basic string output functionality. */ public class Printer { public final StringBuilder sb; public int indent; public Printer() { this(new StringBuilder()); } public Printer(StringBuilder sb) { this.sb = sb; } public Printer indent(int delta) { indent += delta; return this; } public Printer print(String string) { sb.append(string); return this; } public Printer printEncoded(String string) { FastEncoder.encode(string, sb); return this; } public Printer print(char c) { sb.append(c); return this; } public Printer println() { if (sb.length() > 0) print('\n'); for (int i = 0; i < indent; i++) print(' '); return this; } public String getString() { return sb.toString(); } public Printer clear() { sb.setLength(0); return this; } } pegdown-1.5.0/src/main/java/org/pegdown/ToHtmlSerializer.java000066400000000000000000000374451247356127500242030ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown; import org.parboiled.common.StringUtils; import org.pegdown.ast.*; import org.pegdown.plugins.ToHtmlSerializerPlugin; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; import static org.parboiled.common.Preconditions.checkArgNotNull; public class ToHtmlSerializer implements Visitor { protected Printer printer = new Printer(); protected final Map references = new HashMap(); protected final Map abbreviations = new HashMap(); protected final LinkRenderer linkRenderer; protected final List plugins; protected TableNode currentTableNode; protected int currentTableColumn; protected boolean inTableHeader; protected Map verbatimSerializers; public ToHtmlSerializer(LinkRenderer linkRenderer) { this(linkRenderer, Collections.emptyList()); } public ToHtmlSerializer(LinkRenderer linkRenderer, List plugins) { this (linkRenderer, Collections.emptyMap(), plugins); } public ToHtmlSerializer(final LinkRenderer linkRenderer, final Map verbatimSerializers) { this(linkRenderer, verbatimSerializers, Collections.emptyList()); } public ToHtmlSerializer(final LinkRenderer linkRenderer, final Map verbatimSerializers, final List plugins) { this.linkRenderer = linkRenderer; this.verbatimSerializers = new HashMap(verbatimSerializers); if(!this.verbatimSerializers.containsKey(VerbatimSerializer.DEFAULT)) { this.verbatimSerializers.put(VerbatimSerializer.DEFAULT, DefaultVerbatimSerializer.INSTANCE); } this.plugins = plugins; } public String toHtml(RootNode astRoot) { checkArgNotNull(astRoot, "astRoot"); astRoot.accept(this); return printer.getString(); } public void visit(RootNode node) { for (ReferenceNode refNode : node.getReferences()) { visitChildren(refNode); references.put(normalize(printer.getString()), refNode); printer.clear(); } for (AbbreviationNode abbrNode : node.getAbbreviations()) { visitChildren(abbrNode); String abbr = printer.getString(); printer.clear(); abbrNode.getExpansion().accept(this); String expansion = printer.getString(); abbreviations.put(abbr, expansion); printer.clear(); } visitChildren(node); } public void visit(AbbreviationNode node) { } public void visit(AnchorLinkNode node) { printLink(linkRenderer.render(node)); } public void visit(AutoLinkNode node) { printLink(linkRenderer.render(node)); } public void visit(BlockQuoteNode node) { printIndentedTag(node, "blockquote"); } public void visit(BulletListNode node) { printIndentedTag(node, "ul"); } public void visit(CodeNode node) { printTag(node, "code"); } public void visit(DefinitionListNode node) { printIndentedTag(node, "dl"); } public void visit(DefinitionNode node) { printTag(node, "dd"); } public void visit(DefinitionTermNode node) { printTag(node, "dt"); } public void visit(ExpImageNode node) { String text = printChildrenToString(node); printImageTag(linkRenderer.render(node, text)); } public void visit(ExpLinkNode node) { String text = printChildrenToString(node); printLink(linkRenderer.render(node, text)); } public void visit(HeaderNode node) { printTag(node, "h" + node.getLevel()); } public void visit(HtmlBlockNode node) { String text = node.getText(); if (text.length() > 0) printer.println(); printer.print(text); } public void visit(InlineHtmlNode node) { printer.print(node.getText()); } public void visit(ListItemNode node) { printer.println(); printTag(node, "li"); } public void visit(MailLinkNode node) { printLink(linkRenderer.render(node)); } public void visit(OrderedListNode node) { printIndentedTag(node, "ol"); } public void visit(ParaNode node) { printTag(node, "p"); } public void visit(QuotedNode node) { switch (node.getType()) { case DoubleAngle: printer.print("«"); visitChildren(node); printer.print("»"); break; case Double: printer.print("“"); visitChildren(node); printer.print("”"); break; case Single: printer.print("‘"); visitChildren(node); printer.print("’"); break; } } public void visit(ReferenceNode node) { // reference nodes are not printed } public void visit(RefImageNode node) { String text = printChildrenToString(node); String key = node.referenceKey != null ? printChildrenToString(node.referenceKey) : text; ReferenceNode refNode = references.get(normalize(key)); if (refNode == null) { // "fake" reference image link printer.print("![").print(text).print(']'); if (node.separatorSpace != null) { printer.print(node.separatorSpace).print('['); if (node.referenceKey != null) printer.print(key); printer.print(']'); } } else printImageTag(linkRenderer.render(node, refNode.getUrl(), refNode.getTitle(), text)); } public void visit(RefLinkNode node) { String text = printChildrenToString(node); String key = node.referenceKey != null ? printChildrenToString(node.referenceKey) : text; ReferenceNode refNode = references.get(normalize(key)); if (refNode == null) { // "fake" reference link printer.print('[').print(text).print(']'); if (node.separatorSpace != null) { printer.print(node.separatorSpace).print('['); if (node.referenceKey != null) printer.print(key); printer.print(']'); } } else printLink(linkRenderer.render(node, refNode.getUrl(), refNode.getTitle(), text)); } public void visit(SimpleNode node) { switch (node.getType()) { case Apostrophe: printer.print("’"); break; case Ellipsis: printer.print("…"); break; case Emdash: printer.print("—"); break; case Endash: printer.print("–"); break; case HRule: printer.println().print("
"); break; case Linebreak: printer.print("
"); break; case Nbsp: printer.print(" "); break; default: throw new IllegalStateException(); } } public void visit(StrongEmphSuperNode node) { if(node.isClosed()){ if(node.isStrong()) printTag(node, "strong"); else printTag(node, "em"); } else { //sequence was not closed, treat open chars as ordinary chars printer.print(node.getChars()); visitChildren(node); } } public void visit(StrikeNode node) { printTag(node, "del"); } public void visit(TableBodyNode node) { printIndentedTag(node, "tbody"); } @Override public void visit(TableCaptionNode node) { printer.println().print(""); visitChildren(node); printer.print(""); } public void visit(TableCellNode node) { String tag = inTableHeader ? "th" : "td"; List columns = currentTableNode.getColumns(); TableColumnNode column = columns.get(Math.min(currentTableColumn, columns.size()-1)); printer.println().print('<').print(tag); column.accept(this); if (node.getColSpan() > 1) printer.print(" colspan=\"").print(Integer.toString(node.getColSpan())).print('"'); printer.print('>'); visitChildren(node); printer.print('<').print('/').print(tag).print('>'); currentTableColumn += node.getColSpan(); } public void visit(TableColumnNode node) { switch (node.getAlignment()) { case None: break; case Left: printer.print(" align=\"left\""); break; case Right: printer.print(" align=\"right\""); break; case Center: printer.print(" align=\"center\""); break; default: throw new IllegalStateException(); } } public void visit(TableHeaderNode node) { inTableHeader = true; printIndentedTag(node, "thead"); inTableHeader = false; } public void visit(TableNode node) { currentTableNode = node; printIndentedTag(node, "table"); currentTableNode = null; } public void visit(TableRowNode node) { currentTableColumn = 0; printIndentedTag(node, "tr"); } public void visit(VerbatimNode node) { VerbatimSerializer serializer = lookupSerializer(node.getType()); serializer.serialize(node, printer); } private VerbatimSerializer lookupSerializer(final String type) { if (type != null && verbatimSerializers.containsKey(type)) { return verbatimSerializers.get(type); } else { return verbatimSerializers.get(VerbatimSerializer.DEFAULT); } } public void visit(WikiLinkNode node) { printLink(linkRenderer.render(node)); } public void visit(TextNode node) { if (abbreviations.isEmpty()) { printer.print(node.getText()); } else { printWithAbbreviations(node.getText()); } } public void visit(SpecialTextNode node) { printer.printEncoded(node.getText()); } public void visit(SuperNode node) { visitChildren(node); } public void visit(Node node) { for (ToHtmlSerializerPlugin plugin : plugins) { if (plugin.visit(node, this, printer)) { return; } } // override this method for processing custom Node implementations throw new RuntimeException("Don't know how to handle node " + node); } // helpers protected void visitChildren(SuperNode node) { for (Node child : node.getChildren()) { child.accept(this); } } protected void printTag(TextNode node, String tag) { printer.print('<').print(tag).print('>'); printer.printEncoded(node.getText()); printer.print('<').print('/').print(tag).print('>'); } protected void printTag(SuperNode node, String tag) { printer.print('<').print(tag).print('>'); visitChildren(node); printer.print('<').print('/').print(tag).print('>'); } protected void printIndentedTag(SuperNode node, String tag) { printer.println().print('<').print(tag).print('>').indent(+2); visitChildren(node); printer.indent(-2).println().print('<').print('/').print(tag).print('>'); } protected void printImageTag(LinkRenderer.Rendering rendering) { printer.print(""); } protected void printLink(LinkRenderer.Rendering rendering) { printer.print('<').print('a'); printAttribute("href", rendering.href); for (LinkRenderer.Attribute attr : rendering.attributes) { printAttribute(attr.name, attr.value); } printer.print('>').print(rendering.text).print(""); } private void printAttribute(String name, String value) { printer.print(' ').print(name).print('=').print('"').print(value).print('"'); } protected String printChildrenToString(SuperNode node) { Printer priorPrinter = printer; printer = new Printer(); visitChildren(node); String result = printer.getString(); printer = priorPrinter; return result; } protected String normalize(String string) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); switch(c) { case ' ': case '\n': case '\t': continue; } sb.append(Character.toLowerCase(c)); } return sb.toString(); } protected void printWithAbbreviations(String string) { Map> expansions = null; for (Map.Entry entry : abbreviations.entrySet()) { // first check, whether we have a legal match String abbr = entry.getKey(); int ix = 0; while (true) { int sx = string.indexOf(abbr, ix); if (sx == -1) break; // only allow whole word matches ix = sx + abbr.length(); if (sx > 0 && Character.isLetterOrDigit(string.charAt(sx - 1))) continue; if (ix < string.length() && Character.isLetterOrDigit(string.charAt(ix))) { continue; } // ok, legal match so save an expansions "task" for all matches if (expansions == null) { expansions = new TreeMap>(); } expansions.put(sx, entry); } } if (expansions != null) { int ix = 0; for (Map.Entry> entry : expansions.entrySet()) { int sx = entry.getKey(); String abbr = entry.getValue().getKey(); String expansion = entry.getValue().getValue(); printer.printEncoded(string.substring(ix, sx)); printer.print("'); printer.printEncoded(abbr); printer.print(""); ix = sx + abbr.length(); } printer.print(string.substring(ix)); } else { printer.print(string); } } } pegdown-1.5.0/src/main/java/org/pegdown/VerbatimSerializer.java000066400000000000000000000003121247356127500245240ustar00rootroot00000000000000package org.pegdown; import org.pegdown.ast.VerbatimNode; public interface VerbatimSerializer { static final String DEFAULT = "DEFAULT"; void serialize(VerbatimNode node, Printer printer); } pegdown-1.5.0/src/main/java/org/pegdown/ast/000077500000000000000000000000001247356127500206515ustar00rootroot00000000000000pegdown-1.5.0/src/main/java/org/pegdown/ast/AbbreviationNode.java000066400000000000000000000021271247356127500247310ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class AbbreviationNode extends SuperNode { private Node expansion; public AbbreviationNode(Node child) { super(child); } public Node getExpansion() { return expansion; } public boolean setExpansion(Node expansion) { this.expansion = expansion; return true; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/AbstractNode.java000066400000000000000000000014701247356127500240670ustar00rootroot00000000000000package org.pegdown.ast; public abstract class AbstractNode implements Node { private int startIndex; private int endIndex; public int getStartIndex() { return startIndex; } public int getEndIndex() { return endIndex; } public void setStartIndex(int startIndex) { this.startIndex = startIndex; } public void setEndIndex(int endIndex) { this.endIndex = endIndex; } public void shiftIndices(int delta) { startIndex += delta; endIndex += delta; } public void mapIndices(int[] ixMap) { startIndex = ixMap[startIndex]; endIndex = ixMap[endIndex]; } @Override public String toString() { return getClass().getSimpleName() + " [" + startIndex + '-' + endIndex + ']'; } } pegdown-1.5.0/src/main/java/org/pegdown/ast/AnchorLinkNode.java000066400000000000000000000026571247356127500243640ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class AnchorLinkNode extends TextNode { private final String name; public AnchorLinkNode(String text) { super(text); this.name = generateName(text); } @Override public void accept(Visitor visitor) { visitor.visit(this); } public String getName() { return name; } private String generateName(String text) { StringBuilder sb = new StringBuilder(text.length()); for (char c : text.toCharArray()) { if (Character.isLetterOrDigit(c)) { sb.append(Character.toLowerCase(c)); } else if (sb.length() > 0 && sb.charAt(sb.length() - 1) != '-') { sb.append('-'); } } return sb.toString(); } } pegdown-1.5.0/src/main/java/org/pegdown/ast/AutoLinkNode.java000066400000000000000000000015761247356127500240610ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class AutoLinkNode extends TextNode { public AutoLinkNode(String text) { super(text); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/BlockQuoteNode.java000066400000000000000000000016471247356127500244020ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import java.util.List; public class BlockQuoteNode extends SuperNode { public BlockQuoteNode(List children) { super(children); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/BulletListNode.java000066400000000000000000000016031247356127500244050ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class BulletListNode extends SuperNode { public BulletListNode(Node child) { super(child); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/CodeNode.java000066400000000000000000000015721247356127500232010ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class CodeNode extends TextNode { public CodeNode(String text) { super(text); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/DefinitionListNode.java000066400000000000000000000015021247356127500252440ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class DefinitionListNode extends SuperNode { @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/DefinitionNode.java000066400000000000000000000016031247356127500244120ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class DefinitionNode extends SuperNode { public DefinitionNode(Node child) { super(child); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/DefinitionTermNode.java000066400000000000000000000015021247356127500252400ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class DefinitionTermNode extends SuperNode { @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/ExpImageNode.java000066400000000000000000000020111247356127500240130ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class ExpImageNode extends SuperNode { public final String url; public final String title; public ExpImageNode(String title, String url, Node child) { super(child); this.url = url; this.title = title; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/ExpLinkNode.java000066400000000000000000000020071247356127500236730ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class ExpLinkNode extends SuperNode { public final String url; public final String title; public ExpLinkNode(String title, String url, Node child) { super(child); this.url = url; this.title = title; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/HeaderNode.java000066400000000000000000000022421247356127500235120ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import org.parboiled.common.Preconditions; public class HeaderNode extends SuperNode { private final int level; public HeaderNode(int level, Node child) { super(child); this.level = level; } public HeaderNode(int level) { Preconditions.checkState(1 <= level && level <= 6); this.level = level; } public int getLevel() { return level; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/HtmlBlockNode.java000066400000000000000000000016041247356127500242020ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class HtmlBlockNode extends TextNode { public HtmlBlockNode(String text) { super(text); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/InlineHtmlNode.java000066400000000000000000000016061247356127500243700ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class InlineHtmlNode extends TextNode { public InlineHtmlNode(String text) { super(text); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/ListItemNode.java000066400000000000000000000015771247356127500240660ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class ListItemNode extends SuperNode { public ListItemNode(Node child) { super(child); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/MailLinkNode.java000066400000000000000000000015761247356127500240330ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class MailLinkNode extends TextNode { public MailLinkNode(String text) { super(text); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/Node.java000066400000000000000000000021351247356127500224020ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import org.parboiled.trees.GraphNode; public interface Node extends GraphNode { /** * @return the index of the first character in the underlying buffer that is covered by this node */ int getStartIndex(); /** * @return the index of the character after the last one in the underlying buffer that is covered by this node */ int getEndIndex(); void accept(Visitor visitor); } pegdown-1.5.0/src/main/java/org/pegdown/ast/OrderedListNode.java000066400000000000000000000016051247356127500245440ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class OrderedListNode extends SuperNode { public OrderedListNode(Node child) { super(child); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/ParaNode.java000066400000000000000000000017331247356127500232110ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import java.util.List; public class ParaNode extends SuperNode { public ParaNode(Node child) { super(child); } public ParaNode(List children) { super(children); } @Override public void accept(Visitor visitor) { visitor.visit(this); } } pegdown-1.5.0/src/main/java/org/pegdown/ast/QuotedNode.java000066400000000000000000000020151247356127500235610ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class QuotedNode extends SuperNode { public enum Type { DoubleAngle, Double, Single } private final Type type; public QuotedNode(Type type) { this.type = type; } public Type getType() { return type; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/RefImageNode.java000066400000000000000000000021271247356127500240030ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class RefImageNode extends SuperNode { public final String separatorSpace; public final SuperNode referenceKey; public RefImageNode(SuperNode referenceKey, String separatorSpace, Node child) { super(child); this.separatorSpace = separatorSpace; this.referenceKey = referenceKey; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/RefLinkNode.java000066400000000000000000000021251247356127500236540ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class RefLinkNode extends SuperNode { public final String separatorSpace; public final SuperNode referenceKey; public RefLinkNode(SuperNode referenceKey, String separatorSpace, Node child) { super(child); this.separatorSpace = separatorSpace; this.referenceKey = referenceKey; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/ReferenceNode.java000066400000000000000000000023631247356127500242240ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class ReferenceNode extends SuperNode { private String url; private String title; public ReferenceNode(Node child) { super(child); } public String getUrl() { return url; } public boolean setUrl(String url) { this.url = url; return true; } public String getTitle() { return title; } public boolean setTitle(String title) { this.title = title; return true; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/RootNode.java000066400000000000000000000031141247356127500232440ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import org.parboiled.common.ImmutableList; import java.util.List; import static org.parboiled.common.Preconditions.checkArgNotNull; public class RootNode extends SuperNode { private List references = ImmutableList.of(); private List abbreviations = ImmutableList.of(); public List getReferences() { return references; } public void setReferences(List references) { checkArgNotNull(references, "references"); this.references = references; } public List getAbbreviations() { return abbreviations; } public void setAbbreviations(List abbreviations) { checkArgNotNull(abbreviations, "abbreviations"); this.abbreviations = abbreviations; } @Override public void accept(Visitor visitor) { visitor.visit(this); } } pegdown-1.5.0/src/main/java/org/pegdown/ast/SimpleNode.java000066400000000000000000000024321247356127500235540ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import org.parboiled.common.ImmutableList; import java.util.List; public class SimpleNode extends AbstractNode { public enum Type { Apostrophe, Ellipsis, Emdash, Endash, HRule, Linebreak, Nbsp } private final Type type; public SimpleNode(Type type) { this.type = type; } public Type getType() { return type; } public List getChildren() { return ImmutableList.of(); } public void accept(Visitor visitor) { visitor.visit(this); } @Override public String toString() { return super.toString() + " " + type; } }pegdown-1.5.0/src/main/java/org/pegdown/ast/SpecialTextNode.java000066400000000000000000000016101247356127500245450ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class SpecialTextNode extends TextNode { public SpecialTextNode(String text) { super(text); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/StrikeNode.java000066400000000000000000000016371247356127500235720ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import java.util.List; public class StrikeNode extends SuperNode { public StrikeNode(List children) { super(children); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/StrongEmphSuperNode.java000066400000000000000000000025651247356127500254370ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class StrongEmphSuperNode extends SuperNode { private boolean isStrong = false; private boolean isClosed = false; private String chars; public StrongEmphSuperNode(String str) { this.isStrong = (str.length() == 2); // ** and __ are strong, * and _ emph this.chars = str; } public boolean isStrong() { return isStrong; } public boolean isClosed() { return isClosed; } public void setClosed(boolean closed){ this.isClosed = closed; } public String getChars() { return chars; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/SuperNode.java000066400000000000000000000022631247356127500234230ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import java.util.ArrayList; import java.util.List; public class SuperNode extends AbstractNode { private final List children = new ArrayList(); public SuperNode() { } public SuperNode(Node child) { children.add(child); } public SuperNode(List children) { this.children.addAll(children); } public List getChildren() { return children; } public void accept(Visitor visitor) { visitor.visit(this); } } pegdown-1.5.0/src/main/java/org/pegdown/ast/TableBodyNode.java000066400000000000000000000015011247356127500241640ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class TableBodyNode extends SuperNode { @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/TableCaptionNode.java000066400000000000000000000015001247356127500246630ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class TableCaptionNode extends SuperNode { @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/TableCellNode.java000066400000000000000000000020041247356127500241450ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class TableCellNode extends SuperNode { private int colSpan; public int getColSpan() { return colSpan; } public boolean setColSpan(int colSpan) { this.colSpan = colSpan; return true; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/TableColumnNode.java000066400000000000000000000024541247356127500245340ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class TableColumnNode extends SuperNode { public enum Alignment { None, Left, Right, Center } private Alignment alignment = Alignment.None; public boolean markLeftAligned() { alignment = alignment == Alignment.Right ? Alignment.Center : Alignment.Left; return true; } public boolean markRightAligned() { alignment = alignment == Alignment.Left ? Alignment.Center : Alignment.Right; return true; } public Alignment getAlignment() { return alignment; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/TableHeaderNode.java000066400000000000000000000015031247356127500244610ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class TableHeaderNode extends SuperNode { @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/TableNode.java000066400000000000000000000024071247356127500233540ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import org.parboiled.common.ImmutableList; import java.util.List; public class TableNode extends SuperNode { private ImmutableList columns = ImmutableList.of(); public List getColumns() { return columns; } public boolean addColumn(TableColumnNode columnNode) { columns = columns.append(columnNode); return true; } public boolean hasTwoOrMoreDividers() { return columns != null && columns.size() > 1; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/TableRowNode.java000066400000000000000000000015001247356127500240350ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class TableRowNode extends SuperNode { @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/TextNode.java000066400000000000000000000025731247356127500232550ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import org.parboiled.common.ImmutableList; import org.parboiled.common.StringUtils; import java.util.List; public class TextNode extends AbstractNode { private final StringBuilder sb; public TextNode(String text) { this.sb = new StringBuilder(text); } public String getText() { return sb.toString(); } public void append(String text) { sb.append(text); } @Override public String toString() { return super.toString() + " '" + StringUtils.escape(getText()) + '\''; } public List getChildren() { return ImmutableList.of(); } public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/ValidEmphOrStrongCloseNode.java000066400000000000000000000020101247356127500266500ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; import java.util.List; import org.parboiled.common.ImmutableList; public class ValidEmphOrStrongCloseNode extends AbstractNode { public ValidEmphOrStrongCloseNode() { } public List getChildren() { return ImmutableList.of(); } public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/ast/VerbatimNode.java000066400000000000000000000021151247356127500240720ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class VerbatimNode extends TextNode { private final String type; public VerbatimNode(String text) { this(text, ""); } public VerbatimNode(String text, String type) { super(text); this.type = type; } @Override public void accept(Visitor visitor) { visitor.visit(this); } public String getType() { return type; } }pegdown-1.5.0/src/main/java/org/pegdown/ast/Visitor.java000066400000000000000000000041521247356127500231550ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public interface Visitor { void visit(AbbreviationNode node); void visit(AnchorLinkNode node); void visit(AutoLinkNode node); void visit(BlockQuoteNode node); void visit(BulletListNode node); void visit(CodeNode node); void visit(DefinitionListNode node); void visit(DefinitionNode node); void visit(DefinitionTermNode node); void visit(ExpImageNode node); void visit(ExpLinkNode node); void visit(HeaderNode node); void visit(HtmlBlockNode node); void visit(InlineHtmlNode node); void visit(ListItemNode node); void visit(MailLinkNode node); void visit(OrderedListNode node); void visit(ParaNode node); void visit(QuotedNode node); void visit(ReferenceNode node); void visit(RefImageNode node); void visit(RefLinkNode node); void visit(RootNode node); void visit(SimpleNode node); void visit(SpecialTextNode node); void visit(StrikeNode node); void visit(StrongEmphSuperNode node); void visit(TableBodyNode node); void visit(TableCaptionNode node); void visit(TableCellNode node); void visit(TableColumnNode node); void visit(TableHeaderNode node); void visit(TableNode node); void visit(TableRowNode node); void visit(VerbatimNode node); void visit(WikiLinkNode node); void visit(TextNode node); void visit(SuperNode node); void visit(Node node); // general catch all for custom Node implementations } pegdown-1.5.0/src/main/java/org/pegdown/ast/WikiLinkNode.java000066400000000000000000000015761247356127500240540ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.ast; public class WikiLinkNode extends TextNode { public WikiLinkNode(String text) { super(text); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }pegdown-1.5.0/src/main/java/org/pegdown/plugins/000077500000000000000000000000001247356127500215435ustar00rootroot00000000000000pegdown-1.5.0/src/main/java/org/pegdown/plugins/BlockPluginParser.java000066400000000000000000000022501247356127500257730ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.plugins; import org.parboiled.Rule; /** * A parser that provides block parser rules for pegdown. A pegdown plugin should implement this, along with * {@link org.parboiled.BaseParser} or {@link org.pegdown.Parser} if it wants to use the pegdown utilities. * * This interface is intended for use with {@link PegDownPlugins.Builder#withPlugin(Class, Object...)}, in order for * Java plugins to easily be registered with a parser. */ public interface BlockPluginParser { Rule[] blockPluginRules(); } pegdown-1.5.0/src/main/java/org/pegdown/plugins/InlinePluginParser.java000066400000000000000000000022531247356127500261620ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.plugins; import org.parboiled.Rule; /** * A parser that provides inline parser rules for pegdown. A pegdown plugin should implement this, along with * {@link org.parboiled.BaseParser} or {@link org.pegdown.Parser} if it wants to use the pegdown utilities. * * This interface is intended for use with {@link PegDownPlugins.Builder#withPlugin(Class, Object...)}, in order for * Java plugins to easily be registered with a parser. */ public interface InlinePluginParser { Rule[] inlinePluginRules(); } pegdown-1.5.0/src/main/java/org/pegdown/plugins/PegDownPlugins.java000066400000000000000000000125531247356127500253210ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.plugins; import org.parboiled.BaseParser; import org.parboiled.Parboiled; import org.parboiled.Rule; import java.util.*; /** * Encapsulates the plugins provided to pegdown. * * Construct this using @{link PegdownPlugins#builder}, and then passing in either the Java plugin classes, or * precompiled rules (for greater control, or if using Scala rules). */ public class PegDownPlugins { private final Rule[] inlinePluginRules; private final Rule[] blockPluginRules; private final Character[] specialChars; private final List serializerPlugins; private PegDownPlugins(Rule[] inlinePluginRules, Rule[] blockPluginRules) { this(inlinePluginRules, blockPluginRules, new Character[0], Collections.emptyList()); } private PegDownPlugins(Rule[] inlinePluginRules, Rule[] blockPluginRules, Character[] specialChars, List serializerPlugins) { this.inlinePluginRules = inlinePluginRules; this.blockPluginRules = blockPluginRules; this.specialChars = specialChars; this.serializerPlugins = serializerPlugins; } public Rule[] getInlinePluginRules() { return inlinePluginRules; } public Rule[] getBlockPluginRules() { return blockPluginRules; } public Character[] getSpecialChars() { return specialChars; } public List getHtmlSerializerPlugins() { return serializerPlugins; } public static Builder builder() { return new Builder(); } /** * Create a builder that is a copy of the existing plugins */ public static Builder builder(PegDownPlugins like) { return builder().withInlinePluginRules(like.getInlinePluginRules()).withBlockPluginRules(like.getBlockPluginRules()). withHtmlSerializer(like.serializerPlugins.toArray(new ToHtmlSerializerPlugin[0])); } /** * Convenience reference to no plugins. */ public static PegDownPlugins NONE = builder().build(); public static class Builder { private final List inlinePluginRules = new ArrayList(); private final List blockPluginRules = new ArrayList(); private final Set specialChars = new HashSet(); private final List serializerPlugins = new ArrayList(); public Builder() { } public Builder withInlinePluginRules(Rule... inlinePlugins) { this.inlinePluginRules.addAll(Arrays.asList(inlinePlugins)); return this; } public Builder withBlockPluginRules(Rule... blockPlugins) { this.blockPluginRules.addAll(Arrays.asList(blockPlugins)); return this; } public Builder withSpecialChars(Character... chars) { Collections.addAll(this.specialChars, chars); return this; } public Builder withHtmlSerializer(ToHtmlSerializerPlugin... plugins) { Collections.addAll(this.serializerPlugins, plugins); return this; } /** * Add a plugin parser. This should either implement {@link InlinePluginParser} or {@link BlockPluginParser}, * or both. The parser will be enhanced by parboiled before its rules are extracted and registered here. * * @param pluginParser the plugin parser class. * @param arguments the arguments to pass to the constructor of that class. */ public Builder withPlugin(Class> pluginParser, Object... arguments) { // First, check that the parser implements one of the parser interfaces if (!(InlinePluginParser.class.isAssignableFrom(pluginParser) || BlockPluginParser.class.isAssignableFrom(pluginParser))) { throw new IllegalArgumentException("Parser plugin must implement a parser plugin interface to be useful"); } BaseParser parser = Parboiled.createParser(pluginParser, arguments); if (parser instanceof InlinePluginParser) { withInlinePluginRules(((InlinePluginParser) parser).inlinePluginRules()); } if (parser instanceof BlockPluginParser) { withBlockPluginRules(((BlockPluginParser) parser).blockPluginRules()); } return this; } public PegDownPlugins build() { return new PegDownPlugins(inlinePluginRules.toArray(new Rule[0]), blockPluginRules.toArray(new Rule[0]), specialChars.toArray(new Character[0]), Collections.unmodifiableList(serializerPlugins)); } } } pegdown-1.5.0/src/main/java/org/pegdown/plugins/ToHtmlSerializerPlugin.java000066400000000000000000000023561247356127500270340ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown.plugins; import org.pegdown.Printer; import org.pegdown.ast.Node; import org.pegdown.ast.Visitor; /** * A plugin for the {@link org.pegdown.ToHtmlSerializer} */ public interface ToHtmlSerializerPlugin { /** * Visit the given node * * @param node The node to visit * @param visitor The visitor, for delegating back to handling children, etc * @param printer The printer to print output to * @return true if this plugin knew how to serialize the node, false otherwise */ boolean visit(Node node, Visitor visitor, Printer printer); } pegdown-1.5.0/src/test/000077500000000000000000000000001247356127500147425ustar00rootroot00000000000000pegdown-1.5.0/src/test/java/000077500000000000000000000000001247356127500156635ustar00rootroot00000000000000pegdown-1.5.0/src/test/java/org/000077500000000000000000000000001247356127500164525ustar00rootroot00000000000000pegdown-1.5.0/src/test/java/org/pegdown/000077500000000000000000000000001247356127500201155ustar00rootroot00000000000000pegdown-1.5.0/src/test/java/org/pegdown/Benchmark.java000066400000000000000000000064571247356127500226660ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown; import org.parboiled.Parboiled; import org.parboiled.Rule; import org.parboiled.common.FileUtils; import org.parboiled.common.Preconditions; import org.parboiled.common.Reference; import org.parboiled.parserunners.ParseRunner; import org.parboiled.parserunners.ProfilingParseRunner; import org.pegdown.ast.Node; import org.pegdown.ast.RootNode; public class Benchmark { @SuppressWarnings({"UnusedAssignment"}) public static void main(String[] args) { System.out.println("pegdown performance test"); System.out.println("------------------------"); System.out.print("Creating pegdown processor... :"); long start = System.currentTimeMillis(); PegDownProcessor processor = new PegDownProcessor(); time(start); System.out.print("Creating 100 more parser instances... :"); start = System.currentTimeMillis(); for (int i = 0; i < 100; i++) { new PegDownProcessor(); } time(start); System.out.print("Parsing benchmark file 100 times (w/o Extensions)... :"); char[] markdown = FileUtils.readAllCharsFromResource("benchmark.text"); Preconditions.checkNotNull(markdown, "benchmark file not found"); start = System.currentTimeMillis(); for (int i = 0; i < 100; i++) { processor.markdownToHtml(markdown); } time(start); System.out.print("Parsing benchmark file 100 times (with all Extensions)... :"); processor = new PegDownProcessor(Extensions.ALL); start = System.currentTimeMillis(); for (int i = 0; i < 100; i++) { processor.markdownToHtml(markdown); } time(start); System.out.println(); System.out.println("Parsing benchmark once more with ProfileParseRunner..."); final Reference> profilingRunner = new Reference>(); Parser parser = Parboiled.createParser(Parser.class, Extensions.NONE, new Parser.ParseRunnerProvider() { public ParseRunner get(Rule rule) { if (profilingRunner.isNotSet()) profilingRunner.set(new ProfilingParseRunner(rule)); return profilingRunner.get(); } }); parser.parse(processor.prepareSource(markdown)); ProfilingParseRunner.Report report = profilingRunner.get().getReport(); System.out.println(); System.out.println(report.print()); } private static long time(long start) { long end = System.currentTimeMillis(); System.out.printf(" %s ms\n", end - start); return end - start; } }pegdown-1.5.0/src/test/java/org/pegdown/BlockPluginNode.java000066400000000000000000000005171247356127500240020ustar00rootroot00000000000000package org.pegdown; import org.pegdown.ast.Node; import org.pegdown.ast.TextNode; import org.pegdown.ast.Visitor; public class BlockPluginNode extends TextNode { public BlockPluginNode(String text) { super(text); } @Override public void accept(Visitor visitor) { visitor.visit((Node) this); } } pegdown-1.5.0/src/test/java/org/pegdown/InlinePluginNode.java000066400000000000000000000005211247356127500241610ustar00rootroot00000000000000package org.pegdown; import org.pegdown.ast.Node; import org.pegdown.ast.TextNode; import org.pegdown.ast.Visitor; public class InlinePluginNode extends TextNode { public InlinePluginNode(String text) { super(text); } @Override public void accept(Visitor visitor) { visitor.visit((Node) this); } } pegdown-1.5.0/src/test/java/org/pegdown/PluginParser.java000066400000000000000000000027001247356127500233720ustar00rootroot00000000000000package org.pegdown; import org.parboiled.BaseParser; import org.parboiled.Rule; import org.parboiled.support.StringBuilderVar; import org.pegdown.plugins.BlockPluginParser; import org.pegdown.plugins.InlinePluginParser; public class PluginParser extends Parser implements InlinePluginParser, BlockPluginParser { public PluginParser() { super(ALL, 1000l, DefaultParseRunnerProvider); } @Override public Rule[] blockPluginRules() { return new Rule[] {BlockPlugin()}; } @Override public Rule[] inlinePluginRules() { return new Rule[] {InlinePlugin()}; } public Rule InlinePlugin() { StringBuilderVar text = new StringBuilderVar(); return NodeSequence( Ch('%'), OneOrMore(TestNot(Ch('%')), BaseParser.ANY, text.append(matchedChar())), push(new InlinePluginNode(text.getString())), Ch('%') ); } public Rule BlockPlugin() { StringBuilderVar text = new StringBuilderVar(); return NodeSequence( BlockPluginMarker(), OneOrMore(TestNot(Newline(), BlockPluginMarker()), BaseParser.ANY, text.append(matchedChar())), Newline(), push(new BlockPluginNode(text.appended('\n').getString())), BlockPluginMarker() ); } public Rule BlockPluginMarker() { return Sequence(NOrMore('%', 3), Newline()); } } pegdown-1.5.0/src/test/java/org/pegdown/ShowParserStats.java000066400000000000000000000027211247356127500240760ustar00rootroot00000000000000/* * Copyright (C) 2010-2011 Mathias Doenitz * * Based on peg-markdown (C) 2008-2010 John MacFarlane * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegdown; import org.parboiled.Parboiled; import org.parboiled.ParserStatistics; import org.parboiled.Rule; public class ShowParserStats { public static void main(String[] args) { System.out.print("Creating processor... :"); long start = System.currentTimeMillis(); PegDownProcessor processor = new PegDownProcessor(); time(start); Parser parser = Parboiled.createParser(Parser.class, Extensions.NONE); ParserStatistics stats = ParserStatistics.generateFor(parser.Root()); System.out.println(stats); System.out.println(stats.printActionClassInstances()); } private static long time(long start) { long end = System.currentTimeMillis(); System.out.printf(" %s ms\n\n", end - start); return end - start; } } pegdown-1.5.0/src/test/resources/000077500000000000000000000000001247356127500167545ustar00rootroot00000000000000pegdown-1.5.0/src/test/resources/MarkdownTest103/000077500000000000000000000000001247356127500216225ustar00rootroot00000000000000pegdown-1.5.0/src/test/resources/MarkdownTest103/Amps and angle encoding.html000066400000000000000000000007711247356127500267560ustar00rootroot00000000000000

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 with an ampersand in the URL.

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

Here's an inline link.

Here's an inline link.

pegdown-1.5.0/src/test/resources/MarkdownTest103/Amps and angle encoding.md000066400000000000000000000005751247356127500264140ustar00rootroot00000000000000AT&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](). [1]: http://example.com/?foo=1&bar=2 [2]: http://att.com/ "AT&T"pegdown-1.5.0/src/test/resources/MarkdownTest103/Auto links.html000066400000000000000000000010421247356127500245160ustar00rootroot00000000000000

Link: http://example.com/.

With an ampersand: http://example.com/?foo=1&bar=2

Blockquoted: http://example.com/

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

or here: <http://example.com/>
pegdown-1.5.0/src/test/resources/MarkdownTest103/Auto links.md000066400000000000000000000004071247356127500241560ustar00rootroot00000000000000Link: . With an ampersand: * In a list? * * It should. > Blockquoted: Auto-links should not occur here: `` or here: pegdown-1.5.0/src/test/resources/MarkdownTest103/Backslash escapes.html000066400000000000000000000032611247356127500260110ustar00rootroot00000000000000

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 bar.

This is a tag with backslashes bar.

pegdown-1.5.0/src/test/resources/MarkdownTest103/Backslash escapes.md000066400000000000000000000023421247356127500254440ustar00rootroot00000000000000These 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 bar. This is a tag with backslashes bar. pegdown-1.5.0/src/test/resources/MarkdownTest103/Blockquotes with code blocks.html000066400000000000000000000002721247356127500300710ustar00rootroot00000000000000

Example:

sub status {
    print "working";
}

Or:

sub status {
    return "working";
}
pegdown-1.5.0/src/test/resources/MarkdownTest103/Blockquotes with code blocks.md000066400000000000000000000002071247356127500275230ustar00rootroot00000000000000> Example: > > sub status { > print "working"; > } > > Or: > > sub status { > return "working"; > } pegdown-1.5.0/src/test/resources/MarkdownTest103/Code Blocks.html000066400000000000000000000004701247356127500245610ustar00rootroot00000000000000
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
pegdown-1.5.0/src/test/resources/MarkdownTest103/Code Blocks.md000066400000000000000000000003071247356127500242140ustar00rootroot00000000000000 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 linepegdown-1.5.0/src/test/resources/MarkdownTest103/Code Spans.html000066400000000000000000000003371247356127500244320ustar00rootroot00000000000000

<test a=" content of attribute ">

Fix for backticks within HTML tag: like this

Here's how you put `backticks` in a code span.

pegdown-1.5.0/src/test/resources/MarkdownTest103/Code Spans.md000066400000000000000000000002471247356127500240660ustar00rootroot00000000000000`` Fix for backticks within HTML tag: like this Here's how you put `` `backticks` `` in a code span. pegdown-1.5.0/src/test/resources/MarkdownTest103/Hard-wrapped paragraphs with list-like lines.html000066400000000000000000000003231247356127500330420ustar00rootroot00000000000000

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.

pegdown-1.5.0/src/test/resources/MarkdownTest103/Hard-wrapped paragraphs with list-like lines.md000066400000000000000000000003051247356127500324760ustar00rootroot00000000000000In 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. pegdown-1.5.0/src/test/resources/MarkdownTest103/Horizontal rules.html000066400000000000000000000006611247356127500257570ustar00rootroot00000000000000

Dashes:





---




- - -

Asterisks:





***




* * *

Underscores:





___




_ _ _
pegdown-1.5.0/src/test/resources/MarkdownTest103/Horizontal rules.md000066400000000000000000000004161247356127500254110ustar00rootroot00000000000000Dashes: --- --- --- --- --- - - - - - - - - - - - - - - - Asterisks: *** *** *** *** *** * * * * * * * * * * * * * * * Underscores: ___ ___ ___ ___ ___ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pegdown-1.5.0/src/test/resources/MarkdownTest103/Inline HTML (Advanced).html000066400000000000000000000002451247356127500262630ustar00rootroot00000000000000

Simple block on one line:

foo

And nested without indentation:

foo
bar
pegdown-1.5.0/src/test/resources/MarkdownTest103/Inline HTML (Advanced).md000066400000000000000000000002271247356127500257170ustar00rootroot00000000000000Simple block on one line:
foo
And nested without indentation:
foo
bar
pegdown-1.5.0/src/test/resources/MarkdownTest103/Inline HTML (Simple).html000066400000000000000000000014201247356127500260030ustar00rootroot00000000000000

Here's a simple block:

foo

This should be a code block, though:

<div>
    foo
</div>

As should this:

<div>foo</div>

Now, nested:

foo

This should just be an HTML comment:

Multiline:

Code block:

<!-- Comment -->

Just plain comment, with trailing spaces on the line:

Code:

<hr />

Hr's:










pegdown-1.5.0/src/test/resources/MarkdownTest103/Inline HTML (Simple).md000066400000000000000000000010511247356127500254370ustar00rootroot00000000000000Here's a simple block:
foo
This should be a code block, though:
foo
As should this:
foo
Now, nested:
foo
This should just be an HTML comment: Multiline: Code block: Just plain comment, with trailing spaces on the line: Code:
Hr's:








pegdown-1.5.0/src/test/resources/MarkdownTest103/Inline HTML comments.html000066400000000000000000000002741247356127500262640ustar00rootroot00000000000000

Paragraph one.

Paragraph two.

The end.

pegdown-1.5.0/src/test/resources/MarkdownTest103/Inline HTML comments.md000066400000000000000000000002441247356127500257150ustar00rootroot00000000000000Paragraph one. Paragraph two. The end. pegdown-1.5.0/src/test/resources/MarkdownTest103/Links, inline style.html000066400000000000000000000005471247356127500262320ustar00rootroot00000000000000

Just a URL.

URL and title.

URL and title.

URL and title.

URL and title.

Empty.

pegdown-1.5.0/src/test/resources/MarkdownTest103/Links, inline style.md000066400000000000000000000003471247356127500256640ustar00rootroot00000000000000Just 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" ). [Empty](). pegdown-1.5.0/src/test/resources/MarkdownTest103/Links, reference style.html000066400000000000000000000021451247356127500267060ustar00rootroot00000000000000

Foo bar.

Foo bar.

Foo bar.

With embedded [brackets].

Indented once.

Indented twice.

Indented thrice.

Indented [four][] times.

[four]: /url

this should work

So should 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 points to something else.

Backslashing should suppress [this] and [this].


Here's one where the link breaks across lines.

Here's another where the link breaks across lines, but with a line-ending space.

pegdown-1.5.0/src/test/resources/MarkdownTest103/Links, reference style.md000066400000000000000000000014271247356127500263440ustar00rootroot00000000000000Foo [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/ pegdown-1.5.0/src/test/resources/MarkdownTest103/Links, shortcut references.html000066400000000000000000000004001247356127500275740ustar00rootroot00000000000000

This is the simple case.

This one has a line break.

This one has a line break with a line-ending space.

this and the other

pegdown-1.5.0/src/test/resources/MarkdownTest103/Links, shortcut references.md000066400000000000000000000003541247356127500272400ustar00rootroot00000000000000This 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 pegdown-1.5.0/src/test/resources/MarkdownTest103/Literal quotes in titles.html000066400000000000000000000002431247356127500272600ustar00rootroot00000000000000

Foo bar.

Foo bar.

pegdown-1.5.0/src/test/resources/MarkdownTest103/Literal quotes in titles.md000066400000000000000000000001541247356127500267150ustar00rootroot00000000000000Foo [bar][]. Foo [bar](/url/ "Title with "quotes" inside"). [bar]: /url/ "Title with "quotes" inside" pegdown-1.5.0/src/test/resources/MarkdownTest103/Markdown Documentation - Basics.html000066400000000000000000000222501247356127500303670ustar00rootroot00000000000000

Markdown: Basics

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 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 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.

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):

![alt text](/path/to/img.jpg "Title")

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 `&mdash;`
instead of decimal-encoded entites like `&#8212;`.

Output:

<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>

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>&lt;blockquote&gt;
    &lt;p&gt;For example.&lt;/p&gt;
&lt;/blockquote&gt;
</code></pre>
pegdown-1.5.0/src/test/resources/MarkdownTest103/Markdown Documentation - Basics.md000066400000000000000000000176001247356127500300260ustar00rootroot00000000000000Markdown: Basics ================ 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 `

` and `

` 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:

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

### 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:

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.

## 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:
  • Candy.
  • Gum.
  • Booze.
Ordered (numbered) lists use regular numbers, followed by periods, as list markers: 1. Red 2. Green 3. Blue Output:
  1. Red
  2. Green
  3. Blue
If you put blank lines between items, you'll get `

` 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:

  • A list item.

    With multiple paragraphs.

  • Another item in the list.

### 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:

This is an example link.

Optionally, you may include a title attribute in the parentheses: This is an [example link](http://example.com/ "With a Title"). Output:

This is an example link.

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:

I get 10 times more traffic from Google than from Yahoo or MSN.

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:

I start my morning with a cup of coffee and The New York Times.

### Images ### Image syntax is very much like link syntax. Inline (titles are optional): ![alt text](/path/to/img.jpg "Title") Reference-style: ![alt text][id] [id]: /path/to/img.jpg "Title" Both of the above examples produce the same output: alt text ### 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 `` tags. I wish SmartyPants used named entities like `—` instead of decimal-encoded entites like `—`. Output:

I strongly recommend against using any <blink> tags.

I wish SmartyPants used named entities like &mdash; instead of decimal-encoded entites like &#8212;.

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:

For example.

Output:

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>
    
pegdown-1.5.0/src/test/resources/MarkdownTest103/Markdown Documentation - Syntax.html000066400000000000000000000760511247356127500304610ustar00rootroot00000000000000

Markdown: Syntax

Note: This document is itself written using Markdown; you can see the source for it by adding '.text' to the URL.


Overview

Philosophy

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, atx, Textile, reStructuredText, Grutatext, and EtText -- the single biggest source of inspiration for Markdown's syntax is the format of plain text email.

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.

Inline HTML

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.

Automatic Escaping for Special Characters

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. &lt;, and &amp;.

Ampersands in particular are bedeviling for web writers. If you want to write about 'AT&T', you need to write 'AT&amp;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&amp;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 &amp;.

So, if you want to include a copyright symbol in your article, you can write:

&copy;

and Markdown will leave it alone. But if you write:

AT&T

Markdown will translate it to:

AT&amp;T

Similarly, because Markdown supports inline 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 &lt; 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.)


Block Elements

Paragraphs and Line Breaks

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 and multi-paragraph list items work best -- and look better -- when you format them with hard breaks.

Markdown supports two styles of headers, Setext and atx.

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 ######

Blockquotes

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.

Lists

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.

Code Blocks

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">
        &copy; 2004 Foo Corporation
    </div>

will turn into:

<pre><code>&lt;div class="footer"&gt;
    &amp;copy; 2004 Foo Corporation
&lt;/div&gt;
</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.

Horizontal Rules

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:

* * *

***

*****

- - -

---------------------------------------

_ _ _

Span Elements

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.

Emphasis

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\*

Code

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>&lt;blink&gt;</code> tags.</p>

You can write this:

`&#8212;` is the decimal-encoded equivalent of `&mdash;`.

to produce:

<p><code>&amp;#8212;</code> is the decimal-encoded
equivalent of <code>&amp;mdash;</code>.</p>

Images

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:

![Alt text](/path/to/img.jpg)

![Alt text](/path/to/img.jpg "Optional title")

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.


Miscellaneous

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="&#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>

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.)

Backslash Escapes

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
pegdown-1.5.0/src/test/resources/MarkdownTest103/Markdown Documentation - Syntax.md000066400000000000000000000654441247356127500301210ustar00rootroot00000000000000Markdown: Syntax ================ * [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 * * *

Overview

Philosophy

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.

Inline HTML

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. `
`, ``, `
`, `

`, 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) `

` tags around HTML block-level tags. For example, to add an HTML table to a Markdown article: This is a regular paragraph.

Foo
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. ``, ``, or `` -- 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 `` or `` 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.

Automatic Escaping for Special Characters

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.) * * *

Block Elements

Paragraphs and Line Breaks

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 `
` tag. When you *do* want to insert a `
` 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 `
`, but a simplistic "every line break is a `
`" 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 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 ######

Blockquotes

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.

Lists

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:
  1. Bird
  2. McHale
  3. Parish
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 `

` tags in the HTML output. For example, this input: * Bird * Magic will turn into:

  • Bird
  • Magic
But this: * Bird * Magic will turn into:
  • Bird

  • Magic

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: 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.

Code Blocks

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 `
` and `` 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:

    

This is a normal paragraph:

This is a code block.
    
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:

Here is an example of AppleScript:

tell application "Foo"
        beep
    end tell
    
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: will turn into:
<div class="footer">
        &copy; 2004 Foo Corporation
    </div>
    
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.

Horizontal Rules

You can produce a horizontal rule tag (`
`) 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: * * * *** ***** - - - --------------------------------------- _ _ _ * * *

Span Elements

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:

This is an example inline link.

This link has no title attribute.

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]: "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:

I get 10 times more traffic from Google than from Yahoo or MSN.

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.

Emphasis

Markdown treats asterisks (`*`) and underscores (`_`) as indicators of emphasis. Text wrapped with one `*` or `_` will be wrapped with an HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML `` tag. E.g., this input: *single asterisks* _single underscores_ **double asterisks** __double underscores__ will produce: single asterisks single underscores double asterisks double underscores 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\*

Code

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:

Use the printf() function.

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:

There is a literal backtick (`) here.

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:

A single backtick in a code span: `

A backtick-delimited string in a code span: `foo`

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 `` tags. into:

Please don't use any <blink> tags.

You can write this: `—` is the decimal-encoded equivalent of `—`. to produce:

&#8212; is the decimal-encoded equivalent of &mdash;.

Images

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: ![Alt text](/path/to/img.jpg) ![Alt text](/path/to/img.jpg "Optional title") 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 `` tags. * * *

Miscellaneous

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: Markdown will turn this into: http://example.com/ 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: into something like this: address@exa mple.com 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.)

Backslash Escapes

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 `` 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 pegdown-1.5.0/src/test/resources/MarkdownTest103/Nested blockquotes.html000066400000000000000000000001511247356127500262430ustar00rootroot00000000000000

foo

bar

foo

pegdown-1.5.0/src/test/resources/MarkdownTest103/Nested blockquotes.md000066400000000000000000000000301247356127500256730ustar00rootroot00000000000000> foo > > > bar > > foo pegdown-1.5.0/src/test/resources/MarkdownTest103/Ordered and unordered lists.html000066400000000000000000000032451247356127500277120ustar00rootroot00000000000000

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

pegdown-1.5.0/src/test/resources/MarkdownTest103/Ordered and unordered lists.md000066400000000000000000000016071247356127500273460ustar00rootroot00000000000000## 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 pegdown-1.5.0/src/test/resources/MarkdownTest103/Strong and em together.html000066400000000000000000000003271247356127500266750ustar00rootroot00000000000000

This is strong and em.

So is this word.

This is strong and em.

So is this word.

pegdown-1.5.0/src/test/resources/MarkdownTest103/Strong and em together.md000066400000000000000000000001531247356127500263260ustar00rootroot00000000000000***This is strong and em.*** So is ***this*** word. ___This is strong and em.___ So is ___this___ word. pegdown-1.5.0/src/test/resources/MarkdownTest103/Tabs.html000066400000000000000000000006671247356127500234120ustar00rootroot00000000000000
  • 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
pegdown-1.5.0/src/test/resources/MarkdownTest103/Tabs.md000066400000000000000000000004671247356127500230440ustar00rootroot00000000000000+ 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 pegdown-1.5.0/src/test/resources/MarkdownTest103/Tidyness.html000066400000000000000000000002051247356127500243070ustar00rootroot00000000000000

A list within a blockquote:

  • asterisk 1
  • asterisk 2
  • asterisk 3
pegdown-1.5.0/src/test/resources/MarkdownTest103/Tidyness.md000066400000000000000000000001161247356127500237440ustar00rootroot00000000000000> A list within a blockquote: > > * asterisk 1 > * asterisk 2 > * asterisk 3 pegdown-1.5.0/src/test/resources/Maruku/000077500000000000000000000000001247356127500202205ustar00rootroot00000000000000pegdown-1.5.0/src/test/resources/Maruku/abbreviations.html000066400000000000000000000003231247356127500237340ustar00rootroot00000000000000

The HTML specification is maintained by the W3C.

Operation Tigra Genesis is going well.

pegdown-1.5.0/src/test/resources/Maruku/abbreviations.md000066400000000000000000000002671247356127500233770ustar00rootroot00000000000000 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]: pegdown-1.5.0/src/test/resources/Maruku/alt.html000066400000000000000000000000501247356127500216610ustar00rootroot00000000000000

bar

pegdown-1.5.0/src/test/resources/Maruku/alt.md000066400000000000000000000000241247356127500213160ustar00rootroot00000000000000 ![bar](/foo.jpg) pegdown-1.5.0/src/test/resources/Maruku/blank.html000066400000000000000000000000371247356127500221750ustar00rootroot00000000000000

Linea 1

Linea 2

pegdown-1.5.0/src/test/resources/Maruku/blank.md000066400000000000000000000000221247356127500216230ustar00rootroot00000000000000 Linea 1 Linea 2 pegdown-1.5.0/src/test/resources/Maruku/blanks_in_code.html000066400000000000000000000003361247356127500240420ustar00rootroot00000000000000

This block is composed of three lines:

one

three

This block is composed of 5

one


four

This block is composed of 2

two
pegdown-1.5.0/src/test/resources/Maruku/blanks_in_code.md000066400000000000000000000002201247356127500234660ustar00rootroot00000000000000This block is composed of three lines: one three This block is composed of 5 one four This block is composed of 2 two pegdown-1.5.0/src/test/resources/Maruku/bug_def.html000066400000000000000000000000321247356127500224740ustar00rootroot00000000000000

test:

pegdown-1.5.0/src/test/resources/Maruku/bug_def.md000066400000000000000000000000131247356127500221270ustar00rootroot00000000000000[test][]: pegdown-1.5.0/src/test/resources/Maruku/bug_table.html000066400000000000000000000004231247356127500230310ustar00rootroot00000000000000

hello

hh
c1c2
pegdown-1.5.0/src/test/resources/Maruku/bug_table.md000066400000000000000000000002651247356127500224710ustar00rootroot00000000000000 hello {: summary="Table summary" .class1 style="color:red"} h | h ----------|-- {:t} c1 | c2 {: summary="Table summary" .class1 style="color:red"} {:t: scope="row"} pegdown-1.5.0/src/test/resources/Maruku/code.html000066400000000000000000000001771247356127500220250ustar00rootroot00000000000000

Here is an example of AppleScript:

tell application "Foo"
    beep
end tell
    tab
pegdown-1.5.0/src/test/resources/Maruku/code.md000066400000000000000000000001431247356127500214520ustar00rootroot00000000000000Here is an example of AppleScript: tell application "Foo" beep end tell tab pegdown-1.5.0/src/test/resources/Maruku/code2.html000066400000000000000000000001061247356127500220770ustar00rootroot00000000000000

Code

Ciao
pegdown-1.5.0/src/test/resources/Maruku/code2.md000066400000000000000000000000241247356127500215320ustar00rootroot00000000000000> Code > > Ciao pegdown-1.5.0/src/test/resources/Maruku/code3.html000066400000000000000000000003541247356127500221050ustar00rootroot00000000000000

This is code (4 spaces):

Code

This is not code

Code

This is code (1 tab):

Code

This is not code

Code
pegdown-1.5.0/src/test/resources/Maruku/code3.md000066400000000000000000000001741247356127500215410ustar00rootroot00000000000000 This is code (4 spaces): Code This is not code Code This is code (1 tab): Code This is not code Code pegdown-1.5.0/src/test/resources/Maruku/data_loss.html000066400000000000000000000000431247356127500230540ustar00rootroot00000000000000
  1. abcd efgh ijkl
pegdown-1.5.0/src/test/resources/Maruku/data_loss.md000066400000000000000000000000231247356127500225060ustar00rootroot000000000000001. abcd efgh ijkl pegdown-1.5.0/src/test/resources/Maruku/easy.html000066400000000000000000000000651247356127500220500ustar00rootroot00000000000000

Hello! how are you?

pegdown-1.5.0/src/test/resources/Maruku/easy.md000066400000000000000000000000321247356127500214760ustar00rootroot00000000000000*Hello!* how are **you**? pegdown-1.5.0/src/test/resources/Maruku/email.html000066400000000000000000000002571247356127500222010ustar00rootroot00000000000000

This is an email address: andrea@invalid.it

pegdown-1.5.0/src/test/resources/Maruku/email.md000066400000000000000000000000621247356127500216270ustar00rootroot00000000000000 This is an email address: pegdown-1.5.0/src/test/resources/Maruku/entities.html000066400000000000000000000015251247356127500227350ustar00rootroot00000000000000

Maruku translates HTML entities to the equivalent in LaTeX:

Entity Result
&copy; ©
&pound; £
a&nbsp;b a b
&lambda; λ
&mdash;

Entity-substitution does not happen in code blocks or inline code.

The following should not be translated:

&copy;

It should read just like this: &copy;.

pegdown-1.5.0/src/test/resources/Maruku/entities.md000066400000000000000000000006011247356127500223630ustar00rootroot00000000000000Maruku 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: `©`. pegdown-1.5.0/src/test/resources/Maruku/escaping.html000066400000000000000000000005231247356127500226770ustar00rootroot00000000000000

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

pegdown-1.5.0/src/test/resources/Maruku/escaping.md000066400000000000000000000003671247356127500223410ustar00rootroot00000000000000 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 ` pegdown-1.5.0/src/test/resources/Maruku/extra_dl.html000066400000000000000000000002701247356127500227070ustar00rootroot00000000000000
Apple
Pomaceous fruit of plants of the genus Malus in the family Rosaceae.
Orange
The fruit of an evergreen tree of the genus Citrus.
pegdown-1.5.0/src/test/resources/Maruku/extra_dl.md000066400000000000000000000002461247356127500223460ustar00rootroot00000000000000CSS: 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. pegdown-1.5.0/src/test/resources/Maruku/extra_header_id.html000066400000000000000000000005051247356127500242150ustar00rootroot00000000000000

Header 1

Header 2

Header 3

Then you can create links to different parts of the same document like this:

Link back to header 1, Link back to header 2, Link back to header 3

pegdown-1.5.0/src/test/resources/Maruku/extra_header_id.md000066400000000000000000000004531247356127500236530ustar00rootroot00000000000000Header 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) pegdown-1.5.0/src/test/resources/Maruku/extra_table1.html000066400000000000000000000004611247356127500234620ustar00rootroot00000000000000
First Header Second Header
Content Cell Content Cell
Content Cell Content Cell
pegdown-1.5.0/src/test/resources/Maruku/extra_table1.md000066400000000000000000000001701247356127500231130ustar00rootroot00000000000000 First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell pegdown-1.5.0/src/test/resources/Maruku/footnotes.html000066400000000000000000000014141247356127500231260ustar00rootroot00000000000000

That’s some text with a footnote 1 and another 2 and another 3.

This is not a footnote.


  1. And that’s the footnote. This is second sentence (same paragraph).

  2. This is the very long one.

    That’s the second paragraph.

  3. And that’s the footnote.

    That’s the second paragraph of the footnote.

pegdown-1.5.0/src/test/resources/Maruku/footnotes.md000066400000000000000000000005101247356127500225560ustar00rootroot00000000000000That'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. pegdown-1.5.0/src/test/resources/Maruku/headers.html000066400000000000000000000001721247356127500225210ustar00rootroot00000000000000

A title with emphasis

A title with emphasis

A title with emphasis

pegdown-1.5.0/src/test/resources/Maruku/headers.md000066400000000000000000000002101247356127500221460ustar00rootroot00000000000000A title with *emphasis* ======================= A title with *emphasis* ----------------------- #### A title with *emphasis* #### pegdown-1.5.0/src/test/resources/Maruku/hex_entities.html000066400000000000000000000003131247356127500235730ustar00rootroot00000000000000

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.

pegdown-1.5.0/src/test/resources/Maruku/hex_entities.md000066400000000000000000000003071247356127500232320ustar00rootroot00000000000000Examples of numeric character references include © or © for the copyright symbol, Α or Α for the Greek capital letter alpha, and ا or ا for the Arabic letter alef. pegdown-1.5.0/src/test/resources/Maruku/hrule.html000066400000000000000000000000371247356127500222250ustar00rootroot00000000000000




pegdown-1.5.0/src/test/resources/Maruku/hrule.md000066400000000000000000000000071247356127500216560ustar00rootroot00000000000000* * * pegdown-1.5.0/src/test/resources/Maruku/html2.html000066400000000000000000000000361247356127500221330ustar00rootroot00000000000000

One

123

pegdown-1.5.0/src/test/resources/Maruku/html2.md000066400000000000000000000000431247356127500215650ustar00rootroot00000000000000One
123
123 pegdown-1.5.0/src/test/resources/Maruku/html3.html000066400000000000000000000005111247356127500221320ustar00rootroot00000000000000

taking part in some arcane conspirations which involve coffee, robots, sushi,

pegdown-1.5.0/src/test/resources/Maruku/html3.md000066400000000000000000000005041247356127500215700ustar00rootroot00000000000000taking part in some arcane conspirations which involve coffee, robots, sushi, pegdown-1.5.0/src/test/resources/Maruku/html4.html000066400000000000000000000003071247356127500221360ustar00rootroot00000000000000
pegdown-1.5.0/src/test/resources/Maruku/html4.md000066400000000000000000000003161247356127500215720ustar00rootroot00000000000000
pegdown-1.5.0/src/test/resources/Maruku/html5.html000066400000000000000000000003511247356127500221360ustar00rootroot00000000000000
Aperitif
pegdown-1.5.0/src/test/resources/Maruku/html5.md000066400000000000000000000003551247356127500215760ustar00rootroot00000000000000
Aperitif
pegdown-1.5.0/src/test/resources/Maruku/ie.html000066400000000000000000000012771247356127500215120ustar00rootroot00000000000000

<p>here's an apostrophe & a quote "</p>

<p>here's an apostrophe & a quote "</p>
<p>here's an apostrophe & a quote "</p>
<p>here's an apostrophe & a quote "</p>
<p>here's an apostrophe & a quote "</p>
pegdown-1.5.0/src/test/resources/Maruku/ie.md000066400000000000000000000004601247356127500211370ustar00rootroot00000000000000`

here's an apostrophe & a quote "

`

here's an apostrophe & a quote "

{:}

here's an apostrophe & a quote "

{:lang=xml}

here's an apostrophe & a quote "

{:html_use_syntax=true lang=not_supported}

here's an apostrophe & a quote "

{:html_use_syntax=true lang=xml} pegdown-1.5.0/src/test/resources/Maruku/images.html000066400000000000000000000013751247356127500223610ustar00rootroot00000000000000

This page does not uilizes Cascading Style Sheets

Please mouseover to see the title: Cascading Style Sheets

Please mouseover to see the title: Cascading Style Sheets

I’ll say it one more time: this page does not use Cascading Style Sheets

This is double size: Cascading Style Sheets

pegdown-1.5.0/src/test/resources/Maruku/images.md000066400000000000000000000012141247356127500220050ustar00rootroot00000000000000 This page does not uilizes ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss) Please mouseover to see the title: ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss "Title ok!") Please mouseover to see the title: ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss 'Title ok!') 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"pegdown-1.5.0/src/test/resources/Maruku/images2.html000066400000000000000000000001571247356127500224400ustar00rootroot00000000000000

This is an image.

This is an image.

pegdown-1.5.0/src/test/resources/Maruku/images2.md000066400000000000000000000001031247356127500220630ustar00rootroot00000000000000 This is an ![image][]. This is an ![image]. [image]: image.jpg pegdown-1.5.0/src/test/resources/Maruku/inline_html.html000066400000000000000000000026311247356127500234120ustar00rootroot00000000000000

Input:

<em>Emphasis</em>

Result: Emphasis

Input:

<img src="http://jigsaw.w3.org/css-validator/images/vcss"/>

Result on span:

Result alone:

Without closing:

This is

true

markdown text (paragraph)

This is

true

markdown text (no paragraph)

This is

true

markdown text (block paragraph)

This is

true

markdown text. (no par)

This is

true

markdown text. (par)

The following is invalid HTML, and will generate an error:

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>
HTML parse error: 
</table>
pegdown-1.5.0/src/test/resources/Maruku/inline_html.md000066400000000000000000000016671247356127500230560ustar00rootroot00000000000000CSS: style.css Input: Emphasis Result: Emphasis Input: Result on span: Result alone: Without closing:
This is *true* markdown text (paragraph)

This is *true* markdown text (no paragraph)

This is *true* markdown text (block paragraph)

This is *true* markdown text. (no par) This is *true* markdown text. (par)
The following is invalid HTML, and will generate an error:
This is *true* markdown text. (no par) This is *true* markdown text. (par)
pegdown-1.5.0/src/test/resources/Maruku/inline_html2.html000066400000000000000000000001201247356127500234630ustar00rootroot00000000000000

Test bold

Test bold

pegdown-1.5.0/src/test/resources/Maruku/inline_html2.md000066400000000000000000000001101247356127500231160ustar00rootroot00000000000000
Test **bold**

Test **bold**

pegdown-1.5.0/src/test/resources/Maruku/links.html000066400000000000000000000017211247356127500222270ustar00rootroot00000000000000

Search on Google

Search on Google

Search on Google

Search on Google

Search on Google images

Inline: Google images

Inline with title: Google images

Inline with title: Google images

Search on http://www.gogole.com or http://Here.com or ask bill@google.com or you might ask bill@google.com.

If all else fails, ask Google

pegdown-1.5.0/src/test/resources/Maruku/links.md000066400000000000000000000014131247356127500216610ustar00rootroot00000000000000 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 or or ask 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) pegdown-1.5.0/src/test/resources/Maruku/list1.html000066400000000000000000000002101247356127500221330ustar00rootroot00000000000000
  • A list item with a blockquote:

    This is a blockquote inside a list item.

pegdown-1.5.0/src/test/resources/Maruku/list1.md000066400000000000000000000001321247356127500215720ustar00rootroot00000000000000* A list item with a blockquote: > This is a blockquote > inside a list item. pegdown-1.5.0/src/test/resources/Maruku/list2.html000066400000000000000000000004051247356127500221420ustar00rootroot00000000000000
  • 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

pegdown-1.5.0/src/test/resources/Maruku/list2.md000066400000000000000000000003261247356127500216000ustar00rootroot00000000000000* 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 pegdown-1.5.0/src/test/resources/Maruku/list3.html000066400000000000000000000003531247356127500221450ustar00rootroot00000000000000
  • A list item with a blockquote:

    This is a blockquote inside a list item.

  • A list item with a code block:

    <code goes here>
    
pegdown-1.5.0/src/test/resources/Maruku/list3.md000066400000000000000000000002271247356127500216010ustar00rootroot00000000000000* A list item with a blockquote: > This is a blockquote > inside a list item. * A list item with a code block: pegdown-1.5.0/src/test/resources/Maruku/list4.html000066400000000000000000000003171247356127500221460ustar00rootroot00000000000000

This is a list:

  • one
  • two

This is not a list: * one ciao

This is a list:

  1. one
  2. two

This is not a list: 1987. one ciao

pegdown-1.5.0/src/test/resources/Maruku/list4.md000066400000000000000000000002001247356127500215710ustar00rootroot00000000000000This 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 pegdown-1.5.0/src/test/resources/Maruku/lists.html000066400000000000000000000023661247356127500222530ustar00rootroot00000000000000
  • 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.

pegdown-1.5.0/src/test/resources/Maruku/lists.md000066400000000000000000000021731247356127500217030ustar00rootroot00000000000000* 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. pegdown-1.5.0/src/test/resources/Maruku/lists11.html000066400000000000000000000000201247356127500223760ustar00rootroot00000000000000

- ένα

pegdown-1.5.0/src/test/resources/Maruku/lists11.md000066400000000000000000000000121247356127500220330ustar00rootroot00000000000000- ένα pegdown-1.5.0/src/test/resources/Maruku/lists6.html000066400000000000000000000000011247356127500223210ustar00rootroot00000000000000 pegdown-1.5.0/src/test/resources/Maruku/lists6.md000066400000000000000000000000011247356127500217550ustar00rootroot00000000000000 pegdown-1.5.0/src/test/resources/Maruku/lists7.html000066400000000000000000000001421247356127500223300ustar00rootroot00000000000000

Ciao

  • Tab * Tab * Tab

Ciao

  • Tab * Tab * Tab
pegdown-1.5.0/src/test/resources/Maruku/lists7.md000066400000000000000000000000341247356127500217640ustar00rootroot00000000000000Ciao * Tab * Tab * Tab pegdown-1.5.0/src/test/resources/Maruku/lists7b.html000066400000000000000000000001141247356127500224710ustar00rootroot00000000000000
  • a
    • a1
    • a2
  • b
pegdown-1.5.0/src/test/resources/Maruku/lists7b.md000066400000000000000000000000341247356127500221260ustar00rootroot00000000000000* a * a1 * a2 * b pegdown-1.5.0/src/test/resources/Maruku/lists8.html000066400000000000000000000001331247356127500223310ustar00rootroot00000000000000

Here is a paragraph.

  • Item 1
  • Item 2
  • Item 3
pegdown-1.5.0/src/test/resources/Maruku/lists8.md000066400000000000000000000000741247356127500217710ustar00rootroot00000000000000Here is a paragraph. * Item 1 * Item 2 * Item 3 pegdown-1.5.0/src/test/resources/Maruku/lists9.html000066400000000000000000000001551247356127500223360ustar00rootroot00000000000000
  • Due

    1. tre
    2. tre
    3. tre
  • Due

pegdown-1.5.0/src/test/resources/Maruku/lists9.md000066400000000000000000000000471247356127500217720ustar00rootroot00000000000000- Due 1. tre 1. tre 1. tre - Due pegdown-1.5.0/src/test/resources/Maruku/lists_after_paragraph.html000066400000000000000000000016151247356127500254550ustar00rootroot00000000000000

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:

Paragraph with header on two lines:

Paragraph with html after

Paragraph with html after, indented: Emphasis

Paragraph with html after, indented: Emphasis tralla Emph

Paragraph with html after, indented: Emphasis *tralla* Emph

pegdown-1.5.0/src/test/resources/Maruku/lists_after_paragraph.md000066400000000000000000000013561247356127500251130ustar00rootroot00000000000000Paragraph, 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
Paragraph with html after, indented: Emphasis Paragraph with html after, indented: Emphasis *tralla* Emph Paragraph with html after, indented: Emphasis *tralla* Emph pegdown-1.5.0/src/test/resources/Maruku/lists_ol.html000066400000000000000000000025461247356127500227450ustar00rootroot00000000000000
  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.
  4. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
  5. 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
      2. tre
      3. 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.

pegdown-1.5.0/src/test/resources/Maruku/lists_ol.md000066400000000000000000000023161247356127500223740ustar00rootroot000000000000001. 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. pegdown-1.5.0/src/test/resources/Maruku/loss.html000066400000000000000000000000071247356127500220630ustar00rootroot00000000000000
pegdown-1.5.0/src/test/resources/Maruku/loss.md000066400000000000000000000000121247356127500215130ustar00rootroot00000000000000
123 pegdown-1.5.0/src/test/resources/Maruku/misc_sw.html000066400000000000000000000103201247356127500225460ustar00rootroot00000000000000

General

  • Operating System : Mac OS X: heaven, after the purgatory of Linux and the hell of Windows.
  • Browser: Firefox. On a Mac, Camino.
  • Email: GMail, “search, don’t sort” really works.
  • Text Editor: 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 (GPL, Java).

Development

  • Build system: cmake, throw the autotools away.

  • Source code control system: ditch CVS for subversion.

  • Project management: Trac tracks everything.

  • Scripting language: Ruby is Japanese pragmatism (and has a 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 is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained generics and got opensourced.

  • Mark-up language: HTML is so 2001, why don’t you take at look at Markdown? Look at the source of this page.

  • C++ libraries: * QT for GUIs. * GSL for math. * Magick++ for manipulating images. * Cairo for creating PDFs. * Boost for just about everything else.

Research

  • Writing papers: LaTeX
  • Writing papers & enjoying the process: LyX
  • Handsome figures in your papers: xfig or, better, jfig.
  • The occasional presentation with many graphical content: OpenOffice Impress (using the OOOlatex plugin); the alternative is PowerPoint with the TexPoint plugin.
  • Managing BibTeX: jabref: multi-platform, for all your bibtex needs.
  • IEEExplore and BibTeX: convert citations using BibConverter.

Cool websites

pegdown-1.5.0/src/test/resources/Maruku/misc_sw.md000066400000000000000000000105441247356127500222120ustar00rootroot00000000000000Subject: 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 pegdown-1.5.0/src/test/resources/Maruku/olist.html000066400000000000000000000001161247356127500222360ustar00rootroot00000000000000

This is a list:

  1. one
  2. two
  3. three
pegdown-1.5.0/src/test/resources/Maruku/olist.md000066400000000000000000000000501247356127500216670ustar00rootroot00000000000000This is a list: 2. one 2. two 3. three pegdown-1.5.0/src/test/resources/Maruku/one.html000066400000000000000000000000201247356127500216570ustar00rootroot00000000000000

One line

pegdown-1.5.0/src/test/resources/Maruku/one.md000066400000000000000000000000111247356127500213130ustar00rootroot00000000000000One line pegdown-1.5.0/src/test/resources/Maruku/paragraph.html000066400000000000000000000000211247356127500230440ustar00rootroot00000000000000

Paragraph

pegdown-1.5.0/src/test/resources/Maruku/paragraph.md000066400000000000000000000000131247356127500225010ustar00rootroot00000000000000Paragraph pegdown-1.5.0/src/test/resources/Maruku/paragraphs.html000066400000000000000000000001521247356127500232340ustar00rootroot00000000000000

Paragraph 1

Paragraph 2

Paragraph 3 Paragraph 4 Paragraph Br->
Paragraph 5

pegdown-1.5.0/src/test/resources/Maruku/paragraphs.md000066400000000000000000000001221247356127500226650ustar00rootroot00000000000000Paragraph 1 Paragraph 2 Paragraph 3 Paragraph 4 Paragraph Br-> Paragraph 5 pegdown-1.5.0/src/test/resources/Maruku/smartypants.html000066400000000000000000000012251247356127500234730ustar00rootroot00000000000000
'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'.

pegdown-1.5.0/src/test/resources/Maruku/smartypants.md000066400000000000000000000005521247356127500231310ustar00rootroot00000000000000 '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 <>No space. I -- too -- met << some curly quotes >> there or <>No space. She was 6\"12\'. > She was 6\"12\'. pegdown-1.5.0/src/test/resources/Maruku/syntax_hl.html000066400000000000000000000005711247356127500231220ustar00rootroot00000000000000

This is ruby code:

require 'maruku'

puts Maruku.new($stdin).to_html

This is ruby code:

require 'maruku'
puts Maruku.new($stdin).to_html
pegdown-1.5.0/src/test/resources/Maruku/syntax_hl.md000066400000000000000000000002611247356127500225520ustar00rootroot00000000000000This 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 pegdown-1.5.0/src/test/resources/Maruku/table_attributes.html000066400000000000000000000004711247356127500244450ustar00rootroot00000000000000
hh
c1c2
pegdown-1.5.0/src/test/resources/Maruku/table_attributes.md000066400000000000000000000003001247356127500240700ustar00rootroot00000000000000 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"} pegdown-1.5.0/src/test/resources/Maruku/test.html000066400000000000000000000000571247356127500220670ustar00rootroot00000000000000
       $ python       
pegdown-1.5.0/src/test/resources/Maruku/test.md000066400000000000000000000000371247356127500215210ustar00rootroot00000000000000 $ python pegdown-1.5.0/src/test/resources/Maruku/wrapping.html000066400000000000000000000011271247356127500227360ustar00rootroot00000000000000

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
pegdown-1.5.0/src/test/resources/Maruku/wrapping.md000066400000000000000000000010661247356127500223740ustar00rootroot00000000000000Lorem 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 pegdown-1.5.0/src/test/resources/Maruku/xml.html000066400000000000000000000003531247356127500217070ustar00rootroot00000000000000 pegdown-1.5.0/src/test/resources/Maruku/xml.md000066400000000000000000000003721247356127500213440ustar00rootroot00000000000000 pegdown-1.5.0/src/test/resources/Maruku/xml2.html000066400000000000000000000000131247356127500217620ustar00rootroot00000000000000 pegdown-1.5.0/src/test/resources/Maruku/xml2.md000066400000000000000000000000131247356127500214160ustar00rootroot00000000000000 pegdown-1.5.0/src/test/resources/Maruku/xml3.html000066400000000000000000000000751247356127500217730ustar00rootroot00000000000000Blah
em
pegdown-1.5.0/src/test/resources/Maruku/xml3.md000066400000000000000000000001101247356127500214150ustar00rootroot00000000000000 Blah
*em*
pegdown-1.5.0/src/test/resources/Maruku/xml_instruction.html000066400000000000000000000002201247356127500243410ustar00rootroot00000000000000

Targets

Inside: last

pegdown-1.5.0/src/test/resources/Maruku/xml_instruction.md000066400000000000000000000002151247356127500240010ustar00rootroot00000000000000 Targets Inside: last pegdown-1.5.0/src/test/resources/PhpMarkdown/000077500000000000000000000000001247356127500212065ustar00rootroot00000000000000pegdown-1.5.0/src/test/resources/PhpMarkdown/Backslash_escapes.html000066400000000000000000000002301247356127500254650ustar00rootroot00000000000000

Tricky combinaisons:

backslash with -- two dashes

backslash with > greater than

[test](not a link)

*no emphasis*

pegdown-1.5.0/src/test/resources/PhpMarkdown/Backslash_escapes.md000066400000000000000000000001701247356127500251240ustar00rootroot00000000000000Tricky combinaisons: backslash with \-- two dashes backslash with \> greater than \[test](not a link) \*no emphasis*pegdown-1.5.0/src/test/resources/PhpMarkdown/Code_Spans.html000066400000000000000000000002171247356127500241120ustar00rootroot00000000000000

From <!-- to --> on two lines.

From <!-- to --> on three lines.

pegdown-1.5.0/src/test/resources/PhpMarkdown/Code_Spans.md000066400000000000000000000001111247356127500235370ustar00rootroot00000000000000From `` on two lines. From `` on three lines. pegdown-1.5.0/src/test/resources/PhpMarkdown/Code_block_in_a_list_item.html000066400000000000000000000001711247356127500271560ustar00rootroot00000000000000
  • List Item:

    code block
    
    with a blank line
    

    within a list item.

pegdown-1.5.0/src/test/resources/PhpMarkdown/Code_block_in_a_list_item.md000066400000000000000000000001061247356127500266100ustar00rootroot00000000000000 * List Item: code block with a blank line within a list item.pegdown-1.5.0/src/test/resources/PhpMarkdown/Email_auto_links.html000066400000000000000000000011461247356127500253550ustar00rootroot00000000000000

michel.fortin@michelf.com

International domain names: help@tūdaliņ.lv

pegdown-1.5.0/src/test/resources/PhpMarkdown/Email_auto_links.md000066400000000000000000000001141247356127500250030ustar00rootroot00000000000000 International domain names: pegdown-1.5.0/src/test/resources/PhpMarkdown/Emphasis.html000066400000000000000000000035161247356127500236520ustar00rootroot00000000000000

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. ab
  2. ab
  3. abc
  4. ab
  5. ab
  6. abc

Middle-word emphasis (underscore):

  1. ab
  2. ab
  3. abc
  4. ab
  5. ab
  6. abc

mypreciousfile.txt

Tricky Cases

E**. Test TestTestTest

E**. Test Test Test Test

pegdown-1.5.0/src/test/resources/PhpMarkdown/Emphasis.md000066400000000000000000000017331247356127500233050ustar00rootroot00000000000000Combined 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 pegdown-1.5.0/src/test/resources/PhpMarkdown/Headers.html000066400000000000000000000005121247356127500234450ustar00rootroot00000000000000

Header

Header

Header


Header

Paragraph

Header

Paragraph

Header

Paragraph


Paragraph

Header

Paragraph

Paragraph

Header

Paragraph

Paragraph

Header

Paragraph

pegdown-1.5.0/src/test/resources/PhpMarkdown/Headers.md000066400000000000000000000003461247356127500231060ustar00rootroot00000000000000Header ====== Header ------ ### Header - - - Header ====== Paragraph Header ------ Paragraph ### Header Paragraph - - - Paragraph Header ====== Paragraph Paragraph Header ------ Paragraph Paragraph ### Header Paragraphpegdown-1.5.0/src/test/resources/PhpMarkdown/Horizontal_Rules.html000066400000000000000000000003421247356127500253760ustar00rootroot00000000000000

Horizontal rules:






Not horizontal rules (testing for a bug in 1.0.1j):

+++

,,,

===

???

AAA

jjj

j j j

n n n

pegdown-1.5.0/src/test/resources/PhpMarkdown/Horizontal_Rules.md000066400000000000000000000002241247356127500250310ustar00rootroot00000000000000Horizontal rules: - - - * * * *** --- ___ Not horizontal rules (testing for a bug in 1.0.1j): +++ ,,, === ??? AAA jjj j j j n n n pegdown-1.5.0/src/test/resources/PhpMarkdown/Inline_HTML_(Simple).html000066400000000000000000000002341247356127500255670ustar00rootroot00000000000000

With some attributes:

foo
foo

Hr's:


pegdown-1.5.0/src/test/resources/PhpMarkdown/Inline_HTML_(Simple).md000066400000000000000000000002121247356127500252170ustar00rootroot00000000000000With some attributes:
foo
foo
Hr's:
pegdown-1.5.0/src/test/resources/PhpMarkdown/Inline_HTML_(Span).html000066400000000000000000000002541247356127500252410ustar00rootroot00000000000000

ACINACS

SB SB

pegdown-1.5.0/src/test/resources/PhpMarkdown/Inline_HTML_(Span).md000066400000000000000000000002361247356127500246750ustar00rootroot00000000000000ACINACS SB SBpegdown-1.5.0/src/test/resources/PhpMarkdown/Inline_HTML_comments.html000066400000000000000000000002121247356127500260360ustar00rootroot00000000000000

Paragraph one.

Paragraph two.

The end.

pegdown-1.5.0/src/test/resources/PhpMarkdown/Inline_HTML_comments.md000066400000000000000000000001651247356127500255010ustar00rootroot00000000000000Paragraph one. Paragraph two. The end. pegdown-1.5.0/src/test/resources/PhpMarkdown/Ins_and_del.html000066400000000000000000000005071247356127500242750ustar00rootroot00000000000000

Here is a block tag ins:

Some text

And here it is inside a paragraph.

And here it is in the middle of a paragraph.

Some text

And here is ins as a paragraph.

And here it is in the middle of a paragraph.

pegdown-1.5.0/src/test/resources/PhpMarkdown/Ins_and_del.md000066400000000000000000000004441247356127500237310ustar00rootroot00000000000000Here is a block tag ins:

Some text

And here it is inside a paragraph. And here it is in the middle of a paragraph.

Some text

And here is ins as a paragraph. And here it is in the middle of a paragraph. pegdown-1.5.0/src/test/resources/PhpMarkdown/Links_inline_style.html000066400000000000000000000000771247356127500257360ustar00rootroot00000000000000

silly URL w/ angle brackets.

pegdown-1.5.0/src/test/resources/PhpMarkdown/Links_inline_style.md000066400000000000000000000000531247356127500253640ustar00rootroot00000000000000[silly URL w/ angle brackets](). pegdown-1.5.0/src/test/resources/PhpMarkdown/MD5_Hashes.html000066400000000000000000000003721247356127500237560ustar00rootroot00000000000000

Character Escapes

The MD5 value for + is "26b17225b626fb9238849fd60eabdf60".

HTML Blocks

test

The MD5 value for <p>test</p> is:

6205333b793f34273d75379350b36826

pegdown-1.5.0/src/test/resources/PhpMarkdown/MD5_Hashes.md000066400000000000000000000002641247356127500234120ustar00rootroot00000000000000# Character Escapes The MD5 value for `+` is "26b17225b626fb9238849fd60eabdf60". # HTML Blocks

test

The MD5 value for `

test

` is: 6205333b793f34273d75379350b36826pegdown-1.5.0/src/test/resources/PhpMarkdown/Nesting.html000066400000000000000000000004271247356127500235060ustar00rootroot00000000000000

Valid nesting:

Link

Link

Link

Invalid nesting:


#commented out
[[Link](url)](url)

pegdown-1.5.0/src/test/resources/PhpMarkdown/Nesting.md000066400000000000000000000002021247356127500231310ustar00rootroot00000000000000Valid nesting: **[Link](url)** [**Link**](url) **[**Link**](url)** Invalid nesting: #commented out [[Link](url)](url)pegdown-1.5.0/src/test/resources/PhpMarkdown/PHP-Specific_Bugs.html000066400000000000000000000010661247356127500252310ustar00rootroot00000000000000

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"
pegdown-1.5.0/src/test/resources/PhpMarkdown/PHP-Specific_Bugs.md000066400000000000000000000007771247356127500246750ustar00rootroot00000000000000This 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" pegdown-1.5.0/src/test/resources/PhpMarkdown/Parens_in_URL.html000066400000000000000000000007301247356127500245340ustar00rootroot00000000000000

Inline link 1 with parens.

Inline link 2 with parens.

Inline link 3 with non-escaped parens.

Inline link 4 with non-escaped parens.

Reference link 1 with parens.

Reference link 2 with parens.

pegdown-1.5.0/src/test/resources/PhpMarkdown/Parens_in_URL.md000066400000000000000000000005461247356127500241750ustar00rootroot00000000000000[Inline link 1 with parens](/url\(test\) "title"). [Inline link 2 with parens]( "title"). [Inline link 3 with non-escaped parens](/url(test) "title"). [Inline link 4 with non-escaped parens]( "title"). [Reference link 1 with parens][1]. [Reference link 2 with parens][2]. [1]: /url(test) "title" [2]: "title" pegdown-1.5.0/src/test/resources/PhpMarkdown/Tight_blocks.html000066400000000000000000000004501247356127500245070ustar00rootroot00000000000000

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.

pegdown-1.5.0/src/test/resources/PhpMarkdown/Tight_blocks.md000066400000000000000000000003211247356127500241400ustar00rootroot00000000000000Paragraph 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. pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/000077500000000000000000000000001247356127500222125ustar00rootroot00000000000000pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Abbr.html000066400000000000000000000016001247356127500237430ustar00rootroot00000000000000

Some text about HTML, SGML and HTML4.

Let's talk about the U.S.A., (É.U. or É.-U. d'A. in French).

And here we have a CD, some CDs, and some other CD's.

Let's transfert documents through TCP/IP, using TCP packets.


Bienvenue sur CMS.

pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Abbr.md000066400000000000000000000012071247356127500234020ustar00rootroot00000000000000Some 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 Systempegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Definition_Lists.html000066400000000000000000000043511247356127500263510ustar00rootroot00000000000000

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)
pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Definition_Lists.md000066400000000000000000000034161247356127500260060ustar00rootroot00000000000000A 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)pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Emphasis.html000066400000000000000000000034131247356127500246520ustar00rootroot00000000000000

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. ab
  2. ab
  3. abc
  4. ab
  5. ab
  6. abc

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

pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Emphasis.md000066400000000000000000000017331247356127500243110ustar00rootroot00000000000000Combined 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 pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Fenced_Code_Blocks.html000066400000000000000000000020151247356127500265110ustar00rootroot00000000000000
Fenced

Code block starting and ending with empty lines:



Fenced

Indented code block containing fenced code block sample:

~~~
Fenced
~~~

Fenced code block with indented code block sample:

Some text

    Indented code block sample code

Fenced code block with long markers:

Fenced

Empty Fenced code block:

~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

Fenced code block with fenced code block markers of different length in it:

In code block
~~~
Still in code block
~~~~~
Still in code block

Fenced code block with Markdown header and horizontal rule:

#test
---

Fenced code block with link definitions, footnote definition and abbreviation definitions:

[example]: http://example.com/

[^1]: Footnote def

*[HTML]: HyperText Markup Language
pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Fenced_Code_Blocks.md000066400000000000000000000015041247356127500261470ustar00rootroot00000000000000~~~ Fenced ~~~ Code block starting and ending with empty lines: ~~~ Fenced ~~~ Indented code block containing fenced code block sample: ~~~ Fenced ~~~ Fenced code block with indented code block sample: ~~~ Some text Indented code block sample code ~~~ Fenced code block with long markers: ~~~~~~~~~~~~~~~~~~ Fenced ~~~~~~~~~~~~~~~~~~ Empty Fenced code block: ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ Fenced code block with fenced code block markers of different length in it: ~~~~ In code block ~~~ Still in code block ~~~~~ Still in code block ~~~~ Fenced code block with Markdown header and horizontal rule: ~~~ #test --- ~~~ Fenced code block with link definitions, footnote definition and abbreviation definitions: ~~~ [example]: http://example.com/ [^1]: Footnote def *[HTML]: HyperText Markup Language ~~~pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Footnotes.html000066400000000000000000000050541247356127500250640ustar00rootroot00000000000000

This is the first paragraph.1

  • List item one.2
  • List item two.3

Header4

Some paragraph with a footnote5, and another6.

Another paragraph with a named footnote7.

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.8

This paragraph host the footnote reference within a footnote test9.


  1. This is the first note. 

  2. This is the second note. 

  3. This is the third note, defined out of order. 

  4. This is the fourth note. 

  5. Content for fifth footnote. 

  6. Content for sixth footnote spaning on three lines, with some span-level markup like emphasis, a link

  7. Footnote beginning on the line next to the marker. 

  8. Paragraph.

    • List item

    Blockquote

    Code block
    

  9. This footnote attemps to refer to another footnote. This should be impossible.[^impossible] 

pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Footnotes.md000066400000000000000000000024121247356127500245130ustar00rootroot00000000000000This 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. pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Inline_HTML_with_Markdown_content.html000066400000000000000000000034501247356127500315730ustar00rootroot00000000000000

Markdown inside code blocks

foo

foo

foo

test emphasis (span)
test emphasis (span)

test emphasis (block)

More complicated

* this is not a list item
* this is not a list item
  • this is a list item

With indent

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.

Code block with rogue </div>s in Markdown code span and block

This is a code block however:

</div>

Funny isn't it? Here is a code span: </div>.

  • List item, not a code block

Some text

This is a code block.

No code block in markdown span mode

This is not a code block since Markdown parse paragraph content as span. Code spans like </p> are allowed though.

Hello world

Preserving attributes and tags on more than one line:

Some span content.

Header confusion bug

Hello World! ============ Hello World!
pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Inline_HTML_with_Markdown_content.md000066400000000000000000000033251247356127500312300ustar00rootroot00000000000000# Markdown inside code blocks
foo
foo
foo
test _emphasis_ (span)
test _emphasis_ (span)
test _emphasis_ (block)
## More complicated
* this is _not_ a list item
* this is _not_ a list item
* this _is_ a list item
## With indent
This text is no code block: if it was, the closing `
` 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.**
## Code block with rogue `
`s in Markdown code span and block
This is a code block however:
Funny isn't it? Here is a code span: `
`.
* List item, not a code block Some text This is a code block.
## No code block in markdown span mode

This is not a code block since Markdown parse paragraph content as span. Code spans like `

` are allowed though.

_Hello_ _world_

## Preserving attributes and tags on more than one line:

Some _span_ content.

## Header confusion bug
Hello World! ============ Hello World!
pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Tables.html000066400000000000000000000066341247356127500243230ustar00rootroot00000000000000

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
pegdown-1.5.0/src/test/resources/PhpMarkdownExtra/Tables.md000066400000000000000000000033311247356127500237460ustar00rootroot00000000000000# 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 pegdown-1.5.0/src/test/resources/benchmark.text000066400000000000000000000176001247356127500216200ustar00rootroot00000000000000Markdown: Basics ================ 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 `

` and `

` 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:

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

### 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:

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.

## 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:
  • Candy.
  • Gum.
  • Booze.
Ordered (numbered) lists use regular numbers, followed by periods, as list markers: 1. Red 2. Green 3. Blue Output:
  1. Red
  2. Green
  3. Blue
If you put blank lines between items, you'll get `

` 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:

  • A list item.

    With multiple paragraphs.

  • Another item in the list.

### 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:

This is an example link.

Optionally, you may include a title attribute in the parentheses: This is an [example link](http://example.com/ "With a Title"). Output:

This is an example link.

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:

I get 10 times more traffic from Google than from Yahoo or MSN.

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:

I start my morning with a cup of coffee and The New York Times.

### Images ### Image syntax is very much like link syntax. Inline (titles are optional): ![alt text](/path/to/img.jpg "Title") Reference-style: ![alt text][id] [id]: /path/to/img.jpg "Title" Both of the above examples produce the same output: alt text ### 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 `` tags. I wish SmartyPants used named entities like `—` instead of decimal-encoded entites like `—`. Output:

I strongly recommend against using any <blink> tags.

I wish SmartyPants used named entities like &mdash; instead of decimal-encoded entites like &#8212;.

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:

For example.

Output:

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>
    
pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/000077500000000000000000000000001247356127500232545ustar00rootroot00000000000000pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Email_auto_links.html000066400000000000000000000011461247356127500274230ustar00rootroot00000000000000

michel.fortin@michelf.com

International domain names: help@tūdaliņ.lv

pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Email_auto_links.md000066400000000000000000000001141247356127500270510ustar00rootroot00000000000000 International domain names: pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Emphasis.html000066400000000000000000000035161247356127500257200ustar00rootroot00000000000000

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. ab
  2. ab
  3. abc
  4. ab
  5. ab
  6. abc

Middle-word emphasis (underscore):

  1. ab
  2. ab
  3. abc
  4. ab
  5. ab
  6. abc

mypreciousfile.txt

Tricky Cases

E**. Test TestTestTest

E**. Test Test Test Test

pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Emphasis.md000066400000000000000000000017331247356127500253530ustar00rootroot00000000000000Combined 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 pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Inline_HTML_(Span).html000066400000000000000000000002541247356127500273070ustar00rootroot00000000000000

ACINACS

SB SB

pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Inline_HTML_(Span).md000066400000000000000000000002361247356127500267430ustar00rootroot00000000000000ACINACS SB SBpegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Ins_and_del.md000066400000000000000000000004441247356127500257770ustar00rootroot00000000000000Here is a block tag ins:

Some text

And here it is inside a paragraph. And here it is in the middle of a paragraph.

Some text

And here is ins as a paragraph. And here it is in the middle of a paragraph. pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Ins_and_del.xhtml000066400000000000000000000005071247356127500265330ustar00rootroot00000000000000

Here is a block tag ins:

Some text

And here it is inside a paragraph.

And here it is in the middle of a paragraph.

Some text

And here is ins as a paragraph.

And here it is in the middle of a paragraph.

pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Links_inline_style.html000066400000000000000000000000771247356127500300040ustar00rootroot00000000000000

silly URL w/ angle brackets.

pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Links_inline_style.md000066400000000000000000000000531247356127500274320ustar00rootroot00000000000000[silly URL w/ angle brackets](). pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Nesting.html000066400000000000000000000003661247356127500255560ustar00rootroot00000000000000

Valid nesting:

Link

Link

Link

Invalid nesting:

[Link](url)

pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Nesting.md000066400000000000000000000001531247356127500252040ustar00rootroot00000000000000Valid nesting: **[Link](url)** [**Link**](url) **[**Link**](url)** Invalid nesting: [[Link](url)](url)pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Parens_in_URL.html000066400000000000000000000007301247356127500266020ustar00rootroot00000000000000

Inline link 1 with parens.

Inline link 2 with parens.

Inline link 3 with non-escaped parens.

Inline link 4 with non-escaped parens.

Reference link 1 with parens.

Reference link 2 with parens.

pegdown-1.5.0/src/test/resources/docs-php-markdown-todo/Parens_in_URL.md000066400000000000000000000005461247356127500262430ustar00rootroot00000000000000[Inline link 1 with parens](/url\(test\) "title"). [Inline link 2 with parens]( "title"). [Inline link 3 with non-escaped parens](/url(test) "title"). [Inline link 4 with non-escaped parens]( "title"). [Reference link 1 with parens][1]. [Reference link 2 with parens][2]. [1]: /url(test) "title" [2]: "title" pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/000077500000000000000000000000001247356127500230505ustar00rootroot00000000000000pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/auto_link.html000066400000000000000000000006131247356127500257230ustar00rootroot00000000000000

I can has autolink? http://icanhascheeseburger.com

Ask garfield: garfield@example.com

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/auto_link.md000066400000000000000000000001331247356127500253540ustar00rootroot00000000000000I can has autolink? Ask garfield: pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/auto_link_safe_mode.html000066400000000000000000000006131247356127500277250ustar00rootroot00000000000000

I can has autolink? http://icanhascheeseburger.com

Ask garfield: garfield@example.com

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/auto_link_safe_mode.md000066400000000000000000000001331247356127500273560ustar00rootroot00000000000000I can has autolink? Ask garfield: pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/auto_link_safe_mode.opts000066400000000000000000000000241247356127500277420ustar00rootroot00000000000000{'safe_mode': True} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/basic_safe_mode.html000066400000000000000000000001311247356127500270140ustar00rootroot00000000000000

blah [HTML_REMOVED] blah

[HTML_REMOVED]yowzer![HTML_REMOVED]

blah

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/basic_safe_mode.md000066400000000000000000000000721247356127500264540ustar00rootroot00000000000000blah blah
yowzer!
blah pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/basic_safe_mode.opts000066400000000000000000000001331247356127500270370ustar00rootroot00000000000000# Use the old (for-compat-only) way of specifying "replace" safe mode. {"safe_mode": True} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/basic_safe_mode_escape.html000066400000000000000000000001411247356127500303350ustar00rootroot00000000000000

blah <img src="dangerous"> blah

<div>yowzer!</div>

blah

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/basic_safe_mode_escape.md000066400000000000000000000000721247356127500277740ustar00rootroot00000000000000blah blah
yowzer!
blah pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/basic_safe_mode_escape.opts000066400000000000000000000000301247356127500303530ustar00rootroot00000000000000{"safe_mode": "escape"} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/blockquote.html000066400000000000000000000001771247356127500261130ustar00rootroot00000000000000

[Trent wrote]

no way

[Jeff wrote]

way

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/blockquote.md000066400000000000000000000000531247356127500255400ustar00rootroot00000000000000[Trent wrote] > no way [Jeff wrote] > way pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/blockquote_with_pre.html000066400000000000000000000003101247356127500300010ustar00rootroot00000000000000

Markdown indents blockquotes a couple of spaces necessitating some tweaks for pre-blocks in that blockquote:

here is a check
for that
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/blockquote_with_pre.md000066400000000000000000000002321247356127500274400ustar00rootroot00000000000000> Markdown indents blockquotes a couple of spaces > necessitating some tweaks for pre-blocks in that > blockquote: > > here is a check > for that pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/code_block_with_tabs.html000066400000000000000000000001761247356127500300720ustar00rootroot00000000000000

Test with tabs for _Detab:

Code    'block' with    some    "tabs"  and "quotes"
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/code_block_with_tabs.md000066400000000000000000000001121247356127500275140ustar00rootroot00000000000000Test with tabs for `_Detab`: Code 'block' with some "tabs" and "quotes" pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/code_safe_emphasis.html000066400000000000000000000002161247356127500275360ustar00rootroot00000000000000

This is italic and this is bold. This is NOT _italic_ and this is __bold__ because --code-safe is turned on.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/code_safe_emphasis.md000066400000000000000000000001631247356127500271730ustar00rootroot00000000000000This is *italic* and this is **bold**. This is NOT _italic_ and this is __bold__ because --code-safe is turned on. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/code_safe_emphasis.opts000066400000000000000000000000361247356127500275570ustar00rootroot00000000000000{"extras": ["code-friendly"]} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/codeblock.html000066400000000000000000000001551247356127500256640ustar00rootroot00000000000000
some code

some 'splaining

some more code
2 > 1
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/codeblock.md000066400000000000000000000000761247356127500253220ustar00rootroot00000000000000 some code some 'splaining some more code 2 > 1 pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/codespans.html000066400000000000000000000001431247356127500257130ustar00rootroot00000000000000

This is a code span. And This is one with an `embedded backtick`.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/codespans.md000066400000000000000000000001111247356127500253420ustar00rootroot00000000000000`This` is a code span. And ``This is one with an `embedded backtick` ``. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/codespans_safe_mode.html000066400000000000000000000001431247356127500277150ustar00rootroot00000000000000

This is a code span. And This is one with an `embedded backtick`.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/codespans_safe_mode.md000066400000000000000000000001111247356127500273440ustar00rootroot00000000000000`This` is a code span. And ``This is one with an `embedded backtick` ``. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/codespans_safe_mode.opts000066400000000000000000000000241247356127500277340ustar00rootroot00000000000000{'safe_mode': True} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/emacs_head_vars.html000066400000000000000000000002501247356127500270370ustar00rootroot00000000000000

This sentence talks about the Python __init__ method, which I'd rather not be interpreted as Markdown's strong.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/emacs_head_vars.md000066400000000000000000000002411247356127500264730ustar00rootroot00000000000000 This sentence talks about the Python __init__ method, which I'd rather not be interpreted as Markdown's strong. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/emacs_tail_vars.html000066400000000000000000000002761247356127500270770ustar00rootroot00000000000000

This sentence talks about the Python __init__ method, which I'd rather not be interpreted as Markdown's strong.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/emacs_tail_vars.md000066400000000000000000000002671247356127500265330ustar00rootroot00000000000000This sentence talks about the Python __init__ method, which I'd rather not be interpreted as Markdown's strong. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/emphasis.html000066400000000000000000000002021247356127500255410ustar00rootroot00000000000000

This is italic and this is bold. This is also italic and this is bold.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/emphasis.md000066400000000000000000000001231247356127500251770ustar00rootroot00000000000000This is *italic* and this is **bold**. This is also _italic_ and this is __bold__. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/escapes.html000066400000000000000000000000611247356127500253560ustar00rootroot00000000000000

**don't shout**

*don't emphasize*

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/escapes.md000066400000000000000000000000511247356127500250110ustar00rootroot00000000000000\*\*don't shout\*\* \*don't emphasize\* pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes.html000066400000000000000000000022541247356127500257610ustar00rootroot00000000000000

This is a para with a footnote.1

This is another para with a footnote2 in it. Actually it has two3 of them. No, three4.


  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" 

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes.md000066400000000000000000000005721247356127500254160ustar00rootroot00000000000000This 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" pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes.opts000066400000000000000000000000321247356127500257720ustar00rootroot00000000000000{"extras": ["footnotes"]} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes_letters.html000066400000000000000000000017541247356127500275270ustar00rootroot00000000000000

This is a para with a footnote.1

This is another para with a footnote2 in it. Actually it has two3 of them.


  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. 

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes_letters.md000066400000000000000000000005231247356127500271540ustar00rootroot00000000000000This 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. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes_letters.opts000066400000000000000000000000321247356127500275340ustar00rootroot00000000000000{"extras": ["footnotes"]} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes_markup.html000066400000000000000000000014421247356127500273360ustar00rootroot00000000000000

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. And some code:

    print "Hello, World!"
    

  2. This body has markup too, but doesn't end with a code block. 

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes_markup.md000066400000000000000000000004551247356127500267750ustar00rootroot00000000000000This 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. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes_markup.opts000066400000000000000000000000321247356127500273510ustar00rootroot00000000000000{"extras": ["footnotes"]} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes_safe_mode_escape.html000066400000000000000000000007251247356127500313040ustar00rootroot00000000000000

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> 

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes_safe_mode_escape.md000066400000000000000000000002711247356127500307340ustar00rootroot00000000000000This is a para with a footnote.[^1] [^1]: Here is the body of the footnote.
And here is the second para of the footnote.
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/footnotes_safe_mode_escape.opts000066400000000000000000000000611247356127500313160ustar00rootroot00000000000000{"safe_mode": "escape", "extras": ["footnotes"]} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/header.html000066400000000000000000000001111247356127500251570ustar00rootroot00000000000000

an h1

an h2

another h1

another h2

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/header.md000066400000000000000000000001001247356127500246110ustar00rootroot00000000000000# an h1 ## an h2 another h1 ========== another h2 ---------- pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/hr.html000066400000000000000000000001151247356127500243440ustar00rootroot00000000000000

Dashes:





---
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/hr.md000066400000000000000000000000521247356127500240000ustar00rootroot00000000000000Dashes: --- --- --- --- --- pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/img_in_link.html000066400000000000000000000004771247356127500262250ustar00rootroot00000000000000

This example from http://orestis.gr/en/blog/2007/05/28/python-markdown-problems/:

the google logo

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/img_in_link.md000066400000000000000000000003441247356127500256520ustar00rootroot00000000000000This example from : [![the google logo][logo]][google] [logo]: http://www.google.com/images/logo.gif [google]: http://www.google.com/ "click to visit Google.com" pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/inline_links.html000066400000000000000000000003571247356127500264210ustar00rootroot00000000000000

an inline link

a link "with" title

an inline image link

an image "with" title

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/inline_links.md000066400000000000000000000002071247356127500260470ustar00rootroot00000000000000an inline [link](/url/) a [link "with" title](/url/ "title") an inline ![image link](/url/) an ![image "with" title](/url/ "title") pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/issue2_safe_mode_borks_markup.html000066400000000000000000000002561247356127500317340ustar00rootroot00000000000000

Heading 2

blah [HTML_REMOVED]alert('this should be removed')[HTML_REMOVED] blah

[HTML_REMOVED]alert('as should this')[HTML_REMOVED]

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/issue2_safe_mode_borks_markup.md000066400000000000000000000001701247356127500313630ustar00rootroot00000000000000## Heading 2 blah **blah** pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/issue2_safe_mode_borks_markup.opts000066400000000000000000000000311247356127500317440ustar00rootroot00000000000000{"safe_mode": "replace"} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_defn_alt_title_delims.html000066400000000000000000000006301247356127500312640ustar00rootroot00000000000000

Alternative delimiters for link definitions are allowed -- as of Markdown 1.0.2, I think. Hence, this link and this link work too.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_defn_alt_title_delims.md000066400000000000000000000006141247356127500307220ustar00rootroot00000000000000Alternative 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) pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_patterns.html000066400000000000000000000002471247356127500266160ustar00rootroot00000000000000

Recipe 123 and Komodo bug 234 are related.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_patterns.md000066400000000000000000000000531247356127500262450ustar00rootroot00000000000000Recipe 123 and Komodo bug 234 are related. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_patterns.opts000066400000000000000000000003671247356127500266420ustar00rootroot00000000000000{"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"), ], } pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_patterns_double_hit.html000066400000000000000000000002721247356127500310120ustar00rootroot00000000000000

There once was a Mozilla bug 123 and a Komodo bug 123.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_patterns_double_hit.md000066400000000000000000000000671247356127500304500ustar00rootroot00000000000000There once was a Mozilla bug 123 and a Komodo bug 123. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_patterns_double_hit.opts000066400000000000000000000004061247356127500310320ustar00rootroot00000000000000{"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"), ], } pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_patterns_edge_cases.html000066400000000000000000000001451247356127500307550ustar00rootroot00000000000000

Blah 123 becomes a line with two underscores.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_patterns_edge_cases.md000066400000000000000000000000561247356127500304120ustar00rootroot00000000000000Blah 123 becomes a line with two underscores. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/link_patterns_edge_cases.opts000066400000000000000000000002061247356127500307740ustar00rootroot00000000000000{"extras": ["link-patterns"], "link_patterns": [ (re.compile("Blah\s+(\d+)", re.I), r"http://foo.com/blah_blah_blah/\1"), ], } pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/lists.html000066400000000000000000000002211247356127500250670ustar00rootroot00000000000000

count:

  • one
  • two
  • three

count in spanish:

  1. uno
  2. dos
  3. tres
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/lists.md000066400000000000000000000001061247356127500245250ustar00rootroot00000000000000count: * one * two * three count in spanish: 1. uno 2. dos 3. tres pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/mismatched_footnotes.html000066400000000000000000000012121247356127500301500ustar00rootroot00000000000000

This is sentence has a footnote foo1 and whamo[^whamo].

This is another para with a numbered footnote2.


  1. Here is the body of the footnote foo. 

  2. Here is the body of the footnote 6. 

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/mismatched_footnotes.md000066400000000000000000000003721247356127500276120ustar00rootroot00000000000000This 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. pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/mismatched_footnotes.opts000066400000000000000000000000321247356127500301700ustar00rootroot00000000000000{"extras": ["footnotes"]} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/missing_link_defn.html000066400000000000000000000001271247356127500274200ustar00rootroot00000000000000

This is a [missing link][missing] and a used link.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/missing_link_defn.md000066400000000000000000000001571247356127500270570ustar00rootroot00000000000000 This is a [missing link][missing] and a [used link][used]. [used]: http://foo.com [unused]: http://foo.com pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/nested_list.html000066400000000000000000000002661247356127500262570ustar00rootroot00000000000000

shopping list:

  • veggies
    • carrots
    • lettuce
  • fruits
    • oranges
    • apples
    • peaches
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/nested_list.md000066400000000000000000000001521247356127500257050ustar00rootroot00000000000000shopping list: - veggies + carrots + lettuce - fruits + oranges + apples + *peaches* pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/nested_list_safe_mode.html000066400000000000000000000002661247356127500302610ustar00rootroot00000000000000

shopping list:

  • veggies
    • carrots
    • lettuce
  • fruits
    • oranges
    • apples
    • peaches
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/nested_list_safe_mode.md000066400000000000000000000001521247356127500277070ustar00rootroot00000000000000shopping list: - veggies + carrots + lettuce - fruits + oranges + apples + *peaches* pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/nested_list_safe_mode.opts000066400000000000000000000000241247356127500302720ustar00rootroot00000000000000{'safe_mode': True} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/parens_in_url_4.html000066400000000000000000000001251247356127500270170ustar00rootroot00000000000000

Inline link 4 with non-escaped parens.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/parens_in_url_4.md000066400000000000000000000000771247356127500264610ustar00rootroot00000000000000[Inline link 4 with non-escaped parens]( "title"). pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/raw_html.html000066400000000000000000000001431247356127500255510ustar00rootroot00000000000000

Hi, there. blah

**ack**
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/raw_html.md000066400000000000000000000001261247356127500252060ustar00rootroot00000000000000 Hi, *there*. blah
**ack**
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/ref_links.html000066400000000000000000000001431247356127500257100ustar00rootroot00000000000000

Google is fast star.

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/ref_links.md000066400000000000000000000001301247356127500253400ustar00rootroot00000000000000[Google][] is fast ![star][]. [google]: http://www.google.com/ [star]: /img/star.png pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/sublist-para.html000066400000000000000000000012041247356127500263410ustar00rootroot00000000000000

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 ...

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/sublist-para.md000066400000000000000000000010231247356127500257740ustar00rootroot00000000000000Some 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 ... pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/syntax_color.html000066400000000000000000000020021247356127500264540ustar00rootroot00000000000000

Here is some sample code:

import sys
def main(argv=sys.argv):
    logging.basicConfig()
    log.info('hi')

and:

use 'zlib'
sub main(argv)
    puts 'hi'
end
pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/syntax_color.md000066400000000000000000000003311247356127500261130ustar00rootroot00000000000000Here 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 pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/syntax_color.opts000066400000000000000000000000331247356127500264770ustar00rootroot00000000000000{"extras": ["code-color"]} pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/tricky_anchors.html000066400000000000000000000006221247356127500267600ustar00rootroot00000000000000

with [brackets][] in text

with [[brackets][]] in text

full link [like](/this/) in text

full link to img like is ok

[only open bracket(/in/) text

only close bracket text](/url/)

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/tricky_anchors.md000066400000000000000000000004141247356127500264130ustar00rootroot00000000000000[with [brackets][] in text](/url/) [with [[brackets][]] in text](/url/ "a title") [full link [like](/this/) in text](/url/) [full link to img ![like](/this/) is ok](/url/) [only open [bracket(/in/) text](/url/ 'a title') [only close bracket](/in/) text](/url/) pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/underline_in_autolink.html000066400000000000000000000003471247356127500303230ustar00rootroot00000000000000

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

pegdown-1.5.0/src/test/resources/docs-pythonmarkdown2/underline_in_autolink.md000066400000000000000000000002241247356127500277510ustar00rootroot00000000000000Eric wrote up a (long) intro to writing UDL definitions a while back on his blog: pegdown-1.5.0/src/test/resources/emph-strong-test/000077500000000000000000000000001247356127500221745ustar00rootroot00000000000000pegdown-1.5.0/src/test/resources/emph-strong-test/test_1.html000066400000000000000000000000661247356127500242630ustar00rootroot00000000000000

Field-name: _my_text_plain contains underscores

pegdown-1.5.0/src/test/resources/emph-strong-test/test_1.md000066400000000000000000000000601247356127500237110ustar00rootroot00000000000000Field-name: _my_text_plain contains underscores pegdown-1.5.0/src/test/resources/emph-strong-test/test_10.html000066400000000000000000000007541247356127500243470ustar00rootroot00000000000000

A nested emphasize
A nested emphasize
A nested emphasize
A nested emphasize
A nested emphasize
A nested emphasize
A nested emphasize
A nested emphasize
A nested emphasize
A nested emphasize

pegdown-1.5.0/src/test/resources/emph-strong-test/test_10.md000066400000000000000000000003721247356127500237770ustar00rootroot00000000000000__A *nested* emphasize__ __A *nested* emphasize__ __A *nested* emphasize__ __A *nested* emphasize__ __A *nested* emphasize__ __A *nested* emphasize__ __A *nested* emphasize__ __A *nested* emphasize__ __A *nested* emphasize__ __A *nested* emphasize__ pegdown-1.5.0/src/test/resources/emph-strong-test/test_11.html000066400000000000000000000002461247356127500243440ustar00rootroot00000000000000

More nested nested nested nested nested nested nested nested emphasize

pegdown-1.5.0/src/test/resources/emph-strong-test/test_11.md000066400000000000000000000001331247356127500237730ustar00rootroot00000000000000__More *nested* *nested* *nested* *nested* *nested* *nested* *nested* *nested* emphasize__pegdown-1.5.0/src/test/resources/emph-strong-test/test_12.html000066400000000000000000000001361247356127500243430ustar00rootroot00000000000000

Multi-level nesting nesting nesting _nesting

pegdown-1.5.0/src/test/resources/emph-strong-test/test_12.md000066400000000000000000000000661247356127500240010ustar00rootroot00000000000000__Multi-level *nesting **nesting** nesting* _nesting__pegdown-1.5.0/src/test/resources/emph-strong-test/test_13.html000066400000000000000000000002071247356127500243430ustar00rootroot00000000000000

Blaa

**SELECT @default_late_fees =
CASE @default_days_out % @default_product_price_days_out

WHEN 0
THEN

pegdown-1.5.0/src/test/resources/emph-strong-test/test_13.md000066400000000000000000000002051247356127500237750ustar00rootroot00000000000000Blaa **SELECT @default_late_fees = CASE @default_days_out % @default_product_price_days_out
WHEN 0
THEN pegdown-1.5.0/src/test/resources/emph-strong-test/test_14.html000066400000000000000000000005441247356127500243500ustar00rootroot00000000000000

Blaa

SELECT @default_late_fees =
CASE @default_days_out % @default_product_price_days_out

WHEN 0
THEN (@default_days_out / @default_product_price_days_out) * @default_amount

ELSE (FLOOR(@default_days_out / @default_product_price_days_out) + 1) * @default_amount

END

Thanks,

S

pegdown-1.5.0/src/test/resources/emph-strong-test/test_14.md000066400000000000000000000005351247356127500240040ustar00rootroot00000000000000Blaa **SELECT @default_late_fees = CASE @default_days_out % @default_product_price_days_out
WHEN 0
THEN (@default_days_out / @default_product_price_days_out) * @default_amount
ELSE (FLOOR(@default_days_out / @default_product_price_days_out) + 1) * @default_amount
END** Thanks,
Spegdown-1.5.0/src/test/resources/emph-strong-test/test_15.html000066400000000000000000000003651247356127500243520ustar00rootroot00000000000000

s_o_m_e emph t_e_x_t_
some words on a new line
some o_t_h_e_r e_m_p t_e_xt
emphasized sentence
emphasized multi-
sentence

A _v_e_r_y strong sentence

pegdown-1.5.0/src/test/resources/emph-strong-test/test_15.md000066400000000000000000000002511247356127500240000ustar00rootroot00000000000000s_o_m_e _emph_ t_e_x_t_ some words on a new line some o_t_h_e_r _e_m_p_ t_e_xt _emphasized sentence_ _emphasized multi- sentence_ __A \_v_e_r_y *strong* sentence__pegdown-1.5.0/src/test/resources/emph-strong-test/test_16.html000066400000000000000000000010671247356127500243530ustar00rootroot00000000000000

Blah blah blah blah Blah blah blah blah Blah blah blah blah Blah blah blah blah Blah blah blah blah Blah blah blah blah Blah blah blah blah.
Blah Blah:
*Blah blah blah bla*h.
*Blah blah blah blah.
*Blah blah blah blah.
*Blah blah blah blah.
*Blah blah blah blah.
*Blah blah blah blah.
*Blah blah blah blah.
Blah blah blah blah:
*Blah blah blah bláh.
Blah blah:
*Blah blah blah blah.
*Blah blah blah blah.
*Blah blah blah blah.
*Blah blah blah blah.
*Blah blah blah blah.
*Blah blah blah blah

pegdown-1.5.0/src/test/resources/emph-strong-test/test_16.md000066400000000000000000000007551247356127500240120ustar00rootroot00000000000000Blah blah blah blah Blah blah blah blah Blah blah blah blah Blah blah blah blah Blah blah blah blah Blah blah blah blah Blah blah blah blah. Blah Blah: *Blah blah blah bla*h. *Blah blah blah blah. *Blah blah blah blah. *Blah blah blah blah. *Blah blah blah blah. *Blah blah blah blah. *Blah blah blah blah. Blah blah blah blah: *Blah blah blah bláh. Blah blah: *Blah blah blah blah. *Blah blah blah blah. *Blah blah blah blah. *Blah blah blah blah. *Blah blah blah blah. *Blah blah blah blah pegdown-1.5.0/src/test/resources/emph-strong-test/test_17.html000066400000000000000000000246241247356127500243600ustar00rootroot00000000000000

org.spoofax.interpreter.core.InterpreterException: Exception during evaluation
at org.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:117)
at org.spoofax.interpreter.core.Interpreter.invoke(Interpreter.java:82)
at org.strategoxt.HybridInterpreter.invoke(HybridInterpreter.java:424)
at org.strategoxt.imp.debug.core.str.launching.DebuggableHybridInterpreter.invoke(DebuggableHybridInterpreter.java:150)
at org.strategoxt.imp.runtime.services.StrategoObserver.invoke(StrategoObserver.java:701)
at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:750)
at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:741)
at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:726)
at org.strategoxt.imp.runtime.services.OnSaveService.invokeOnSave(OnSaveService.java:67)
at org.strategoxt.imp.runtime.services.OnSaveService.documentChanged(OnSaveService.java:58)
at org.eclipse.imp.editor.UniversalEditor.doSave(UniversalEditor.java:1939)
at org.eclipse.ui.texteditor.AbstractTextEditor$TextEditorSavable.doSave(AbstractTextEditor.java:7198)
at org.eclipse.ui.Saveable.doSave(Saveable.java:214)
at org.eclipse.ui.internal.SaveableHelper.doSaveModel(SaveableHelper.java:349)
at org.eclipse.ui.internal.SaveableHelper$3.run(SaveableHelper.java:195)
at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:277)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:759)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:756)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2649)
at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:285)
at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:264)
at org.eclipse.ui.internal.SaveableHelper.saveModels(SaveableHelper.java:207)
at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:144)
at org.eclipse.ui.internal.EditorManager.savePart(EditorManager.java:1399)
at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage.java:3429)
at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3442)
at org.eclipse.ui.internal.handlers.SaveHandler.execute(SaveHandler.java:54)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1100)
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1521)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4640)
at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4528)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2546)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3756)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: org.spoofax.interpreter.core.InterpreterErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’
1
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:194)
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183)
at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245)
at org.strategoxt.lang.InteropSDefT$StrategyBody.eval(InteropSDefT.java:238)
at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:76)
at org.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:109)
… 76 more
Caused by: org.strategoxt.lang.StrategoErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’
1
at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:60)
at org.strategoxt.lang.DynamicStrategy.invoke(DynamicStrategy.java:22)
at org.strategoxt.stratego_lib.dr_scope_1_1.invoke(dr_scope_1_1.java)
at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:41)
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192)
… 81 more
Caused by: org.spoofax.interpreter.core.InterpreterErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’
1
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:194)
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183)
at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245)
at org.strategoxt.lang.InteropSDefT$StrategyBody.eval(InteropSDefT.java:238)
at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:76)
at org.spoofax.interpreter.stratego.SDefT.evaluate(SDefT.java:213)
at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:57)
… 85 more
Caused by: org.strategoxt.lang.StrategoErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’
1
at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:60)
at org.strategoxt.lang.DynamicStrategy.invoke(DynamicStrategy.java:22)
at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:60)
at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21)
at org.strategoxt.lang.parallel.stratego_parallel.ParallelAll.invoke(ParallelAll.java:67)
at org.strategoxt.lang.compat.override.performance_tweaks.map_1_0_override.invoke(map_1_0_override.java)
at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:40)
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192)
… 91 more
Caused by: org.spoofax.interpreter.core.InterpreterErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’
1
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:194)
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183)
at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245)
at org.strategoxt.lang.InteropSDefT$StrategyBody.eval(InteropSDefT.java:238)
at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:76)
at org.spoofax.interpreter.stratego.SDefT.evaluate(SDefT.java:213)
at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:57)
… 98 more
Caused by: org.strategoxt.lang.StrategoErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’
1
at org.strategoxt.lang.compat.report_failure_compat_1_0.invoke(report_failure_compat_1_0.java:53)
at org.strategoxt.stratego_lib.report_with_failure_0_2.invoke(report_with_failure_0_2.java)
at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:32)
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192)
… 104 more
Internal error evaluating strategy editor-compile-multiple
report_with_failure_0_2
analyze_defs_0_4
analyze_child_defs_0_4
a_5300
origin_track_forced_1_0
analyze_defs_0_4
analyze_child_defs_0_4
a_5300
origin_track_forced_1_0
analyze_defs_0_4
analyze_defs_0_0
map_1_0
dr_scope_1_1
analyze_top_internal_0_4
analyze_top_0_4
analyze_top_0_1
basec_to_c_h_makefile_multiple_0_0
base_c_to_compiledc_multiple_0_0
editor_compile_multiple_0_0

pegdown-1.5.0/src/test/resources/emph-strong-test/test_17.md000066400000000000000000000234551247356127500240150ustar00rootroot00000000000000org.spoofax.interpreter.core.InterpreterException: Exception during evaluation at org.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:117) at org.spoofax.interpreter.core.Interpreter.invoke(Interpreter.java:82) at org.strategoxt.HybridInterpreter.invoke(HybridInterpreter.java:424) at org.strategoxt.imp.debug.core.str.launching.DebuggableHybridInterpreter.invoke(DebuggableHybridInterpreter.java:150) at org.strategoxt.imp.runtime.services.StrategoObserver.invoke(StrategoObserver.java:701) at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:750) at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:741) at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:726) at org.strategoxt.imp.runtime.services.OnSaveService.invokeOnSave(OnSaveService.java:67) at org.strategoxt.imp.runtime.services.OnSaveService.documentChanged(OnSaveService.java:58) at org.eclipse.imp.editor.UniversalEditor.doSave(UniversalEditor.java:1939) at org.eclipse.ui.texteditor.AbstractTextEditor$TextEditorSavable.doSave(AbstractTextEditor.java:7198) at org.eclipse.ui.Saveable.doSave(Saveable.java:214) at org.eclipse.ui.internal.SaveableHelper.doSaveModel(SaveableHelper.java:349) at org.eclipse.ui.internal.SaveableHelper$3.run(SaveableHelper.java:195) at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:277) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372) at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:759) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:756) at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2649) at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:285) at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:264) at org.eclipse.ui.internal.SaveableHelper.saveModels(SaveableHelper.java:207) at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:144) at org.eclipse.ui.internal.EditorManager.savePart(EditorManager.java:1399) at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage.java:3429) at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3442) at org.eclipse.ui.internal.handlers.SaveHandler.execute(SaveHandler.java:54) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1100) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1521) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4640) at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4528) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2546) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3756) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438) at org.eclipse.equinox.launcher.Main.main(Main.java:1414) Caused by: org.spoofax.interpreter.core.InterpreterErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’ 1 at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:194) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183) at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245) at org.strategoxt.lang.InteropSDefT$StrategyBody.eval(InteropSDefT.java:238) at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:76) at org.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:109) … 76 more Caused by: org.strategoxt.lang.StrategoErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’ 1 at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:60) at org.strategoxt.lang.DynamicStrategy.invoke(DynamicStrategy.java:22) at org.strategoxt.stratego_lib.dr_scope_1_1.invoke(dr_scope_1_1.java) at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:41) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192) … 81 more Caused by: org.spoofax.interpreter.core.InterpreterErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’ 1 at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:194) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183) at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245) at org.strategoxt.lang.InteropSDefT$StrategyBody.eval(InteropSDefT.java:238) at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:76) at org.spoofax.interpreter.stratego.SDefT.evaluate(SDefT.java:213) at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:57) … 85 more Caused by: org.strategoxt.lang.StrategoErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’ 1 at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:60) at org.strategoxt.lang.DynamicStrategy.invoke(DynamicStrategy.java:22) at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:60) at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21) at org.strategoxt.lang.parallel.stratego_parallel.ParallelAll.invoke(ParallelAll.java:67) at org.strategoxt.lang.compat.override.performance_tweaks.map_1_0_override.invoke(map_1_0_override.java) at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:40) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192) … 91 more Caused by: org.spoofax.interpreter.core.InterpreterErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’ 1 at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:194) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183) at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245) at org.strategoxt.lang.InteropSDefT$StrategyBody.eval(InteropSDefT.java:238) at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:76) at org.spoofax.interpreter.stratego.SDefT.evaluate(SDefT.java:213) at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:57) … 98 more Caused by: org.strategoxt.lang.StrategoErrorExit: Internal error: with clause failed unexpectedly in rule ‘analyze-defs’ 1 at org.strategoxt.lang.compat.report_failure_compat_1_0.invoke(report_failure_compat_1_0.java:53) at org.strategoxt.stratego_lib.report_with_failure_0_2.invoke(report_with_failure_0_2.java) at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:32) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192) … 104 more Internal error evaluating strategy editor-compile-multiple report_with_failure_0_2 analyze_defs_0_4 analyze_child_defs_0_4 a_5300 origin_track_forced_1_0 analyze_defs_0_4 analyze_child_defs_0_4 a_5300 origin_track_forced_1_0 analyze_defs_0_4 analyze_defs_0_0 map_1_0 dr_scope_1_1 analyze_top_internal_0_4 analyze_top_0_4 analyze_top_0_1 basec_to_c_h_makefile_multiple_0_0 base_c_to_compiledc_multiple_0_0 editor_compile_multiple_0_0pegdown-1.5.0/src/test/resources/emph-strong-test/test_18.html000066400000000000000000000000401247356127500243430ustar00rootroot00000000000000

par 1

par2

pegdown-1.5.0/src/test/resources/emph-strong-test/test_18.md000066400000000000000000000000151247356127500240010ustar00rootroot00000000000000par 1 _par2_pegdown-1.5.0/src/test/resources/emph-strong-test/test_19.html000066400000000000000000000000451247356127500243510ustar00rootroot00000000000000

strong _noemp

pegdown-1.5.0/src/test/resources/emph-strong-test/test_19.md000066400000000000000000000000211247356127500237770ustar00rootroot00000000000000__strong _noemp__pegdown-1.5.0/src/test/resources/emph-strong-test/test_2.html000066400000000000000000000001051247356127500242560ustar00rootroot00000000000000

Field-name: mytext_plain contains underscores

pegdown-1.5.0/src/test/resources/emph-strong-test/test_2.md000066400000000000000000000000611247356127500237130ustar00rootroot00000000000000Field-name: __my__text_plain contains underscorespegdown-1.5.0/src/test/resources/emph-strong-test/test_20.html000066400000000000000000000000541247356127500243410ustar00rootroot00000000000000

strong _emp strong__

pegdown-1.5.0/src/test/resources/emph-strong-test/test_20.md000066400000000000000000000000301247356127500237670ustar00rootroot00000000000000__strong _emp__ strong__pegdown-1.5.0/src/test/resources/emph-strong-test/test_21.html000066400000000000000000000000571247356127500243450ustar00rootroot00000000000000

emp strong emp

pegdown-1.5.0/src/test/resources/emph-strong-test/test_21.md000066400000000000000000000000241247356127500237730ustar00rootroot00000000000000_emp __strong__ emp_pegdown-1.5.0/src/test/resources/emph-strong-test/test_22.html000066400000000000000000000001651247356127500243460ustar00rootroot00000000000000

A title with emphasis

A title with emphasis

A title with emphasis

pegdown-1.5.0/src/test/resources/emph-strong-test/test_22.md000066400000000000000000000002041247356127500237740ustar00rootroot00000000000000A title with *emphasis* ======================= A title with *emphasis* ----------------------- #### A title with *emphasis* ####pegdown-1.5.0/src/test/resources/emph-strong-test/test_3.html000066400000000000000000000000741247356127500242640ustar00rootroot00000000000000

use the _.each or _.filter functions from underscore.

pegdown-1.5.0/src/test/resources/emph-strong-test/test_3.md000066400000000000000000000000661247356127500237210ustar00rootroot00000000000000use the _.each or _.filter functions from underscore.pegdown-1.5.0/src/test/resources/emph-strong-test/test_4.html000066400000000000000000000003301247356127500242600ustar00rootroot00000000000000

when things goes bad

commit dans la mauvaise branch
ex : j’ai commité dans master, au lieu de dev

1) merger
git checkout dev
git merge master

pegdown-1.5.0/src/test/resources/emph-strong-test/test_4.md000066400000000000000000000002571247356127500237240ustar00rootroot00000000000000when things goes bad ==================== commit dans la mauvaise branch ex : j'ai commité dans *master*, au lieu de *dev* 1) **merger** git checkout dev git merge master pegdown-1.5.0/src/test/resources/emph-strong-test/test_5.html000066400000000000000000000001631247356127500242650ustar00rootroot00000000000000

what does
github
do?

what does
_ github
do?

_what does
_github do?

pegdown-1.5.0/src/test/resources/emph-strong-test/test_5.md000066400000000000000000000001121247356127500237130ustar00rootroot00000000000000_what does github_ do? _what does _ github_ do? _what does _github do?pegdown-1.5.0/src/test/resources/emph-strong-test/test_6.html000066400000000000000000000001421247356127500242630ustar00rootroot00000000000000

A_1 A_2 A_3 A_4 A_5 A_6 A_7 A_8 A_9 A_0
B_1 B_2 B_3 B_4 B_5 B_6 B_7 B_8 B_9 B_0

pegdown-1.5.0/src/test/resources/emph-strong-test/test_6.md000066400000000000000000000001231247356127500237160ustar00rootroot00000000000000A_1 A_2 A_3 A_4 A_5 A_6 A_7 A_8 A_9 A_0 B_1 B_2 B_3 B_4 B_5 B_6 B_7 B_8 B_9 B_0

pegdown-1.5.0/src/test/resources/emph-strong-test/test_7.html000066400000000000000000000000571247356127500242710ustar00rootroot00000000000000

1
A strong sentence

pegdown-1.5.0/src/test/resources/emph-strong-test/test_7.md000066400000000000000000000000271247356127500237220ustar00rootroot000000000000001 __A strong sentence__pegdown-1.5.0/src/test/resources/emph-strong-test/test_8.html000066400000000000000000000000241247356127500242640ustar00rootroot00000000000000

An e

pegdown-1.5.0/src/test/resources/emph-strong-test/test_8.md000066400000000000000000000000061247356127500237200ustar00rootroot00000000000000_An e_pegdown-1.5.0/src/test/resources/emph-strong-test/test_9.html000066400000000000000000000000631247356127500242700ustar00rootroot00000000000000

A nested emphasize

pegdown-1.5.0/src/test/resources/emph-strong-test/test_9.md000066400000000000000000000000301247356127500237160ustar00rootroot00000000000000__A *nested* emphasize__pegdown-1.5.0/src/test/resources/pegdown/000077500000000000000000000000001247356127500204175ustar00rootroot00000000000000pegdown-1.5.0/src/test/resources/pegdown/Abbreviations.html000066400000000000000000000003231247356127500240730ustar00rootroot00000000000000

The HTML specification is maintained by the W3C.

Operation Tigra Genesis is going well.

pegdown-1.5.0/src/test/resources/pegdown/Abbreviations.md000066400000000000000000000002671247356127500235360ustar00rootroot00000000000000 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]: pegdown-1.5.0/src/test/resources/pegdown/AnchorLinks.html000066400000000000000000000005501247356127500235200ustar00rootroot00000000000000

Heading 1

Some text

Heading 1bis

Heading 2

Heading 三 with CJK 文字

pegdown-1.5.0/src/test/resources/pegdown/AnchorLinks.md000066400000000000000000000001361247356127500231540ustar00rootroot00000000000000Heading 1 ========== Some text # Heading 1bis ## Heading 2 ### Heading 三 with CJK 文字pegdown-1.5.0/src/test/resources/pegdown/AstText.ast000066400000000000000000000055571247356127500225400ustar00rootroot00000000000000RootNode [0-439] HeaderNode [0-11] AnchorLinkNode [2-10] 'Ast Test' ParaNode [12-53] SuperNode [12-50] TextNode [12-17] 'This ' StrongEmphSuperNode [17-21] TextNode [18-20] 'is' TextNode [21-24] ' a ' StrongEmphSuperNode [24-34] TextNode [26-32] 'simple' TextNode [34-35] ' ' SpecialTextNode [35-36] '&' TextNode [36-50] ' small text to' BlockQuoteNode [53-73] ParaNode [55-73] SuperNode [55-71] TextNode [55-59] 'test' SimpleNode [59-62] Linebreak TextNode [62-71] 'yes, test' ParaNode [73-95] SuperNode [73-93] TextNode [73-93] 'the functionality of' BulletListNode [95-201] ListItemNode [97-137] ParaNode [97-116] SuperNode [97-116] TextNode [97-115] 'AST index creation' RootNode [120-137] BulletListNode [120-137] ListItemNode [122-137] RootNode [122-137] SuperNode [122-137] TextNode [122-136] 'one more level' ListItemNode [144-177] RootNode [144-159] ParaNode [144-159] SuperNode [144-156] TextNode [144-156] 'nothing more' RootNode [162-177] VerbatimNode [162-177] 'Some code!\n' ListItemNode [180-200] RootNode [180-200] ParaNode [180-200] SuperNode [180-197] TextNode [180-185] 'multi' SimpleNode [185-186] Linebreak TextNode [186-197] ' paragraph' ParaNode [201-215] SuperNode [203-213] TextNode [203-212] 'list item' SpecialTextNode [212-213] '!' DefinitionListNode [215-293] DefinitionTermNode [215-220] TextNode [215-218] 'And' DefinitionNode [224-238] RootNode [224-238] SuperNode [224-238] TextNode [224-236] 'a definition' SpecialTextNode [236-237] '!' DefinitionTermNode [241-253] TextNode [241-252] 'Another one' DefinitionNode [257-294] ParaNode [257-267] SuperNode [257-267] TextNode [257-266] 'With more' RootNode [272-294] ParaNode [272-294] SuperNode [272-291] TextNode [272-290] 'than one paragraph' SpecialTextNode [290-291] '!' ParaNode [293-305] SuperNode [293-303] TextNode [293-303] 'Everything' VerbatimNode [305-336] 'is expected\nto be fine\n' ParaNode [341-355] SuperNode [341-353] TextNode [341-353] 'A Blockquote' BlockQuoteNode [355-377] ParaNode [357-366] SuperNode [357-361] TextNode [357-361] 'easy' ParaNode [366-377] SuperNode [366-375] TextNode [366-375] 'easy easy' ParaNode [377-412] SuperNode [377-410] TextNode [377-409] 'A code block starting with a tab' SpecialTextNode [409-410] ':' VerbatimNode [412-423] '> bla bla\n' ParaNode [424-439] SuperNode [424-437] TextNode [424-437] 'And more text' pegdown-1.5.0/src/test/resources/pegdown/AstText.md000066400000000000000000000006651247356127500223440ustar00rootroot00000000000000# Ast Test This _is_ a **simple** & small text to > test > yes, test the functionality of * AST index creation - one more level * nothing more Some code! * multi paragraph list item! And: ~ a definition! Another one : With more than one paragraph! Everything is expected to be fine A Blockquote > easy > > easy easy A code block starting with a tab: > bla bla And more textpegdown-1.5.0/src/test/resources/pegdown/AttributeWithUnderscore.html000066400000000000000000000001471247356127500261400ustar00rootroot00000000000000

Some text

then a div

Then some other text

pegdown-1.5.0/src/test/resources/pegdown/AttributeWithUnderscore.md000066400000000000000000000001311247356127500255650ustar00rootroot00000000000000Some text
then a div
Then some other textpegdown-1.5.0/src/test/resources/pegdown/Autolinks.html000066400000000000000000000015071247356127500232610ustar00rootroot00000000000000

Autolinks

Autolinks are simple URIs like http://www.parboiled.org,
which will be automatically “activated” by pegdown.

Here is an underlined http://github.com link.

pegdown tries to be smart and not include trailing
punctuation marks like commas and such in the email
and URI links (joe@somewhere.com is such an example).
ftp://somesite.org:1234: this would be another one!

The following links should work just normally:

pegdown-1.5.0/src/test/resources/pegdown/Autolinks.md000066400000000000000000000010111247356127500227030ustar00rootroot00000000000000# Autolinks Autolinks are simple URIs like http://www.parboiled.org, which will be automatically "activated" by pegdown. Here is an underlined http://github.com link. pegdown tries to be smart and not include trailing punctuation marks like commas and such in the email and URI links (joe@somewhere.com is such an example). ftp://somesite.org:1234: this would be another one! The following links should work just normally: * [example](http://example) * [ex@mple](http://example) * [example://](http://example)pegdown-1.5.0/src/test/resources/pegdown/Bug_in_0.8.5.1.html000066400000000000000000000001101247356127500233670ustar00rootroot00000000000000

All**F**ather wo**R**ld Order!

pegdown-1.5.0/src/test/resources/pegdown/Bug_in_0.8.5.1.md000066400000000000000000000000461247356127500230330ustar00rootroot00000000000000**A**ll**F**ather wo**R**ld **O**rder!pegdown-1.5.0/src/test/resources/pegdown/Bug_in_0.8.5.4.html000066400000000000000000000001071247356127500234000ustar00rootroot00000000000000
  • Hello World
    • Worwe qworijwetor
pegdown-1.5.0/src/test/resources/pegdown/Bug_in_0.8.5.4.md000066400000000000000000000000471247356127500230370ustar00rootroot00000000000000 * Hello World * Worwe qworijwetorpegdown-1.5.0/src/test/resources/pegdown/Bug_in_1.0.0.html000066400000000000000000000006331247356127500232260ustar00rootroot00000000000000

The following list contains items with code blocks:

  • List Item A

    
    This is a verbatim line
    and another one
    
    all of these should become
    part of the
    
    same verbatim block
    
    

    only these lines here

    
    should interrupt
    the
    
    verbatims blocks
    
    
  • another List Items

and something completely different here

pegdown-1.5.0/src/test/resources/pegdown/Bug_in_1.0.0.md000066400000000000000000000006161247356127500226630ustar00rootroot00000000000000The following list contains items with code blocks: * List Item A This is a verbatim line and another one all of these should become part of the same verbatim block only these lines here should interrupt the verbatims blocks * another List Items and something completely different herepegdown-1.5.0/src/test/resources/pegdown/Bug_in_1.1.0.html000066400000000000000000000002071247356127500232240ustar00rootroot00000000000000

This partial table crashed the ToHtmlSerializer in 1.1.0:

H1 h2
pegdown-1.5.0/src/test/resources/pegdown/Bug_in_1.1.0.md000066400000000000000000000001131247356127500226540ustar00rootroot00000000000000This partial table crashed the ToHtmlSerializer in 1.1.0: | H1 | h2| |-- pegdown-1.5.0/src/test/resources/pegdown/Emph_With_Linebreaks.html000066400000000000000000000001261247356127500253270ustar00rootroot00000000000000

A multi line paragraph broken with some line feeds onto several lines.

pegdown-1.5.0/src/test/resources/pegdown/Emph_With_Linebreaks.md000066400000000000000000000001101247356127500247540ustar00rootroot00000000000000*A multi line paragraph broken with some line feeds onto several lines.*pegdown-1.5.0/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.ast000066400000000000000000000022171247356127500252360ustar00rootroot00000000000000RootNode [0-786] ParaNode [0-22] SuperNode [0-20] TextNode [0-19] 'A fenced code block' SpecialTextNode [19-20] ':' VerbatimNode [22-99] 'class Example(name: String) {\n val field: Option[Int] = None\n}\n' ParaNode [100-148] SuperNode [100-146] TextNode [100-145] 'And another one, this time with an empty line' SpecialTextNode [145-146] ':' VerbatimNode [148-406] ' var model = ko.sync.Model({\n dataStore: store,\n dataTable: table,\n fields: {counter: 0}\n });\n\n var data = ko.sync.use({}, model);\n data.crud.isDirty(); // false\n data.counter(1);\n data.crud.isDirty(); // true\n' ParaNode [407-433] SuperNode [407-431] TextNode [407-430] 'and here is another one' SpecialTextNode [430-431] ':' VerbatimNode [433-786] 'public static String message(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {\n return CommonBundle.message(BUNDLE, key, params);\n}\n\npublic static String messageOrBlank(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {\n return CommonBundle.messageOrDefault(BUNDLE, key, "", params);\n}\n' pegdown-1.5.0/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.html000066400000000000000000000015741247356127500254200ustar00rootroot00000000000000

A fenced code block:


class Example(name: String) {
  val field: Option[Int] = None
}

And another one, this time with an empty line:


   var model = ko.sync.Model({
       dataStore: store,
       dataTable: table,
       fields: {counter: 0}
   });

   var data = ko.sync.use({}, model);
   data.crud.isDirty(); // false
   data.counter(1);
   data.crud.isDirty(); // true

and here is another one:


public static String message(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {
    return CommonBundle.message(BUNDLE, key, params);
}

public static String messageOrBlank(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {
    return CommonBundle.messageOrDefault(BUNDLE, key, "", params);
}

pegdown-1.5.0/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.md000066400000000000000000000014211247356127500250430ustar00rootroot00000000000000A fenced code block: ```scala class Example(name: String) { val field: Option[Int] = None } ``` And another one, this time with an empty line: ```javascript var model = ko.sync.Model({ dataStore: store, dataTable: table, fields: {counter: 0} }); var data = ko.sync.use({}, model); data.crud.isDirty(); // false data.counter(1); data.crud.isDirty(); // true ``` and here is another one: ```java public static String message(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) { return CommonBundle.message(BUNDLE, key, params); } public static String messageOrBlank(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) { return CommonBundle.messageOrDefault(BUNDLE, key, "", params); } ```pegdown-1.5.0/src/test/resources/pegdown/GFM_Fenced_Code_Blocks_reversed_all.html000066400000000000000000000016321247356127500301420ustar00rootroot00000000000000

A fenced code block:



}
enoN = ]tnI[noitpO :dleif lav  
{ )gnirtS :eman(elpmaxE ssalc

And another one, this time with an empty line:



eurt // ;)(ytriDsi.durc.atad   
;)1(retnuoc.atad   
eslaf // ;)(ytriDsi.durc.atad   
;)ledom ,}{(esu.cnys.ok = atad rav   

;)}   
}0 :retnuoc{ :sdleif       
,elbat :elbaTatad       
,erots :erotSatad       
{(ledoM.cnys.ok = ledom rav   

and here is another one:



}
;)smarap ,"" ,yek ,ELDNUB(tluafeDrOegassem.eldnuBnommoC nruter    
{ )smarap ...tcejbO ,yek gnirtS )EMAN_ELDNUB = eldnuBecruoser(yeKytreporP@(knalBrOegassem gnirtS citats cilbup

}
;)smarap ,yek ,ELDNUB(egassem.eldnuBnommoC nruter    
{ )smarap ...tcejbO ,yek gnirtS )EMAN_ELDNUB = eldnuBecruoser(yeKytreporP@(egassem gnirtS citats cilbup

pegdown-1.5.0/src/test/resources/pegdown/GFM_Fenced_Code_Blocks_reversed_scala.html000066400000000000000000000016061247356127500304560ustar00rootroot00000000000000

A fenced code block:



}
enoN = ]tnI[noitpO :dleif lav  
{ )gnirtS :eman(elpmaxE ssalc

And another one, this time with an empty line:


   var model = ko.sync.Model({
       dataStore: store,
       dataTable: table,
       fields: {counter: 0}
   });

   var data = ko.sync.use({}, model);
   data.crud.isDirty(); // false
   data.counter(1);
   data.crud.isDirty(); // true

and here is another one:


public static String message(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {
    return CommonBundle.message(BUNDLE, key, params);
}

public static String messageOrBlank(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {
    return CommonBundle.messageOrDefault(BUNDLE, key, "", params);
}

pegdown-1.5.0/src/test/resources/pegdown/HTML suppression.md000066400000000000000000000002651247356127500240630ustar00rootroot00000000000000HTML SUPPRESSION ======================= This is a paragraph containing a strong inline HTML element and:

an actual block of HTML!

pegdown-1.5.0/src/test/resources/pegdown/Linebreaks.html000066400000000000000000000003441247356127500233650ustar00rootroot00000000000000

Linebreaks

With the HARDWRAPS extension
enabled all these linebreaks
should be kept as is in the
created HTML

These ones here
as
well!

pegdown-1.5.0/src/test/resources/pegdown/Linebreaks.md000066400000000000000000000002241247356127500230160ustar00rootroot00000000000000Linebreaks ========== With the HARDWRAPS extension enabled all these linebreaks should be kept as is in the created HTML These ones here as well! pegdown-1.5.0/src/test/resources/pegdown/No Follow Links.html000066400000000000000000000012511247356127500241440ustar00rootroot00000000000000

No Follow Links

Autolinks are simple URIs like http://www.parboiled.org, which will be automatically “activated” by pegdown.

pegdown tries to be smart and not include trailing punctuation marks like commas and such in the email and URI links (joe@somewhere.com is such an example). ftp://somesite.org:1234: this would be another one!

This is a regular link and this one here is a reference link.

pegdown-1.5.0/src/test/resources/pegdown/No Follow Links.md000066400000000000000000000007201247356127500236000ustar00rootroot00000000000000# No Follow Links Autolinks are simple URIs like http://www.parboiled.org, which will be automatically "activated" by pegdown. pegdown tries to be smart and not include trailing punctuation marks like commas and such in the email and URI links (joe@somewhere.com is such an example). ftp://somesite.org:1234: this would be another one! This is a [regular](http://regular.com) link and [this one here][] is a reference link. [this one here]: http://blabla.compegdown-1.5.0/src/test/resources/pegdown/Parens_in_URL.html000066400000000000000000000004541247356127500237500ustar00rootroot00000000000000

Inline link 1 with parens.

Inline link 2 with parens.

Reference link 1 with parens.

Reference link 2 with parens.

pegdown-1.5.0/src/test/resources/pegdown/Parens_in_URL.md000066400000000000000000000003501247356127500233770ustar00rootroot00000000000000[Inline link 1 with parens](/url\(test\) "title"). [Inline link 2 with parens]( "title"). [Reference link 1 with parens][1]. [Reference link 2 with parens][2]. [1]: /url(test) "title" [2]: "title" pegdown-1.5.0/src/test/resources/pegdown/Plugins.html000066400000000000000000000001521247356127500227240ustar00rootroot00000000000000
A block plugin

An inline plugin

pegdown-1.5.0/src/test/resources/pegdown/Plugins.md000066400000000000000000000000521247356127500223570ustar00rootroot00000000000000%%% A block plugin %%% %An inline plugin%pegdown-1.5.0/src/test/resources/pegdown/Quoted Blockquote.html000066400000000000000000000001221247356127500246320ustar00rootroot00000000000000
> Line A
> Line B
>
> Line after blank line.
pegdown-1.5.0/src/test/resources/pegdown/Quoted Blockquote.md000066400000000000000000000001011247356127500242630ustar00rootroot00000000000000 > Line A > Line B > > Line after blank line. pegdown-1.5.0/src/test/resources/pegdown/Smartypants.html000066400000000000000000000016101247356127500236300ustar00rootroot00000000000000

Smart quotes, ellipses, dashes

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

‘A’, ‘B’, and ‘C’ are letters.

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

‘He said, “I want to go.”’
Were you alive in the 70’s?

Here is some quoted ‘code’ and a “[quoted link][1]”.

I’ve alwayed thought I’d rather not do it. But then we’re all screwed, since I’m the only one!

Some dashes: one—two — three–four – five.

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

Ellipses…and…and … .

pegdown-1.5.0/src/test/resources/pegdown/Smartypants.md000066400000000000000000000010011247356127500232560ustar00rootroot00000000000000# Smart quotes, ellipses, dashes "Hello," said the spider. "'Shelob' is my name." 'A', 'B', and 'C' are letters. 'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.' 'He said, "I want to go."' Were you alive in the 70's? Here is some quoted '`code`' and a "[quoted link][1]". I've alwayed thought I'd rather not do it. But then we're all screwed, since I'm the only one! Some dashes: one---two --- three--four -- five. Dashes between numbers: 5-7, 255-66, 1987-1999. Ellipses...and. . .and . . . .pegdown-1.5.0/src/test/resources/pegdown/Special Chars.html000066400000000000000000000010401247356127500237010ustar00rootroot00000000000000

Special character handling

Quote from http://henkelmann.eu/2011/01/06/actuarius_release_note

Better handling of escapes than PegDown: PegDown does not escape special HTML characters like <, >, &, " and ' in normal text paragraphs, just in code blocks.

Maybe if>they are&not "stand-alone"?

Well, I don't think so :) (at least not as of pegdown 0.9.2!)

Here is a simple \ that should be left alone

pegdown-1.5.0/src/test/resources/pegdown/Special Chars.md000066400000000000000000000006421247356127500233440ustar00rootroot00000000000000# Special character handling Quote from Better handling of escapes than PegDown: PegDown does not escape special HTML characters like <, >, &, " and ' in normal text paragraphs, just in code blocks. Maybe if>they are¬ "stand-alone"? Well, I don't think so :) (at least not as of **pegdown 0.9.2**!) Here is a simple \ that should be left alonepegdown-1.5.0/src/test/resources/pegdown/Strikethrough.html000066400000000000000000000002161247356127500241460ustar00rootroot00000000000000

Strikethrough

Strikethrough should turn this into this

pegdown-1.5.0/src/test/resources/pegdown/Strikethrough.md000066400000000000000000000001111247356127500235740ustar00rootroot00000000000000# Strikethrough Strikethrough should turn ~~this~~ into this pegdown-1.5.0/src/test/resources/pegdown/Tables.html000066400000000000000000000036261247356127500225260ustar00rootroot00000000000000

Tables

Simple Table:

First Second
Cool Shit
this is the caption

Without header:

Cool Shit
is this really

With some alignment:

Cool Shit in here

And now to some colspan:

Names
Name Firstname Age
Fox Peter 42
Guy Ritchie ca. 60

Multimarkdown example:

Grouping
First Header Second Header Third Header
Content Long Cell
Content Cell Cell
New section More Data
And more And more
this is the caption
pegdown-1.5.0/src/test/resources/pegdown/Tables.md000066400000000000000000000013621247356127500221550ustar00rootroot00000000000000Tables ------ Simple Table: First | Second ------|------- Cool | Shit [this is the caption] Without header: |--------|-------| |Cool | Shit | |is this | really With some alignment: :-----|-----:|----|:---: Cool | Shit | in | here And now to some colspan: Names || Name | Firstname | Age ------|-----------|----: Fox | Peter | 42 Guy | Ritchie | ca. 60 Multimarkdown example: | | Grouping || First Header | Second Header | Third Header | ------------ | :-----------: | -----------: | Content | *Long Cell* || Content | **Cell** | Cell | New section | More | Data | And more | | And more | [this is the caption] pegdown-1.5.0/src/test/resources/pegdown/Wikilinks.html000066400000000000000000000010611247356127500232470ustar00rootroot00000000000000

Wikilinks

Wikilinks are simple URIs like Autolinks,
which will be converted by pegdown.

Another example with spaces: Special Chars,
with square brackets: [Square]Brackets.

The following links should work just normally:

pegdown-1.5.0/src/test/resources/pegdown/Wikilinks.md000066400000000000000000000005041247356127500227040ustar00rootroot00000000000000# Wikilinks Wikilinks are simple URIs like [[Autolinks]], which will be converted by pegdown. Another example with spaces: [[Special Chars]], with square brackets: [[[Square]Brackets]]. The following links should work just normally: * [example](http://example) * [ex@mple](http://example) * [example://](http://example) pegdown-1.5.0/src/test/resources/textmarkdown/000077500000000000000000000000001247356127500215035ustar00rootroot00000000000000pegdown-1.5.0/src/test/resources/textmarkdown/CoreDumps5.8.md000066400000000000000000000000651247356127500241620ustar00rootroot00000000000000* Unordered 1. Ordered Text * Unordered 1. Ordered pegdown-1.5.0/src/test/resources/textmarkdown/CoreDumps5.8.xhtml000066400000000000000000000002021247356127500247070ustar00rootroot00000000000000
  • Unordered
    1. Ordered

Text

  • Unordered
    1. Ordered
pegdown-1.5.0/src/test/resources/textmarkdown/Emphasis.md000066400000000000000000000002621247356127500235760ustar00rootroot00000000000000_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).. pegdown-1.5.0/src/test/resources/textmarkdown/Emphasis.xhtml000066400000000000000000000003071247356127500243320ustar00rootroot00000000000000

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)..

pegdown-1.5.0/src/test/resources/textmarkdown/HTML-Comment-encoding.md000066400000000000000000000004271247356127500257600ustar00rootroot00000000000000A 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

pegdown-1.5.0/src/test/resources/textmarkdown/HTML-Comment-encoding.xhtml000066400000000000000000000004601247356127500265110ustar00rootroot00000000000000

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

pegdown-1.5.0/src/test/resources/textmarkdown/HTML5-attributes.html000066400000000000000000000001521247356127500254040ustar00rootroot00000000000000

foo

this is a paragraph

an h2

normal

pegdown-1.5.0/src/test/resources/textmarkdown/HTML5-attributes.md000066400000000000000000000001431247356127500250400ustar00rootroot00000000000000

foo

this is a paragraph

an h2

normal pegdown-1.5.0/src/test/resources/textmarkdown/Links_brackets.md000066400000000000000000000001671247356127500247670ustar00rootroot00000000000000[ZIP archives](http://en.wikipedia.org/wiki/ZIP_(file_format) "ZIP (file format) - Wikipedia, the free encyclopedia") pegdown-1.5.0/src/test/resources/textmarkdown/Links_brackets.xhtml000066400000000000000000000002161247356127500255160ustar00rootroot00000000000000

ZIP archives

pegdown-1.5.0/src/test/resources/textmarkdown/Links_multiline_bugs_1.html000066400000000000000000000001741247356127500267750ustar00rootroot00000000000000

http://bugs.debian.org/459885

link text

pegdown-1.5.0/src/test/resources/textmarkdown/Links_multiline_bugs_1.md000066400000000000000000000001161247356127500264250ustar00rootroot00000000000000 [link text] [link id] [link id]: /someurl/ pegdown-1.5.0/src/test/resources/textmarkdown/Links_multiline_bugs_2.html000066400000000000000000000003141247356127500267720ustar00rootroot00000000000000

http://bugs.debian.org/459885

Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is my
University
.

pegdown-1.5.0/src/test/resources/textmarkdown/Links_multiline_bugs_2.md000066400000000000000000000002311247356127500264240ustar00rootroot00000000000000 Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is [my University][]. [my university]: http://www.ua.es pegdown-1.5.0/src/test/resources/textmarkdown/Links_reference_style.md000066400000000000000000000021331247356127500263420ustar00rootroot00000000000000Foo [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.espegdown-1.5.0/src/test/resources/textmarkdown/Links_reference_style.xhtml000066400000000000000000000027311247356127500271020ustar00rootroot00000000000000

Foo bar.

Foo bar.

Foo bar.

With embedded [brackets].

Indented once.

Indented twice.

Indented thrice.

Indented [four][] times.

[four]: /url

this should work

So should 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 points to something else.

Backslashing should suppress [this] and [this].


Here's one where the link breaks across lines.

Here's another where the link breaks across lines, but with a line-ending space.

More multi line edge cases. First a broken link id

link text

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
.

pegdown-1.5.0/src/test/resources/textmarkdown/Lists-multilevel-md5-edgecase.md000066400000000000000000000002221247356127500275200ustar00rootroot00000000000000# text1 * text2 * text3 text4 ## text5 * text6 * text7 text8 ## text9 * text10 * text11 text12 text13 pegdown-1.5.0/src/test/resources/textmarkdown/Lists-multilevel-md5-edgecase.xhtml000066400000000000000000000004421247356127500302600ustar00rootroot00000000000000

text1

  • text2

    • text3

    text4

text5

  • text6

    • text7

    text8

text9

  • text10

    • text11

    text12

    text13

pegdown-1.5.0/src/test/resources/textmarkdown/PHP-ASP_tags.md000066400000000000000000000003171247356127500241140ustar00rootroot00000000000000I 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 %> [% template_toolkit %]pegdown-1.5.0/src/test/resources/textmarkdown/PHP-ASP_tags.xhtml000066400000000000000000000003451247356127500246510ustar00rootroot00000000000000

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 %>

[% template_toolkit %]

pegdown-1.5.0/src/test/resources/textmarkdown/Unicode.md000066400000000000000000000000451247356127500234120ustar00rootroot00000000000000> Fo—o μορεοϋερ > ßåř pegdown-1.5.0/src/test/resources/textmarkdown/Unicode.xhtml000066400000000000000000000001601247356127500241440ustar00rootroot00000000000000

Fo—o

μορεοϋερ

ßåř

pegdown-1.5.0/src/test/scala/000077500000000000000000000000001247356127500160255ustar00rootroot00000000000000pegdown-1.5.0/src/test/scala/org/000077500000000000000000000000001247356127500166145ustar00rootroot00000000000000pegdown-1.5.0/src/test/scala/org/pegdown/000077500000000000000000000000001247356127500202575ustar00rootroot00000000000000pegdown-1.5.0/src/test/scala/org/pegdown/AbstractPegDownSpec.scala000066400000000000000000000054541247356127500251360ustar00rootroot00000000000000package org.pegdown import java.io.{StringWriter, StringReader} import org.specs2.matcher.MatchResult import org.specs2.mutable.Specification import org.w3c.tidy.Tidy import org.parboiled.common.FileUtils import org.parboiled.support.ToStringFormatter import org.parboiled.trees.GraphUtils import ast.Node abstract class AbstractPegDownSpec extends Specification { def test(testName: String)(implicit processor: PegDownProcessor): MatchResult[String] = { implicit val htmlSerializer = new ToHtmlSerializer(new LinkRenderer) testWithSerializer(testName) } def test(testName: String, expectedOutput: String, htmlSerializer: ToHtmlSerializer = null) (implicit processor: PegDownProcessor): MatchResult[String] = { val markdown = FileUtils.readAllCharsFromResource(testName + ".md") require(markdown != null, "Test '" + testName + "' not found") val astRoot = processor.parseMarkdown(markdown) val actualHtml = Option(htmlSerializer).getOrElse(new ToHtmlSerializer(new LinkRenderer)).toHtml(astRoot) // debugging I: check the parse tree //assertEquals(printNodeTree(getProcessor().parser.parseToParsingResult(markdown)), ""); // debugging II: check the AST // GraphUtils.printTree(astRoot, new ToStringFormatter[Node]) === "" // debugging III: check the actual (untidied) HTML // actualHtml === "" // tidy up html for fair equality test val tidyHtml = tidy(actualHtml) normalize(tidyHtml) === normalize(expectedOutput) } def testWithSerializer(testName: String)(implicit processor: PegDownProcessor, htmlSerializer: ToHtmlSerializer) = { val expectedUntidy = FileUtils.readAllTextFromResource(testName + ".html") require(expectedUntidy != null, "Test '" + testName + "' not found") test(testName, tidy(expectedUntidy), htmlSerializer) } def testAST(testName: String)(implicit processor: PegDownProcessor) = { val markdown = FileUtils.readAllCharsFromResource(testName + ".md") require(markdown != null, "Test '" + testName + "' not found") val expectedAst = FileUtils.readAllTextFromResource(testName + ".ast") require(expectedAst != null, "Expected AST for '" + testName + "' not found") val astRoot = processor.parseMarkdown(markdown) // check parse tree //assertEquals(printNodeTree(getProcessor().parser.parseToParsingResult(markdown)), ""); normalize(GraphUtils.printTree(astRoot, new ToStringFormatter[Node]())) === normalize(expectedAst) } def tidy(html: String) = { val in = new StringReader(html) val out = new StringWriter val t = new Tidy t.setTabsize(4) t.setPrintBodyOnly(true) t.setShowWarnings(false) t.setQuiet(true) t.parse(in, out) out.toString } def normalize(string: String) = string.replace("\r\n", "\n").replace("\r", "\n") } pegdown-1.5.0/src/test/scala/org/pegdown/EmphStrongSpec.scala000066400000000000000000000021371247356127500241700ustar00rootroot00000000000000package org.pegdown import Extensions._ class EmphStrongSpec extends AbstractPegDownSpec { "The PegDownProcessor" should { "pass all tests in the EmphStrong test suite" in { implicit val processor = new PegDownProcessor(ALL & ~ANCHORLINKS) test("emph-strong-test/test_1") test("emph-strong-test/test_2") test("emph-strong-test/test_3") test("emph-strong-test/test_4") test("emph-strong-test/test_5") test("emph-strong-test/test_6") test("emph-strong-test/test_7") test("emph-strong-test/test_8") test("emph-strong-test/test_9") test("emph-strong-test/test_10") test("emph-strong-test/test_11") test("emph-strong-test/test_12") test("emph-strong-test/test_13") test("emph-strong-test/test_14") test("emph-strong-test/test_15") test("emph-strong-test/test_16") test("emph-strong-test/test_17") test("emph-strong-test/test_18") test("emph-strong-test/test_19") test("emph-strong-test/test_20") test("emph-strong-test/test_21") test("emph-strong-test/test_22") } } } pegdown-1.5.0/src/test/scala/org/pegdown/Markdown103Spec.scala000066400000000000000000000032721247356127500241110ustar00rootroot00000000000000package org.pegdown import Extensions._ class Markdown103Spec extends AbstractPegDownSpec { "The PegDownProcessor" should { "pass the Markdown test suite" in { def runMarkdownTestSuite(implicit processor: PegDownProcessor) = { test("MarkdownTest103/Amps and angle encoding") test("MarkdownTest103/Auto links") test("MarkdownTest103/Backslash escapes") test("MarkdownTest103/Blockquotes with code blocks") test("MarkdownTest103/Code Blocks") test("MarkdownTest103/Code Spans") test("MarkdownTest103/Hard-wrapped paragraphs with list-like lines") test("MarkdownTest103/Horizontal rules") test("MarkdownTest103/Inline HTML (Advanced)") test("MarkdownTest103/Inline HTML (Simple)") test("MarkdownTest103/Inline HTML comments") test("MarkdownTest103/Links, inline style") test("MarkdownTest103/Links, reference style") test("MarkdownTest103/Links, shortcut references") test("MarkdownTest103/Literal quotes in titles") test("MarkdownTest103/Nested blockquotes") test("MarkdownTest103/Ordered and unordered lists") test("MarkdownTest103/Strong and em together") test("MarkdownTest103/Tabs") test("MarkdownTest103/Tidyness") test("MarkdownTest103/Markdown Documentation - Basics") test("MarkdownTest103/Markdown Documentation - Syntax") } "without any enabled extensions" in { runMarkdownTestSuite(new PegDownProcessor()) } "with most extensions enabled" in { runMarkdownTestSuite { new PegDownProcessor(ALL & ~SMARTYPANTS & ~HARDWRAPS & ~ANCHORLINKS) } } } } } pegdown-1.5.0/src/test/scala/org/pegdown/MarukuSpec.scala000066400000000000000000000034351247356127500233500ustar00rootroot00000000000000package org.pegdown import Extensions._ class MarukuSpec extends AbstractPegDownSpec { "The PegDownProcessor" should { "pass selected parts of the Maruku test suite" in { implicit val processor = new PegDownProcessor(ALL & ~HARDWRAPS & ~ANCHORLINKS) test("Maruku/abbreviations") test("Maruku/alt") test("Maruku/blank") test("Maruku/blanks_in_code") // test("Maruku/bug_def") // test("Maruku/bug_table") test("Maruku/code") test("Maruku/code2") test("Maruku/code3") test("Maruku/data_loss") test("Maruku/easy") test("Maruku/email") test("Maruku/entities") test("Maruku/escaping") // test("Maruku/extra_dl") // test("Maruku/extra_header_id") test("Maruku/extra_table1") // test("Maruku/footnotes") test("Maruku/headers") test("Maruku/hex_entities") // test("Maruku/hrule") // test("Maruku/html2") test("Maruku/html3") // test("Maruku/html4") // test("Maruku/html5") // test("Maruku/ie") test("Maruku/images") test("Maruku/images2") //test("Maruku/inline_html") //test("Maruku/inline_html2") test("Maruku/links") test("Maruku/list1") test("Maruku/list2") test("Maruku/list3") //test("Maruku/list4") test("Maruku/lists") //test("Maruku/lists11") test("Maruku/lists6") //test("Maruku/lists7") test("Maruku/lists7b") test("Maruku/lists8") //test("Maruku/lists9") //test("Maruku/lists_after_paragraph") test("Maruku/lists_ol") //test("Maruku/loss") //test("Maruku/misc_sw") test("Maruku/olist") test("Maruku/one") test("Maruku/paragraph") test("Maruku/paragraphs") test("Maruku/smartypants") } } } pegdown-1.5.0/src/test/scala/org/pegdown/PathologicalInputSpec.scala000066400000000000000000000030141247356127500255230ustar00rootroot00000000000000package org.pegdown import Extensions._ class PathologicalInputSpec extends AbstractPegDownSpec { "The PegDownProcessor" should { "properly parse pathological input example 1" in { // this test took about 30 seconds to complete in 0.8.5.4 new PegDownProcessor(SMARTYPANTS | AUTOLINKS, 1000).markdownToHtml { """ |
Your action Partner's action Your jail time Partner's jail time |
silent silent 1 1 |
silent confess 5 0 |
confess silent 0 5 |
|""".stripMargin } mustNotEqual null } "properly parse pathological input example 2" in { // this test took about 30 seconds to complete in 1.0.2 new PegDownProcessor(SMARTYPANTS | AUTOLINKS, 1000).markdownToHtml { "***a*** ***b*** ***c*** ***d*** ***e*** ***f*** ***g*** ***h*** ***i*** ***f*** " + "***g*** ***h*** ***i*** ***j*** ***k*** ***l*** ***m*** ***n*** ***o*** ***p***" } mustNotEqual null } "properly parse pathological input example 3" in { new PegDownProcessor(200l).markdownToHtml { "how about a new method thats getObjectIdOrAdjustmentGroup? That w[a[[[[[[[[[[[[[[[[[y we're more explicit" + " and still benefit callers from having to do the iff dance" } must throwA[org.parboiled.errors.ParserRuntimeException] } } } pegdown-1.5.0/src/test/scala/org/pegdown/PegDownSpec.scala000066400000000000000000000132521247356127500234450ustar00rootroot00000000000000package org.pegdown import ast.{Visitor, Node} import org.parboiled.Parboiled import Extensions._ import org.pegdown.ast.VerbatimNode import org.parboiled.common.FileUtils import java.util.Collections import scala.collection.immutable.HashMap import plugins.{ToHtmlSerializerPlugin, PegDownPlugins} class PegDownSpec extends AbstractPegDownSpec { "The PegDownProcessor" should { "pass the custom pegdown tests for all extensions" in { def runSuite(implicit processor: PegDownProcessor) = { test("pegdown/Abbreviations") test("pegdown/AttributeWithUnderscore") test("pegdown/AnchorLinks") test("pegdown/Autolinks") test("pegdown/Bug_in_0.8.5.1") test("pegdown/Bug_in_0.8.5.4") test("pegdown/Bug_in_1.0.0") test("pegdown/Bug_in_1.1.0") test("pegdown/GFM_Fenced_Code_Blocks") test("pegdown/Linebreaks") test("pegdown/Parens_in_URL") test("pegdown/Quoted Blockquote") test("pegdown/Smartypants") test("pegdown/Strikethrough") test("pegdown/Tables") test("pegdown/Wikilinks") testAST("pegdown/AstText") testAST("pegdown/GFM_Fenced_Code_Blocks") } "with the default parser" in { runSuite(new PegDownProcessor(ALL)) } "with a custom parser" in { runSuite(new PegDownProcessor(Parboiled.createParser[CustomParser, AnyRef](classOf[CustomParser]))) } } "pass the custom pegdown tests for no extensions" in { implicit val processor = new PegDownProcessor test("pegdown/Emph_With_Linebreaks") test("pegdown/Special Chars") } "pass the HTML suppression test" in { "without suppression" in { test("pegdown/HTML suppression", """

HTML SUPPRESSION

|

This is a paragraph containing a strong inline |HTML element and:

|
|

an actual block of HTML!

|
| |""".stripMargin )(new PegDownProcessor) } "with inline suppression" in { test("pegdown/HTML suppression", """

HTML SUPPRESSION

|

This is a paragraph containing a strong inline HTML element |and:

|
|

an actual block of HTML!

|
| |""".stripMargin )(new PegDownProcessor(SUPPRESS_INLINE_HTML)) } "with block suppression" in { test("pegdown/HTML suppression", """

HTML SUPPRESSION

|

This is a paragraph containing a strong inline |HTML element and:

| |""".stripMargin )(new PegDownProcessor(SUPPRESS_HTML_BLOCKS)) } "with block and inline suppression" in { test("pegdown/HTML suppression", """

HTML SUPPRESSION

|

This is a paragraph containing a strong inline HTML element |and:

| |""".stripMargin )(new PegDownProcessor(SUPPRESS_ALL_HTML)) } } "pass the custom verbatim-serializer test" in { def runWithSerializerMap(testName: String, verbatimSerializerMap: java.util.Map[String, VerbatimSerializer], suffix: String) = { val expectedUntidy = FileUtils.readAllTextFromResource(testName + suffix + ".html") require(expectedUntidy != null, "Test '" + testName + "' not found") test(testName, tidy(expectedUntidy), new ToHtmlSerializer(new LinkRenderer, verbatimSerializerMap))(new PegDownProcessor(FENCED_CODE_BLOCKS)) } "without specifying default" in { runWithSerializerMap("pegdown/GFM_Fenced_Code_Blocks", Collections.singletonMap("scala", new CustomVerbatimSerializer), "_reversed_scala") } "with specifying default" in { val serializerMap = new java.util.HashMap[String, VerbatimSerializer] serializerMap.put(VerbatimSerializer.DEFAULT, new CustomVerbatimSerializer) runWithSerializerMap("pegdown/GFM_Fenced_Code_Blocks", serializerMap, "_reversed_all") } } "allow custom plugins" in { import scala.collection.JavaConversions._ implicit val processor = new PegDownProcessor(Parboiled.createParser[Parser, AnyRef](classOf[Parser], new java.lang.Integer(ALL), new java.lang.Long(1000), Parser.DefaultParseRunnerProvider, PegDownPlugins.builder().withPlugin(classOf[PluginParser]).build())) implicit val htmlSerializer = new ToHtmlSerializer(new LinkRenderer, List(new ToHtmlSerializerPlugin { def visit(node: Node, visitor: Visitor, printer: Printer) = node match { case blockPlugin: BlockPluginNode => { printer.print("
") printer.print(blockPlugin.getText) printer.print("
") true } case inlinePlugin: InlinePluginNode => { printer.print("") printer.print(inlinePlugin.getText) printer.print("") true } case _ => false } })) testWithSerializer("pegdown/Plugins") } } } class CustomParser extends Parser(ALL, 1000, Parser.DefaultParseRunnerProvider) class CustomVerbatimSerializer extends VerbatimSerializer { def serialize(node: VerbatimNode, printer: Printer) { printer.print("
")
    printer.println()
    printer.print("")
    printer.println()
    printer.print(node.getText.reverse)
    printer.println()
    printer.print("")
    printer.println()
    printer.print("
") printer.println() } } pegdown-1.5.0/src/test/scala/org/pegdown/PhpMarkdownSpec.scala000066400000000000000000000024501247356127500243320ustar00rootroot00000000000000package org.pegdown import Extensions._ class PhpMarkdownSpec extends AbstractPegDownSpec { "The PegDownProcessor" should { "pass selected parts of the PhpMarkdown test suite" in { implicit val processor = new PegDownProcessor test("PhpMarkdown/Backslash_escapes") test("PhpMarkdown/Code_block_in_a_list_item") test("PhpMarkdown/Code_Spans") test("PhpMarkdown/Email_auto_links") // test("PhpMarkdown/Emphasis") // test("PhpMarkdown/Headers") test("PhpMarkdown/Horizontal_Rules") test("PhpMarkdown/Inline_HTML_(Simple)") test("PhpMarkdown/Inline_HTML_(Span)") test("PhpMarkdown/Inline_HTML_comments") // test("PhpMarkdown/Ins_and_del") // test("PhpMarkdown/Links_inline_style") test("PhpMarkdown/MD5_Hashes") test("PhpMarkdown/Nesting") // test("PhpMarkdown/Parens_in_URL") // test("PhpMarkdown/PHP-Specific_Bugs") test("PhpMarkdown/Tight_blocks") } "pass selected parts of the PhpMarkdownExtra test suite" in { implicit val processor = new PegDownProcessor(ALL & ~SMARTYPANTS & ~HARDWRAPS & ~ANCHORLINKS) test("PhpMarkdownExtra/Abbr") test("PhpMarkdownExtra/Definition_Lists") test("PhpMarkdownExtra/Fenced_Code_Blocks") test("PhpMarkdownExtra/Tables") } } }