svn commit: r1023640 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown: resources/stylesheets/anakia-to-markdown.xsl status.xml

[email protected]
Newsgroups gmane.text.xml.forrest.cvs
Message-ID <[email protected]>
Author: crossley
Date: Mon Oct 18 03:04:10 2010
New Revision: 1023640

URL: http://svn.apache.org/viewvc?rev=1023640&view=rev
Log:
Add inital anakia-to-markdown.xsl (copied from r777924 2010-09-24)

Added:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown/resources/stylesheets/anakia-to-markdown.xsl
Modified:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown/status.xml

Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown/resources/stylesheets/anakia-to-markdown.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown/resources/stylesheets/anakia-to-markdown.xsl?rev=1023640&view=auto
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown/resources/stylesheets/anakia-to-markdown.xsl (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown/resources/stylesheets/anakia-to-markdown.xsl Mon Oct 18 03:04:10 2010
@@ -0,0 +1,301 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:output method="xml" omit-xml-declaration="yes"/>
+  <xsl:strip-space elements="*"/>
+
+  <xsl:template match="properties">
+    <xsl:apply-templates select="node()"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="document|body">
+    <xsl:apply-templates select="node()"/>
+  </xsl:template>
+
+  <xsl:template match="ul|ol|dl">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="node()"/>
+  </xsl:template>
+
+  <xsl:template match="document/properties/author">
+  </xsl:template>
+
+  <xsl:template match="document/properties/title">
+    <xsl:text>Title: </xsl:text>
+    <xsl:value-of select="normalize-space(text())"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="atom[@url]">
+    <xsl:text>Atom: </xsl:text>
+    <xsl:value-of select="@url"/>
+    <xsl:text>&#10;      "</xsl:text>
+    <xsl:value-of select="."/>
+    <xsl:text>"</xsl:text>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="document/body/section">
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:template>
+
+  <xsl:template match="section/title">
+  </xsl:template>
+
+  <xsl:template match="toc">
+    <xsl:text>&#10;[TOC]&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template name="section">
+    <xsl:param name="hashes"/>
+    <xsl:param name="title"/>
+
+    <xsl:text>&#10;</xsl:text>
+    <xsl:value-of select="$hashes"/>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="normalize-space($title)"/>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="$hashes"/>
+    <xsl:if test="@id">
+      <xsl:text> {#</xsl:text>
+      <xsl:value-of select="@id"/>
+      <xsl:text>}</xsl:text>
+    </xsl:if>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="*"/>
+  </xsl:template>
+
+  <xsl:template match="document/body/section/section">
+    <xsl:call-template name="section">
+      <xsl:with-param name="hashes">#</xsl:with-param>
+      <xsl:with-param name="title">
+        <xsl:value-of select="title"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="document/body/section/section/section">
+    <xsl:call-template name="section">
+      <xsl:with-param name="hashes">##</xsl:with-param>
+      <xsl:with-param name="title">
+        <xsl:value-of select="title"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="document/body/section/section/section/section">
+    <xsl:call-template name="section">
+      <xsl:with-param name="hashes">###</xsl:with-param>
+      <xsl:with-param name="title">
+        <xsl:value-of select="title"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="h3[not(*)]">
+    <xsl:call-template name="section">
+      <xsl:with-param name="hashes">###</xsl:with-param>
+      <xsl:with-param name="title">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="h4[not(*)]">
+    <xsl:call-template name="section">
+      <xsl:with-param name="hashes">####</xsl:with-param>
+      <xsl:with-param name="title">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="p">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="hr">
+    <xsl:text>&#10;----------&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="blockquote">
+    <xsl:text disable-output-escaping="yes">&#10;&gt;</xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="ul/li">
+    <xsl:text>&#10;- </xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="ul/li/ul/li">
+    <xsl:text>&#10;    - </xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="ol/li">
+    <xsl:text>&#10;1. </xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="ol/li/ol/li">
+    <xsl:text>&#10;    1. </xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="table">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="node()"/>
+  </xsl:template>
+
+  <xsl:template match="tr">
+    <xsl:apply-templates select="node()"/>
+    <xsl:text>|&#10;</xsl:text>
+
+    <xsl:if test="th">
+      <xsl:text>|</xsl:text>
+      <xsl:for-each select="th" xmlns:str="http://exslt.org/strings">
+        <xsl:value-of select="str:padding(string-length(.)+2,'-')"/>
+        <xsl:text>|</xsl:text>
+      </xsl:for-each>
+      <xsl:text>&#10;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="tr/td|th">
+    <xsl:text>| </xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+    <xsl:text> </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="tr/td//tr/td">
+    <xsl:text> | </xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:template>
+
+  <xsl:template match="a[@href]">
+    <xsl:text> [</xsl:text>
+    <xsl:value-of select="normalize-space(text())"/>
+    <xsl:text>](</xsl:text>
+    <xsl:value-of select="@href"/>
+    <xsl:text>) </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="img[@src]">
+    <xsl:text> ![</xsl:text>
+    <xsl:value-of select="@alt"/>
+    <xsl:text>](</xsl:text>
+    <xsl:value-of select="@src"/>
+    <xsl:text> "</xsl:text>
+    <xsl:value-of select="@title"/>
+    <xsl:text>") </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="dl/dt">
+    <xsl:text>&#10;&#10;</xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+    <xsl:if test="@id">
+      <xsl:text> {#</xsl:text>
+      <xsl:value-of select="@id" />
+      <xsl:text>}</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="dl/dd">
+    <xsl:text>&#10;:    </xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:template>
+
+  <xsl:template match="strong|b">
+    <xsl:text> **</xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+    <xsl:text>** </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="em|i">
+    <xsl:text> *</xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+    <xsl:text>* </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="code[not(*)]">
+    <xsl:text> `</xsl:text>
+    <xsl:value-of select="."/>
+    <xsl:text>` </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="tt[not(*)]">
+    <xsl:text> `</xsl:text>
+    <xsl:value-of select="."/>
+    <xsl:text>` </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="pre[not(*)]">
+    <xsl:text> `</xsl:text>
+    <xsl:value-of select="."/>
+    <xsl:text>` </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="code/pre">
+    <xsl:copy xmlns:str="http://exslt.org/strings">
+      <xsl:value-of select="str:replace(.,'*','\*')"/>
+    </xsl:copy>  
+  </xsl:template>
+
+  <xsl:template match="source|pre">
+    <pre><xsl:value-of select="."/></pre>
+  </xsl:template>
+
+  <xsl:template match="note">
+    <xsl:apply-templates select="node()"/>
+  </xsl:template>
+
+  <xsl:template match="text()">
+    <xsl:value-of select="normalize-space(.)"/>
+  </xsl:template>
+
+  <xsl:template match="*">
+    <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
+    <xsl:value-of select="name()"/>
+    <xsl:for-each select="@*">
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="name()"/>
+      <xsl:text>="</xsl:text>
+      <xsl:value-of select="."/>
+      <xsl:text>"</xsl:text>
+    </xsl:for-each>
+    <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+    <xsl:apply-templates select="node()"/>
+    <xsl:text disable-output-escaping="yes">&lt;/</xsl:text>
+    <xsl:value-of select="name()"/>
+    <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="@*">
+  </xsl:template>
+</xsl:stylesheet>
+

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown/status.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown/status.xml?rev=1023640&r1=1023639&r2=1023640&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown/status.xml (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.Markdown/status.xml Mon Oct 18 03:04:10 2010
@@ -37,6 +37,10 @@
 <!-- Add new releases here -->
     <release version="0.1" date="not-released">
       <action dev="DC" type="add" context="code">
+        Using initial anakia-to-markdown.xsl being a copy from
+        <code>http://svn.apache.org/repos/infra/infrastructure/trunk/projects/cms/prototype/conversion-utilities/anakia2markdown.xslt</code> (r777924 2010-09-24).
+      </action>
+      <action dev="DC" type="add" context="code">
         Initial plugin code.
       </action>
     </release>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.