You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@apache.org on 2003/10/12 00:37:11 UTC
cvs commit: cocoon-2.1/src/blocks/slop/samples/yapt/presentations yapt-demo.txt
stevenn 2003/10/11 15:37:11
Modified: src/blocks/slop/samples/yapt/css yapt-style.css
src/blocks/slop/samples/yapt/stylesheets
filter-slop-output.xsl
src/blocks/slop/samples/yapt/presentations yapt-demo.txt
Log:
Hacking source code support into
Revision Changes Path
1.5 +8 -0 cocoon-2.1/src/blocks/slop/samples/yapt/css/yapt-style.css
Index: yapt-style.css
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/slop/samples/yapt/css/yapt-style.css,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- yapt-style.css 30 Sep 2003 12:53:55 -0000 1.4
+++ yapt-style.css 11 Oct 2003 22:37:11 -0000 1.5
@@ -30,6 +30,14 @@
font-style: italic;
}
+pre {
+ border: 1px dotted #000;
+ padding: 10px;
+ margin: 20px;
+ font-size: 120%;
+ background: silver;
+}
+
a {
text-decoration: none;
color: #000;
1.3 +30 -7 cocoon-2.1/src/blocks/slop/samples/yapt/stylesheets/filter-slop-output.xsl
Index: filter-slop-output.xsl
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/slop/samples/yapt/stylesheets/filter-slop-output.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- filter-slop-output.xsl 27 Sep 2003 18:45:04 -0000 1.2
+++ filter-slop-output.xsl 11 Oct 2003 22:37:11 -0000 1.3
@@ -104,13 +104,22 @@
<!-- ignore multiple empty lines -->
<xsl:template mode="paragraph" match="slop:empty-line[following-sibling::*[1][self::slop:empty-line]]"/>
- <!-- empty line separates paragraphs -->
+ <!-- extract paragraph and code blocks -->
<xsl:template mode="paragraph" match="slop:empty-line">
- <p>
- <xsl:for-each select="following-sibling::*[1][not(self::slop:empty-line) and not(self::slop:slide)]">
- <xsl:call-template name="para-grouper"/>
- </xsl:for-each>
- </p>
+ <xsl:choose>
+ <xsl:when test="following-sibling::*[1][not(self::slop:code)]">
+ <p>
+ <xsl:for-each select="following-sibling::*[1][not(self::slop:empty-line) and not(self::slop:slide)]">
+ <xsl:call-template name="para-grouper"/>
+ </xsl:for-each>
+ </p>
+ </xsl:when>
+ <xsl:otherwise>
+ <pre><xsl:for-each select="following-sibling::*[1][not(self::slop:empty-line) and not(self::slop:slide)]">
+ <xsl:call-template name="code-grouper"/>
+ </xsl:for-each></pre>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<!-- recursively collect elements until an empty line or the next slide is found -->
@@ -122,12 +131,26 @@
</xsl:for-each>
</xsl:template>
+ <!-- ditto for code lines -->
+ <xsl:template name="code-grouper">
+ <xsl:apply-templates mode="code" select="."/>
+
+ <xsl:for-each select="following-sibling::*[1][not(self::slop:empty-line) and not(self::slop:slide)]">
+ <xsl:call-template name="code-grouper"/>
+ </xsl:for-each>
+ </xsl:template>
+
<!-- paragraph grouping mode, by default copy everything, removing slop namespace -->
<xsl:template match="slop:*" mode="paragraph">
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
+ </xsl:template>
+
+ <!-- output code slop:lines as-is, with added carriage return -->
+ <xsl:template match="slop:line" mode="code">
+ <xsl:copy-of select="text()"/><xsl:text> </xsl:text>
</xsl:template>
<!-- extract the text of lines -->
1.4 +11 -1 cocoon-2.1/src/blocks/slop/samples/yapt/presentations/yapt-demo.txt
Index: yapt-demo.txt
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/slop/samples/yapt/presentations/yapt-demo.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- yapt-demo.txt 27 Sep 2003 19:12:05 -0000 1.3
+++ yapt-demo.txt 11 Oct 2003 22:37:11 -0000 1.4
@@ -39,6 +39,16 @@
note: This page uses a hint-style line to indicate that it contains little text and can use a larger font
+slide: Testing source code
+hint-style: LittleText
+
+You can embed source code examples using the code: demarcation.
+
+code:
+<?xml version="1.0"?>
+ <foo/>
+
+You'll find out that indenting is dropped, which is bad.
slide: Test results