Jason McKesson avatar Jason McKesson committed e07f7d1

Attempt at markdown docs. Aborted.

Comments (0)

Files changed (2)

docs/Load Docs.xpr

                         <scenarioAssociation-array>
                             <scenarioAssociation>
                                 <field name="name">
-                                    <String xml:space="preserve">ToCreole</String>
+                                    <String xml:space="preserve">ToMarkdown</String>
                                 </field>
                                 <field name="type">
                                     <String xml:space="preserve">XSL</String>
                                 </field>
                                 <field name="url">
-                                    <String xml:space="preserve">Styles.xml</String>
-                                </field>
-                            </scenarioAssociation>
-                            <scenarioAssociation>
-                                <field name="name">
-                                    <String xml:space="preserve">ToCreole</String>
-                                </field>
-                                <field name="type">
-                                    <String xml:space="preserve">XSL</String>
-                                </field>
-                                <field name="url">
-                                    <String xml:space="preserve">Style_Pointer_CPP.xml</String>
-                                </field>
-                            </scenarioAssociation>
-                            <scenarioAssociation>
-                                <field name="name">
-                                    <String xml:space="preserve">ToCreole</String>
-                                </field>
-                                <field name="type">
-                                    <String xml:space="preserve">XSL</String>
-                                </field>
-                                <field name="url">
-                                    <String xml:space="preserve">Style_Pointer_C.xml</String>
-                                </field>
-                            </scenarioAssociation>
-                            <scenarioAssociation>
-                                <field name="name">
-                                    <String xml:space="preserve">ToCreole</String>
-                                </field>
-                                <field name="type">
-                                    <String xml:space="preserve">XSL</String>
-                                </field>
-                                <field name="url">
-                                    <String xml:space="preserve">Style_No_Load_CPP.xml</String>
+                                    <String xml:space="preserve">ToMarkdown.xsl</String>
                                 </field>
                             </scenarioAssociation>
                             <scenarioAssociation>
                                     <String xml:space="preserve">XSL</String>
                                 </field>
                                 <field name="url">
-                                    <String xml:space="preserve">New_Style_Step_By_Step.xml</String>
+                                    <String xml:space="preserve">Styles.xml</String>
                                 </field>
                             </scenarioAssociation>
                             <scenarioAssociation>
                                     <String xml:space="preserve">XSL</String>
                                 </field>
                                 <field name="url">
-                                    <String xml:space="preserve">Extension_Files.xml</String>
+                                    <String xml:space="preserve">New_Style_Step_By_Step.xml</String>
+                                </field>
+                            </scenarioAssociation>
+                            <scenarioAssociation>
+                                <field name="name">
+                                    <String xml:space="preserve">ToCreole</String>
+                                </field>
+                                <field name="type">
+                                    <String xml:space="preserve">XSL</String>
+                                </field>
+                                <field name="url">
+                                    <String xml:space="preserve">Extension%20Files.xml</String>
+                                </field>
+                            </scenarioAssociation>
+                            <scenarioAssociation>
+                                <field name="name">
+                                    <String xml:space="preserve">ToCreole</String>
+                                </field>
+                                <field name="type">
+                                    <String xml:space="preserve">XSL</String>
+                                </field>
+                                <field name="url">
+                                    <String xml:space="preserve">Command%20Line%20Options.xml</String>
+                                </field>
+                            </scenarioAssociation>
+                            <scenarioAssociation>
+                                <field name="name">
+                                    <String xml:space="preserve">ToCreole</String>
+                                </field>
+                                <field name="type">
+                                    <String xml:space="preserve">XSL</String>
+                                </field>
+                                <field name="url">
+                                    <String xml:space="preserve">Style%20Pointer%20C.xml</String>
+                                </field>
+                            </scenarioAssociation>
+                            <scenarioAssociation>
+                                <field name="name">
+                                    <String xml:space="preserve">ToCreole</String>
+                                </field>
+                                <field name="type">
+                                    <String xml:space="preserve">XSL</String>
+                                </field>
+                                <field name="url">
+                                    <String xml:space="preserve">ToCreole.xsl</String>
+                                </field>
+                            </scenarioAssociation>
+                            <scenarioAssociation>
+                                <field name="name">
+                                    <String xml:space="preserve">ToCreole</String>
+                                </field>
+                                <field name="type">
+                                    <String xml:space="preserve">XSL</String>
+                                </field>
+                                <field name="url">
+                                    <String xml:space="preserve">Command_Line_Options.xml</String>
                                 </field>
                             </scenarioAssociation>
                             <scenarioAssociation>
                                     <String xml:space="preserve">XSL</String>
                                 </field>
                                 <field name="url">
