From 03242dea42376c2e148e3d4f38bc29c231c565e7 Mon Sep 17 00:00:00 2001 From: MSmid Date: Tue, 16 Dec 2014 19:09:23 +0100 Subject: [PATCH] version 1.0.4 --- .gitignore | 7 ++ doc/md2doc.html | 146 ++++++++++++++++++++++----- src/md2doc.xsl | 15 --- test/docbook.xml | 256 +++++++++++++++++++++++++++++++++++++++++++++++ test/html.html | 223 +++++++++++++++++++++++++++++++++++++++++ test/test.md | 2 +- 6 files changed, 606 insertions(+), 43 deletions(-) create mode 100644 test/docbook.xml create mode 100644 test/html.html diff --git a/.gitignore b/.gitignore index f316770..a08b718 100644 --- a/.gitignore +++ b/.gitignore @@ -248,3 +248,10 @@ test/test2.xml src/templates/book.xml src/templates/book.xml test/in/stackoverflow.md +test/tests/grouping.xsl +test/tests/gruping.xml +test/tests/test.xml +test/tests/test.xsl +test/tests/test2.xml +examples/book.xml +examples/book-transform.xsl diff --git a/doc/md2doc.html b/doc/md2doc.html index 587dfd5..99dd95a 100644 --- a/doc/md2doc.html +++ b/doc/md2doc.html @@ -205,6 +205,7 @@ 'src_T_mainS_md2doc.xsl', 'src_T_get-htmlS_md2doc.xsl', 'src_T_convertS_md2doc.xsl', + 'src_T_testS_md2doc.xsl', 'src_F_htmlparseS_htmlparse.xsl', 'src_htmlparseA_3S_htmlparse.xsl', 'src_F_charsS_htmlparse.xsl', @@ -250,6 +251,7 @@ 'refs_T_mainS_md2doc.xsl', 'refs_T_get-htmlS_md2doc.xsl', 'refs_T_convertS_md2doc.xsl', + 'refs_T_testS_md2doc.xsl', 'refs_F_htmlparseS_htmlparse.xsl', 'refs_htmlparseA_3S_htmlparse.xsl', 'refs_F_charsS_htmlparse.xsl', @@ -640,9 +642,6 @@

Table of Contents

Templates
- - - @@ -740,10 +739,14 @@

Table of Contents

-
Template +
Templates
@@ -1170,10 +1173,11 @@

Table of Contents

Templates
@@ -1261,10 +1265,11 @@

Table of Contents

Templates
- - - + + + + @@ -1585,9 +1590,10 @@

Table of Contents

Templates
@@ -1893,12 +1899,12 @@

Table of Contents

Description

-        FUNCTION LIBRARY stylesheet Md2doc 1.0.3
+        FUNCTION LIBRARY stylesheet Md2doc 1.0.4
         
         Markdown Parser in XSLT2 Copyright 2014 Martin Šmíd
         This code is under MIT licence, see more at https://github.com/MSmid/markdown2docbook
     
-        TEMPLATE library stylesheet Md2doc 1.0.3
+        TEMPLATE library stylesheet Md2doc 1.0.4
         
         Markdown Parser in XSLT2 Copyright 2014 Martin Šmíd
         This code is under MIT licence, see more at https://github.com/MSmid/markdown2docbook
@@ -6731,7 +6737,7 @@ 

Description

HTML inline elements
Template - main
+ md2doc:main
@@ -6835,7 +6841,7 @@

Description

HTML inline elements
-
<xsl:template name="main">
+                                    
<xsl:template name="md2doc:main">
   <xsl:param name="input" as="xs:string" select="$input"/>
   <xsl:param name="encoding" as="xs:string" select="$encoding"/>
   <xsl:param name="root-element" as="xs:string" select="$root-element"/>
@@ -6864,7 +6870,7 @@ 

Description

HTML inline elements
Template - get-html
+ md2doc:get-html
@@ -6935,7 +6941,7 @@

Description

HTML inline elements
- @@ -6956,7 +6962,7 @@

Description

HTML inline elements
<xsl:template name="get-html">
+                                    
<xsl:template name="md2doc:get-html">
   <xsl:param name="input" as="xs:string" select="$input"/>
   <xsl:sequence select="md2doc:get-html($input)"/>
 </xsl:template>