-                                    <String xml:space="preserve">Command_Line_Options.xml</String>
+                                    <String xml:space="preserve">Extension_Files.xml</String>
                                 </field>
                             </scenarioAssociation>
                             <scenarioAssociation>
                                     <String xml:space="preserve">XSL</String>
                                 </field>
                                 <field name="url">
-                                    <String xml:space="preserve">ToCreole.xsl</String>
+                                    <String xml:space="preserve">Style_No_Load_CPP.xml</String>
                                 </field>
                             </scenarioAssociation>
                             <scenarioAssociation>
                                     <String xml:space="preserve">XSL</String>
                                 </field>
                                 <field name="url">
-                                    <String xml:space="preserve">Style%20Pointer%20C.xml</String>
+                                    <String xml:space="preserve">Style_Pointer_C.xml</String>
                                 </field>
                             </scenarioAssociation>
                             <scenarioAssociation>
                                     <String xml:space="preserve">XSL</String>
                                 </field>
                                 <field name="url">
-                                    <String xml:space="preserve">Command%20Line%20Options.xml</String>
-                                </field>
-                            </scenarioAssociation>
-                            <scenarioAssociation>
-                                <field name="name">
-                                    <String xml:space="preserve">ToCreole</String>
-                                </field>
-                                <field name="type">
-                                    <String xml:space="preserve">XSL</String>
-                                </field>
-                                <field name="url">
-                                    <String xml:space="preserve">Extension%20Files.xml</String>
+                                    <String xml:space="preserve">Style_Pointer_CPP.xml</String>
                                 </field>
                             </scenarioAssociation>
                         </scenarioAssociation-array>
                                     <null/>
                                 </field>
                                 <field name="name">
+                                    <String xml:space="preserve">ToMarkdown</String>
+                                </field>
+                                <field name="baseURL">
+                                    <String xml:space="preserve"></String>
+                                </field>
+                                <field name="footerURL">
+                                    <String xml:space="preserve"></String>
+                                </field>
+                                <field name="fOPMethod">
+                                    <String xml:space="preserve">pdf</String>
+                                </field>
+                                <field name="fOProcessorName">
+                                    <String xml:space="preserve">Apache FOP</String>
+                                </field>
+                                <field name="headerURL">
+                                    <String xml:space="preserve"></String>
+                                </field>
+                                <field name="inputXSLURL">
+                                    <String xml:space="preserve">${pdu}/ToMarkdown.xsl</String>
+                                </field>
+                                <field name="inputXMLURL">
+                                    <String xml:space="preserve">${currentFileURL}</String>
+                                </field>
+                                <field name="defaultScenario">
+                                    <Boolean xml:space="preserve">false</Boolean>
+                                </field>
+                                <field name="isFOPPerforming">
+                                    <Boolean xml:space="preserve">false</Boolean>
+                                </field>
+                                <field name="type">
+                                    <String xml:space="preserve">XSL</String>
+                                </field>
+                                <field name="saveAs">
+                                    <Boolean xml:space="preserve">true</Boolean>
+                                </field>
+                                <field name="openInBrowser">
+                                    <Boolean xml:space="preserve">false</Boolean>
+                                </field>
+                                <field name="outputFile">
+                                    <File xml:space="preserve">${cfd}/${cfn}.md</File>
+                                </field>
+                                <field name="openOtherLocationInBrowser">
+                                    <Boolean xml:space="preserve">false</Boolean>
+                                </field>
+                                <field name="locationToOpenInBrowserURL">
+                                    <null/>
+                                </field>
+                                <field name="openInEditor">
+                                    <Boolean xml:space="preserve">false</Boolean>
+                                </field>
+                                <field name="showInHTMLPane">
+                                    <Boolean xml:space="preserve">false</Boolean>
+                                </field>
+                                <field name="showInXMLPane">
+                                    <Boolean xml:space="preserve">false</Boolean>
+                                </field>
+                                <field name="showInSVGPane">
+                                    <Boolean xml:space="preserve">false</Boolean>
+                                </field>
+                                <field name="showInResultSetPane">
+                                    <Boolean xml:space="preserve">false</Boolean>
+                                </field>
+                                <field name="useXSLTInput">
+                                    <Boolean xml:space="preserve">true</Boolean>
+                                </field>
+                                <field name="xsltParams">
+                                    <list>
+                                    <transformationParameter>
+                                    <field name="paramDescription">
+                                    <paramDescriptor>
+                                    <field name="localName">
+                                    <String xml:space="preserve">basename</String>
+                                    </field>
+                                    <field name="prefix">
+                                    <null/>
+                                    </field>
+                                    <field name="namespace">
+                                    <null/>
+                                    </field>
+                                    </paramDescriptor>
+                                    </field>
+                                    <field name="value">
+                                    <String xml:space="preserve">${cfn}</String>
+                                    </field>
+                                    </transformationParameter>
+                                    </list>
+                                </field>
+                                <field name="cascadingStylesheets">
+                                    <String-array/>
+                                </field>
+                                <field name="xslTransformer">
+                                    <String xml:space="preserve">Saxon-PE</String>
+                                </field>
+                                <field name="extensionURLs">
+                                    <String-array/>
+                                </field>
+                            </scenario>
+                            <scenario>
+                                <field name="advancedOptionsMap">
+                                    <null/>
+                                </field>
+                                <field name="name">
                                     <String xml:space="preserve">Execute XQuery</String>
                                 </field>
                                 <field name="baseURL">
         <folder name="transforms">
             <file name="TagsToSupport.txt"/>
             <file name="ToCreole.xsl"/>
+            <file name="ToMarkdown.xsl"/>
         </folder>
         <file name="Command_Line_Options.xml"/>
         <file name="Common_Extension_Files.xml"/>

docs/ToMarkdown.xsl