Template - convert
+ md2doc:convert
@@ -7039,11 +7045,94 @@

Description

HTML inline elements
- + +
<xsl:template name="convert">
+                                    
<xsl:template name="md2doc:convert">
   <xsl:param name="input" as="xs:string" select="$input"/>
   <xsl:param name="root-element" as="xs:string" select="$root-element"/>
   <xsl:param name="headline-element" as="xs:string" select="$headline-element"/>
   <xsl:sequence select="md2doc:convert($input,$root-element,$headline-element)"/>
+</xsl:template>
+
+ + + + + + + + + + + + + +
[ top ]
Template + md2doc:test
+ + + + + + + + +
+ + + + + + + + + + + + + @@ -7970,10 +8060,11 @@

Description

                            
+
References
+
+
+
+ + + + + + + + + +
Outputs +
+
docbook;
+
html5
+
+
Functions + +
+
+
Import precedence3
+
Source
+
+
+
+ + +
<xsl:template name="md2doc:test">
+  <xsl:result-document href="../test/out/output3.xml" format="docbook">
+    <xsl:processing-instruction name="xml-model">href="http://docbook.org/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"</xsl:processing-instruction>
+    <xsl:processing-instruction name="xml-model">href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron</xsl:processing-instruction>
+    <xsl:sequence select="md2doc:convert(md2doc:read-file('../test/in/test-frag.md', 'utf-8'), 'book', 'chapter')"/>
+  </xsl:result-document>
+  <xsl:result-document href="../test/out/output.xml" format="html5">
+    <xsl:sequence select="md2doc:get-html(md2doc:read-file('../test/in/test-frag.md', 'utf-8'))"/>
+  </xsl:result-document>
 </xsl:template>
@@ -7697,8 +7786,9 @@

Description

                                     
Templates
- + @@ -11468,10 +11559,11 @@

Description

                            
TemplateTemplates
- + diff --git a/src/md2doc.xsl b/src/md2doc.xsl index b0eff87..deb65db 100644 --- a/src/md2doc.xsl +++ b/src/md2doc.xsl @@ -90,19 +90,4 @@ - - - href="http://docbook.org/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0" - href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron - - - - - - - - - - - diff --git a/test/docbook.xml b/test/docbook.xml new file mode 100644 index 0000000..fbedac8 --- /dev/null +++ b/test/docbook.xml @@ -0,0 +1,256 @@ + + + + + book + + TEST MARKDOWN SHEET + by Martin Smid + md2doc version 1.0.4 + + LISTS + ul list: + + + list item + + + list item with inline element + + + different marks + + + ol list: + + + number one item + + + number two item + + + marked as 8th item + + + nested structures: + + list item + + nested ul list + + + nested paragraph. + nested codeblock! + +
+ nested blockquote +
nested header
+ + again list item +with lazy paragraph. + +
+ special case: + + + indended by three spaces + + no indend at all + + + + + + again three spaces + + +
+ + BLOCKQUOTES +
+ This is a header. + + + list 1 + + + list 2 + + + Here's some example code: + return shell_exec("echo $input | $markdown_script"); + +
+ Lazy blockquote +
+ This is blockquote +and these two +are lazy lines +
+
+ + HEADERS + Setext-style + +
+ + Headline h1 + + Headline h2 + +ATX-style + + + + headline 1 + + headline 2 with trailing hashes + + headline 3 + + headline 4 + + headline 5 + + headline 6 + + + + #### Still headline 6 + + + + + + + + RULERS + various combinations of five rulers + + + CODEBLOCKS + Four spaces indended codeblock + This is codeblock with < and & + another line + + + + PARAGRAPHS + This is para, +this whole, +is one para + but this is new para + + + BLOCK HTML + + +
+ + + + + gotClasson one line + + + CODESPANS + This is text with code in it. +Sometimes I want to add strong to it + strong code + . +Also I want to write about Markdown syntax code looks like `this`. + + + INLINE HTML + Sometimes I need inline cite, +or image with attributes + img + + + + . +Weird but nested <i>html<i/>. + + + HARDBREAKS + Well, I need to end text here and start over! + + + SPANS + This is strong and this is __not**. +Nested spans looks like + this! + + + + + IMAGES AND ANCHORS + There is imaginative inline + image + + + + + inline image + + , +but here is referenced + image + + + + + referenced img + + . + Anchors are similiar, +really similiar. + Try implicit emphasised link on + Google + . + + + AUTOMATIC LINKS + This is automatic http://www.markdown2docbook.com + + + + ESCAPING + I want to write file with underscores bg_body_out.png + How to treat <, & and > + + + SPECIAL CASES + Asterisk * looks like star* + + ![image](img.png) + this is headline 2 + + + * * * + +and this is one list + + + + + + this is not nested + + + + + + This text needs to have escaped dot . + + + Oops, now this line is treated +as a sub-list. + + + + + diff --git a/test/html.html b/test/html.html new file mode 100644 index 0000000..0221fee --- /dev/null +++ b/test/html.html @@ -0,0 +1,223 @@ + + + + TEST MARKDOWN SHEET + + +