+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
+    xmlns:db="http://docbook.org/ns/docbook"
+    xmlns:pg="https://bitbucket.org/alfonse/glloadgen"
+    xmlns:xlink="http://www.w3.org/1999/xlink"
+    xmlns:fn="http://www.w3.org/2005/xpath-functions"
+    exclude-result-prefixes="xs xd"
+    version="2.0">
+    
+    <xsl:strip-space elements="*"/>
+    <xsl:output method="text" encoding="UTF-8"/>
+    <xsl:output name="text" method="text" encoding="UTF-8"/>
+    
+    <xsl:param name="filePrefix"/>
+    <xsl:param name="basename"/>
+    
+    
+    <xsl:template match="/">
+        <xsl:apply-templates select="/db:article/*" mode="root"/>
+    </xsl:template>
+    
+    <!-- Basic structural controls. -->
+    <!--
+    <xsl:template match="db:section" mode="root">
+        <xsl:choose>
+            <xsl:when test="name(preceding-sibling::*[1]) != 'title' and
+                name(preceding-sibling::*[1]) != 'section'">
+                <xsl:apply-templates select="." mode="file"/>
+            </xsl:when>
+            <xsl:when test="ancestor::db:article/processing-instruction(together)">
+                <xsl:apply-templates select="." mode="file"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:variable name="baseName" select="if(empty(processing-instruction(trope))) then
+                    (string(db:title)) else (substring-before(
+                    substring-after(string(processing-instruction(trope)), 'url=&quot;'), '&quot;'))"/>
+                <xsl:variable name="sectionNum" select="index-of(../db:section, .)"/>
+                <xsl:variable name="prefixedName" select="
+                    if(empty($filePrefix)) then
+                        (concat($sectionNum, ' - ', $baseName))
+                    else
+                        (concat($filePrefix, ' - ', $sectionNum, ' - ', $baseName))"/>
+                <xsl:variable name="filename" select="concat($prefixedName, '.txt')"/>
+                
+                <xsl:result-document format="text" href="{$filename}">
+                    <xsl:apply-templates select="*" mode="file"/>
+                </xsl:result-document>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    -->
+
+    <xsl:template match="db:title" mode="root"/>
+
+    <xsl:template match="db:*" mode="root">
+        <xsl:apply-templates select="." mode="file"/>
+    </xsl:template>
+    
+    
+    <!-- Process the actual text data. -->
+    <xsl:template match="db:para" mode="file">
+        <xsl:variable name="listCount" select="count(ancestor::db:listitem)"/>
+        <xsl:if test="ancestor::db:blockquote or ancestor::db:epigraph">
+            <xsl:text>></xsl:text>
+        </xsl:if>
+        <xsl:if test="ancestor::db:itemizedlist and not(preceding-sibling::*)">
+            <xsl:value-of select="pg:dup(' ', $listCount)"/>
+            <xsl:text>* </xsl:text>
+        </xsl:if>
+        <xsl:if test="ancestor::db:orderedlist and not(preceding-sibling::*)">
+            <xsl:value-of select="pg:dup(' ', $listCount)"/>
+            <xsl:text>1. </xsl:text>
+        </xsl:if>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:choose>
+            <xsl:when test="ancestor::db:blockquote">
+                <xsl:text>
+</xsl:text>
+            </xsl:when>
+            <xsl:when test="ancestor::db:listitem and following-sibling::* and
+                not(following-sibling::db:itemizedlist or following-sibling::db:orderedlist)">
+                <xsl:value-of select="pg:dup('    ', $listCount)"/>
+            </xsl:when>
+            <xsl:when test="parent::db:glossdef or following-sibling::*">
+                <xsl:text>
+
+</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:text>
+</xsl:text>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template match="db:formalpara" mode="file">
+        <xsl:text>**</xsl:text>
+        <xsl:value-of select="db:title"/>
+        <xsl:text>**: </xsl:text>
+        <xsl:apply-templates select="db:para" mode="#current"/>
+        <xsl:text>
+</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:glossentry/db:glossterm" mode="file">
+        <xsl:text>**</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>**:
+
+</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:itemizedlist|db:orderedlist" mode="file">
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>
+</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:programlisting" mode="file">
+        <xsl:text>{{{
+</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>
+}}}
+
+</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:glossterm" mode="file">
+        <xsl:text>**</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>**</xsl:text>
+    </xsl:template>
+    <!--
+    <xsl:template match="db:footnote" mode="file">
+        <xsl:text>[[hottip:</xsl:text>
+        <xsl:value-of select="if(@label) then @label else '*'"/>
+        <xsl:text>:</xsl:text>
+        
+        <xsl:apply-templates select="db:para/(*|text())" mode="#current"/>
+        <xsl:text>]]</xsl:text>
+    </xsl:template>
+    -->
+    
+    <xsl:template match="db:emphasis" mode="file">
+        <xsl:text>//</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>//</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:emphasis[@role = 'strong']" mode="file">
+        <xsl:text>**</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>**</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:foreignphrase" mode="file">
+        <xsl:text>//</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>//</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:filename" mode="file">
+        <xsl:text>{{{</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>}}}</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:literal" mode="file">
+        <xsl:text>{{{</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>}}}</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:personname" mode="file">
+        <xsl:text>**</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>**</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:firstname" mode="file">
+        <xsl:if test="preceding-sibling::db:surname">
+            <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+    </xsl:template>
+    
+    <xsl:template match="db:surname" mode="file">
+        <xsl:if test="preceding-sibling::db:firstname">
+            <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+    </xsl:template>
+    
+    <xsl:template match="db:quote" mode="file">
+        <xsl:text>&quot;</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>&quot;</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:link" mode="file">
+        <xsl:text>[[</xsl:text>
+        <xsl:value-of select="@xlink:href"/>
+        <xsl:text>|</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>]]</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="pg:pagelink" mode="file">
+        <xsl:text>[[</xsl:text>
+        <xsl:value-of select="@linkend"/>
+        <xsl:text>|</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>]]</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:phrase[@role='title']" mode="file">
+        <xsl:text>//**</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>**//</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:citetitle" mode="file">
+        <xsl:text>//**</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>**//</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="db:section" mode="file">
+        <xsl:call-template name="MakeSectionTitle"/>
+        <xsl:text>
+
+</xsl:text>
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+    </xsl:template>
+    
+    <xsl:template name="MakeSectionTitle">
+        <xsl:for-each select="ancestor-or-self::db:section">
+            <xsl:text>=</xsl:text>
+        </xsl:for-each>
+        <xsl:variable name="RootSection" select="/*/db:section"/>
+        <xsl:variable name="NotSingularRoot" select="$RootSection/following-sibling::* or $RootSection/preceding-sibling::*[name()
+            != 'title']"/>
+        <xsl:if test="$NotSingularRoot">
+            <xsl:text>=</xsl:text>
+        </xsl:if>
+        <xsl:value-of select="db:title[1]"/>
+        <xsl:if test="$NotSingularRoot">
+            <xsl:text>=</xsl:text>
+        </xsl:if>
+        <xsl:for-each select="ancestor-or-self::db:section">
+            <xsl:text>=</xsl:text>
+        </xsl:for-each>
+    </xsl:template>
+    
+    <xsl:template match="db:blockquote" mode="file">
+        <xsl:apply-templates select="*|text()" mode="#current"/>
+        <xsl:text>
+</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="text()" mode="file">
+        <xsl:variable name="norm" select="normalize-space()"/>
+        <xsl:if test="substring($norm, 1, 1) != substring(., 1, 1) and (string-length($norm) > 0)">
+            <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:value-of select="$norm"/>
+        <xsl:if test="substring($norm, string-length($norm), 1) != substring(., string-length(.), 1) and (string-length($norm) > 0)">
+            <xsl:text> </xsl:text>
+        </xsl:if>
+    </xsl:template>
+
+    <xsl:template match="text()[ancestor::db:programlisting]" mode="file">
+        <xsl:value-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="db:title" mode="file"/>
+
+    <xsl:template match="db:phrase[@role='toc']" mode="file">
+        <xsl:apply-templates select="/descendant::db:section" mode="toc"/>
+    </xsl:template>
+    
+    <xsl:template match="db:section" mode="toc">
+        <xsl:variable name="title" select="db:title/text()"/>
+        <xsl:variable name="link" select="lower-case(replace($title, ' ', '-'))"/>
+        <xsl:variable name="starCount" select="count(ancestor-or-self::db:section)"/>
+        <xsl:value-of select="pg:dup('*', $starCount)"/>
+        <xsl:text> </xsl:text>
+        <xsl:text>[[</xsl:text>
+        <xsl:value-of select="$basename"/>
+        <xsl:text>#!</xsl:text>
+        <xsl:value-of select="$link"/>
+        <xsl:text>|</xsl:text>
+        <xsl:value-of select="$title"/>
+        <xsl:text>]]</xsl:text>
+        <xsl:text>
+</xsl:text>
+    </xsl:template>
+    
+    <xsl:function name="pg:dup">
+        <xsl:param name="input"/>
+        <xsl:param name="count"/>
+        <xsl:sequence select="string-join(for $l in 1 to $count return $input, '')"/>
+    </xsl:function>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</xsl:transform>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.