TEST MARKDOWN SHEET

+

by Martin Smid

+

md2doc version 1.0.4

+

LISTS

+

ul list:

+
    +
  • list item
  • +
  • list item with + inline element +
  • +
  • +

    different marks

    +
  • +
+

ol list:

+
    +
  1. number one item
  2. +
  3. number + two item +
  4. +
  5. +

    marked as 8th item

    +
  6. +
+

nested structures:

+
    +
  • list item +
      +
    • +

      nested ul list

      +
    • +
    +

    nested paragraph.

    +
    +                 nested codeblock! 
    +                  
    +               
    +            
    +
    +

    nested blockquote

    +
    +

    nested header

    +
  • +
  • +

    again list item + with lazy paragraph. +

    +
  • +
+

special case:

+
    +
  • indended by three spaces +
      +
    • no indend at all
    • +
    +
  • +
  • +

    again three spaces

    +
  • +
+

BLOCKQUOTES

+
+

This is a header.

+
    +
  • list 1
  • +
  • +

    list 2

    +
  • +
+

Here's some example code:

+
+            return shell_exec("echo $input | $markdown_script");    
+               
+            
+         
+
+
+

Lazy blockquote

+
+

This is blockquote + and these two + are lazy lines +

+
+

HEADERS

+

Setext-style

+

Headline h1

+

Headline h2

+

+ ATX-style +

+

headline 1

+

headline 2 with trailing hashes

+

headline 3

+

headline 4

+
headline 5
+
headline 6
+
#### Still headline 6
+

RULERS

+

various combinations of five rulers

+
+
+
+
+
+

CODEBLOCKS

+

Four spaces indended codeblock

+
+         This is codeblock with < and &
+            another line 
+            
+         
+      
+

PARAGRAPHS

+

This is para, + this whole, + is one para +

+

but this is new para

+

BLOCK HTML

+
+ +
TemplateTemplates
Table inside div
+ + + + + +
Table inside div
+ + +
on one line
+

CODESPANS

+

This is text with + code in it. + Sometimes I want to add strong to it + + strong code + . + Also I want to write about Markdown syntax + code looks like `this`. +

+

INLINE HTML

+

Sometimes I need inline + cite, + or image with attributes + img. + Weird but nested + <i>html<i/>. +

+

HARDBREAKS

+

Well, I need to end text here +

and start over! +

+

SPANS

+

This is + strong and this is __not**. + Nested spans looks like + + this! + +

+

IMAGES AND ANCHORS

+

There is imaginative inline + image, + but here is referenced + image. +

+

Anchors are + similiar, + really + similiar. +

+

Try implicit emphasised link on + + Google + . +

+

AUTOMATIC LINKS

+

This is automatic + http://www.markdown2docbook.com +

+

ESCAPING

+

I want to write file with underscores bg_body_out.png

+

How to treat <, & and >

+

SPECIAL CASES

+

Asterisk * looks like + star* +

+

![ + image](img.png) +

+

this is headline 2

+

* * *

+

+ and this is one list +

+
    +
  • +
      +
    • +

      this is not nested

      +
    • +
    +
  • +
+

This text needs to have escaped dot .

I recommend upgrading to version +
    +
  1. +

    Oops, now this line is treated + as a sub-list. +

    +
  2. +
+ + \ No newline at end of file diff --git a/test/test.md b/test/test.md index 1788bc2..8412a86 100644 --- a/test/test.md +++ b/test/test.md @@ -2,7 +2,7 @@ by Martin Smid -md2doc version 1.0.3 +md2doc version 1.0.4 ## LISTS ##