You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by jl...@apache.org on 2007/06/15 09:24:29 UTC
svn commit: r547564 - in /activemq/camel/trunk: camel-book/ camel-book/src/
camel-book/src/docbkx/ camel-book/src/docbkx/images/ camel-book/src/styles/
tooling/maven/ tooling/maven/maven-html-to-docbook/
tooling/maven/maven-html-to-docbook/src/ tooling...
Author: jlim
Date: Fri Jun 15 00:24:27 2007
New Revision: 547564
URL: http://svn.apache.org/viewvc?view=rev&rev=547564
Log:
maven plugin to generate docbook markup / docbook project for camel
http://issues.apache.org/activemq/browse/CAMEL-47
Added:
activemq/camel/trunk/camel-book/
activemq/camel/trunk/camel-book/pom.xml
activemq/camel/trunk/camel-book/src/
activemq/camel/trunk/camel-book/src/docbkx/
activemq/camel/trunk/camel-book/src/docbkx/images/
activemq/camel/trunk/camel-book/src/docbkx/images/asf-logo.gif (with props)
activemq/camel/trunk/camel-book/src/docbkx/images/logo.jpeg (with props)
activemq/camel/trunk/camel-book/src/styles/
activemq/camel/trunk/camel-book/src/styles/docbook-fo.xsl
activemq/camel/trunk/camel-book/src/styles/docbook.xsl
activemq/camel/trunk/tooling/maven/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/pom.xml
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/java/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/java/org/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/java/org/apache/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/java/org/apache/camel/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/java/org/apache/camel/maven/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/java/org/apache/camel/maven/GenerateDocBookMojo.java
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/resources/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/resources/META-INF/
activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/resources/META-INF/NOTICE.txt
Added: activemq/camel/trunk/camel-book/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-book/pom.xml?view=auto&rev=547564
==============================================================================
--- activemq/camel/trunk/camel-book/pom.xml (added)
+++ activemq/camel/trunk/camel-book/pom.xml Fri Jun 15 00:24:27 2007
@@ -0,0 +1,139 @@
+<?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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-book</artifactId>
+ <packaging>pom</packaging>
+ <name>Camel User Guide</name>
+ <description>The Camel User Guide which generates HTML, PDF and man pages.</description>
+
+ <repositories>
+ <repository>
+ <id>agilejava</id>
+ <name>AgileJava</name>
+ <url>http://agilejava.com/maven/</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>agilejava</id>
+ <name>AgileJava</name>
+ <url>http://agilejava.com/maven/</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>maven-html-to-docbook</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>htmlToDocbook</goal>
+ </goals>
+ <phase>generate-sources</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <baseURL>http://activemq.apache.org/camel/</baseURL>
+ <title>Camel</title>
+ <subtitle>User Guide</subtitle>
+ <resources>
+ <resource>index.html</resource>
+ <resource>getting-started.html</resource>
+ <resource>architecture.html</resource>
+ <resource>user-guide.html</resource>
+ <resource>components.html</resource>
+
+ </resources>
+ <authors>
+ <author>James Strachan</author>
+ <author>Hiram Chirino</author>
+ <author>Rob Davies</author>
+ </authors>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.agilejava.docbkx</groupId>
+ <artifactId>docbkx-maven-plugin</artifactId>
+ <version>2.0.3-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-pdf</goal>
+ <goal>generate-html</goal>
+ <goal>generate-manpages</goal>
+ </goals>
+ <phase>generate-sources</phase>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.docbook</groupId>
+ <artifactId>docbook-xml</artifactId>
+ <version>4.4</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <configuration>
+ <foCustomization>${basedir}/src/styles/docbook-fo.xsl</foCustomization>
+ <includes>Camel.xml</includes>
+
+ <!-- lets use separate pages per chapter for HTML -->
+ <chunkedOutput>true</chunkedOutput>
+
+ <entities>
+ <entity>
+ <name>version</name>
+ <value>${version}</value>
+ </entity>
+ </entities>
+
+ <!--<xincludeSupport>true</xincludeSupport>-->
+
+
+ <sourceDirectory>${basedir}/target/docbkx/source</sourceDirectory>
+ <!--
+
+ <preProcess>
+ <ant target="generate-manual" inheritAll="true"/>
+ </preProcess>
+ -->
+ <!--<htmlStylesheet>http://agilejava.com/downloads/kubrick-docbkx.css</htmlStylesheet>-->
+ <headerRule>0</headerRule>
+ <footerRule>0</footerRule>
+ <draftMode>0</draftMode>
+ <bodyFontFamily>Helvetica</bodyFontFamily>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: activemq/camel/trunk/camel-book/src/docbkx/images/asf-logo.gif
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-book/src/docbkx/images/asf-logo.gif?view=auto&rev=547564
==============================================================================
Binary file - no diff available.
Propchange: activemq/camel/trunk/camel-book/src/docbkx/images/asf-logo.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: activemq/camel/trunk/camel-book/src/docbkx/images/logo.jpeg
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-book/src/docbkx/images/logo.jpeg?view=auto&rev=547564
==============================================================================
Binary file - no diff available.
Propchange: activemq/camel/trunk/camel-book/src/docbkx/images/logo.jpeg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: activemq/camel/trunk/camel-book/src/styles/docbook-fo.xsl
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-book/src/styles/docbook-fo.xsl?view=auto&rev=547564
==============================================================================
--- activemq/camel/trunk/camel-book/src/styles/docbook-fo.xsl (added)
+++ activemq/camel/trunk/camel-book/src/styles/docbook-fo.xsl Fri Jun 15 00:24:27 2007
@@ -0,0 +1,428 @@
+<?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.
+-->
+
+<!--
+ This XSL is based heavily on the Spring Frameworks' XSL script
+-->
+<!DOCTYPE xsl:stylesheet [
+ <!ENTITY admon_gfx_path "src/docbkx/images/admons/">
+ <!ENTITY copyright "©">
+]>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <xsl:import href="urn:docbkx:stylesheet"/>
+
+ <!--###################################################
+ Custom Title Page
+ ################################################### -->
+
+ <xsl:template name="book.titlepage.recto">
+ <fo:block>
+ <fo:table table-layout="fixed" width="175mm">
+ <fo:table-column column-width="175mm"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell text-align="center">
+ <fo:block>
+ <fo:external-graphic src="file:src/docbkx/images/logo.jpeg"/>
+ </fo:block>
+ <fo:block font-family="Helvetica" font-size="22pt" padding-before="10mm">
+ <xsl:value-of select="bookinfo/subtitle"/>
+ </fo:block>
+ <fo:block font-family="Helvetica" font-size="12pt" padding="10mm">
+ Version <xsl:value-of select="bookinfo/releaseinfo"/>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ <fo:table-row>
+ <fo:table-cell text-align="center">
+ <fo:block font-family="Helvetica" font-size="14pt" padding="10mm">
+ <xsl:value-of select="bookinfo/pubdate"/>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ <fo:table-row>
+ <fo:table-cell text-align="center">
+ <fo:block font-family="Helvetica" font-size="12pt" padding="10mm">
+ <xsl:text>Copyright ©right; 2004-2007, Apache Software Foundation</xsl:text>
+ </fo:block>
+ <!--<fo:block>-->
+ <!--<fo:external-graphic src="file:src/docbkx/images/asf-logo.gif"/>-->
+ <!--</fo:block>-->
+ <fo:block font-family="Helvetica" font-size="10pt" padding="1mm">
+ <xsl:apply-templates select="bookinfo/legalnotice/*"/>
+ <!--<xsl:value-of select="bookinfo/legalnotice"/>-->
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </fo:block>
+ </xsl:template>
+
+ <!-- Prevent blank pages in output -->
+ <xsl:template name="book.titlepage.before.verso">
+ </xsl:template>
+ <xsl:template name="book.titlepage.verso">
+ </xsl:template>
+ <xsl:template name="book.titlepage.separator">
+ </xsl:template>
+
+ <!--###################################################
+ Header
+ ################################################### -->
+
+ <!-- More space in the center header for long text -->
+ <xsl:attribute-set name="header.content.properties">
+ <xsl:attribute name="font-family">
+ <xsl:value-of select="$body.font.family"/>
+ </xsl:attribute>
+ <xsl:attribute name="margin-left">-5em</xsl:attribute>
+ <xsl:attribute name="margin-right">-5em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!--###################################################
+ Custom Footer
+ ################################################### -->
+ <xsl:template name="footer.content">
+ <xsl:param name="pageclass" select="''"/>
+ <xsl:param name="sequence" select="''"/>
+ <xsl:param name="position" select="''"/>
+ <xsl:param name="gentext-key" select="''"/>
+ <xsl:variable name="Version">
+ <xsl:if test="//releaseinfo">
+ <xsl:text>Apache ActiveMQ (</xsl:text>
+ <xsl:value-of select="//releaseinfo"/>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$sequence='blank'">
+ <xsl:if test="$position = 'center'">
+ <xsl:value-of select="$Version"/>
+ </xsl:if>
+ </xsl:when>
+ <!-- for double sided printing, print page numbers on alternating sides (of the page) -->
+ <xsl:when test="$double.sided != 0">
+ <xsl:choose>
+ <xsl:when test="$sequence = 'even' and $position='left'">
+ <fo:page-number/>
+ </xsl:when>
+ <xsl:when test="$sequence = 'odd' and $position='right'">
+ <fo:page-number/>
+ </xsl:when>
+ <xsl:when test="$position='center'">
+ <xsl:value-of select="$Version"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <!-- for single sided printing, print all page numbers on the right (of the page) -->
+ <xsl:when test="$double.sided = 0">
+ <xsl:choose>
+ <xsl:when test="$position='center'">
+ <xsl:value-of select="$Version"/>
+ </xsl:when>
+ <xsl:when test="$position='right'">
+ <fo:page-number/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!--###################################################
+ Extensions
+ ################################################### -->
+
+ <!-- These extensions are required for table printing and other stuff -->
+ <xsl:param name="use.extensions">1</xsl:param>
+ <xsl:param name="tablecolumns.extension">0</xsl:param>
+ <xsl:param name="callout.extensions">1</xsl:param>
+ <!-- FOP provide only PDF Bookmarks at the moment -->
+ <xsl:param name="fop.extensions">1</xsl:param>
+
+ <!--###################################################
+ Table Of Contents
+ ################################################### -->
+
+ <!-- Generate the TOCs for named components only -->
+ <xsl:param name="generate.toc">
+ book toc
+ </xsl:param>
+
+ <!-- Show only Sections up to level 3 in the TOCs -->
+ <!--<xsl:param name="toc.section.depth">2</xsl:param>-->
+
+ <!-- Dot and Whitespace as separator in TOC between Label and Title-->
+ <!--<xsl:param name="autotoc.label.separator" select="'. '"/>-->
+
+
+ <!--###################################################
+ Paper & Page Size
+ ################################################### -->
+
+ <!-- Paper type, no headers on blank pages, no double sided printing -->
+ <xsl:param name="paper.type" select="'A4'"/>
+ <xsl:param name="double.sided">0</xsl:param>
+ <xsl:param name="headers.on.blank.pages">0</xsl:param>
+ <xsl:param name="footers.on.blank.pages">0</xsl:param>
+
+ <!-- Space between paper border and content (chaotic stuff, don't touch) -->
+ <xsl:param name="page.margin.top">5mm</xsl:param>
+ <xsl:param name="region.before.extent">10mm</xsl:param>
+ <xsl:param name="body.margin.top">10mm</xsl:param>
+
+ <xsl:param name="body.margin.bottom">15mm</xsl:param>
+ <xsl:param name="region.after.extent">10mm</xsl:param>
+ <xsl:param name="page.margin.bottom">0mm</xsl:param>
+
+ <xsl:param name="page.margin.outer">18mm</xsl:param>
+ <xsl:param name="page.margin.inner">18mm</xsl:param>
+
+ <!-- No intendation of Titles -->
+ <xsl:param name="title.margin.left">0pc</xsl:param>
+
+ <!--###################################################
+ Fonts & Styles
+ ################################################### -->
+
+ <!-- Left aligned text and no hyphenation -->
+ <xsl:param name="alignment">justify</xsl:param>
+ <xsl:param name="hyphenate">false</xsl:param>
+
+ <!-- Default Font size -->
+ <xsl:param name="body.font.master">11</xsl:param>
+ <xsl:param name="body.font.small">8</xsl:param>
+
+ <!-- Line height in body text -->
+ <xsl:param name="line-height">1.4</xsl:param>
+
+ <!-- Monospaced fonts are smaller than regular text -->
+ <xsl:attribute-set name="monospace.properties">
+ <xsl:attribute name="font-family">
+ <xsl:value-of select="$monospace.font.family"/>
+ </xsl:attribute>
+ <xsl:attribute name="font-size">0.8em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!--###################################################
+ Tables
+ ################################################### -->
+
+ <!-- The table width should be adapted to the paper size -->
+ <xsl:param name="default.table.width">17.4cm</xsl:param>
+
+ <!-- Some padding inside tables -->
+ <xsl:attribute-set name="table.cell.padding">
+ <xsl:attribute name="padding-left">4pt</xsl:attribute>
+ <xsl:attribute name="padding-right">4pt</xsl:attribute>
+ <xsl:attribute name="padding-top">4pt</xsl:attribute>
+ <xsl:attribute name="padding-bottom">4pt</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Only hairlines as frame and cell borders in tables -->
+ <xsl:param name="table.frame.border.thickness">0.1pt</xsl:param>
+ <xsl:param name="table.cell.border.thickness">0.1pt</xsl:param>
+
+ <!--###################################################
+ Labels
+ ################################################### -->
+
+ <!-- Label Chapters and Sections (numbering) -->
+ <xsl:param name="chapter.autolabel">1</xsl:param>
+ <xsl:param name="section.autolabel" select="1"/>
+ <xsl:param name="section.label.includes.component.label" select="1"/>
+
+ <!--###################################################
+ Titles
+ ################################################### -->
+
+ <!-- Chapter title size -->
+ <xsl:attribute-set name="chapter.titlepage.recto.style">
+ <xsl:attribute name="text-align">left</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.8"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Why is the font-size for chapters hardcoded in the XSL FO templates?
+ Let's remove it, so this sucker can use our attribute-set only... -->
+ <xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="chapter.titlepage.recto.style">
+ <xsl:call-template name="component.title">
+ <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
+ </xsl:call-template>
+ </fo:block>
+ </xsl:template>
+
+ <!-- Sections 1, 2 and 3 titles have a small bump factor and padding -->
+ <xsl:attribute-set name="section.title.level1.properties">
+ <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.5"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="section.title.level2.properties">
+ <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0.6em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.25"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="section.title.level3.properties">
+ <xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">0.4em</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.0"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Titles of formal objects (tables, examples, ...) -->
+ <xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="hyphenate">false</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!--###################################################
+ Programlistings
+ ################################################### -->
+
+ <!-- Verbatim text formatting (programlistings) -->
+ <xsl:attribute-set name="monospace.verbatim.properties">
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.small * 1.0"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <xsl:attribute-set name="verbatim.properties">
+ <xsl:attribute name="space-before.minimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">1em</xsl:attribute>
+ <xsl:attribute name="border-color">#444444</xsl:attribute>
+ <xsl:attribute name="border-style">solid</xsl:attribute>
+ <xsl:attribute name="border-width">0.1pt</xsl:attribute>
+ <xsl:attribute name="padding-top">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-left">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-right">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-bottom">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-left">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-right">0.5em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Shade (background) programlistings -->
+ <xsl:param name="shade.verbatim">1</xsl:param>
+ <xsl:attribute-set name="shade.verbatim.style">
+ <xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!--###################################################
+ Callouts
+ ################################################### -->
+
+ <!-- Use images for callouts instead of (1) (2) (3) -->
+ <xsl:param name="callout.graphics">0</xsl:param>
+ <xsl:param name="callout.unicode">1</xsl:param>
+
+ <!-- Place callout marks at this column in annotated areas -->
+ <xsl:param name="callout.defaultcolumn">90</xsl:param>
+
+ <!--###################################################
+ Admonitions
+ ################################################### -->
+
+ <!-- Use nice graphics for admonitions -->
+ <xsl:param name="admon.graphics">'1'</xsl:param>
+ <xsl:param name="admon.graphics.path">&admon_gfx_path;</xsl:param>
+
+ <!--###################################################
+ Misc
+ ################################################### -->
+
+ <!-- Placement of titles -->
+ <xsl:param name="formal.title.placement">
+ figure after
+ example before
+ equation before
+ table before
+ procedure before
+ </xsl:param>
+
+ <!-- Format Variable Lists as Blocks (prevents horizontal overflow) -->
+ <xsl:param name="variablelist.as.blocks">1</xsl:param>
+
+ <!-- The horrible list spacing problems -->
+ <xsl:attribute-set name="list.block.spacing">
+ <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!--###################################################
+ colored and hyphenated links
+ ################################################### -->
+ <xsl:template match="ulink">
+ <fo:basic-link external-destination="{@url}"
+ xsl:use-attribute-sets="xref.properties"
+ text-decoration="underline"
+ color="blue">
+ <xsl:choose>
+ <xsl:when test="count(child::node())=0">
+ <xsl:value-of select="@url"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </fo:basic-link>
+ </xsl:template>
+
+</xsl:stylesheet>
Added: activemq/camel/trunk/camel-book/src/styles/docbook.xsl
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-book/src/styles/docbook.xsl?view=auto&rev=547564
==============================================================================
--- activemq/camel/trunk/camel-book/src/styles/docbook.xsl (added)
+++ activemq/camel/trunk/camel-book/src/styles/docbook.xsl Fri Jun 15 00:24:27 2007
@@ -0,0 +1,572 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:saxon="http://icl.com/saxon"
+ exclude-result-prefixes="xsl fo html saxon">
+ <xsl:output method="xml" indent="no"/>
+ <xsl:param name="filename"></xsl:param>
+ <xsl:param name="prefix">wb</xsl:param>
+ <xsl:param name="imageLocation" select="div/@imageLocation"/>
+ <xsl:param name="bridgeprefix">br_</xsl:param>
+ <xsl:param name="root_url" select="div/@baseURL"/>
+ <!-- This template converts each "wiki-content maincontent" DIV into a DocBook
+ section. -->
+ <xsl:template match="div[contains(@class,'wiki-content maincontent')]">
+ <chapter >
+ <xsl:attribute name="id">
+ <xsl:value-of select="@chapterId"/>
+ </xsl:attribute>
+ <title>
+ <xsl:value-of select="@chapterTitle"/>
+ </title>
+ <section>
+ <xsl:if test="$filename != ''">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$prefix"/>
+ <xsl:text>_</xsl:text>
+ <xsl:value-of select="translate($filename,' ()','__')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="*"/>
+ </section>
+ </chapter>
+ </xsl:template>
+ <!-- This template matches on all HTML header items and makes them into
+ bridgeheads. It attempts to assign an ID to each bridgehead by looking
+ for a named anchor as a child of the header or as the immediate preceding
+ or following sibling -->
+ <xsl:template
+ match="h1
+ |h2
+ |h3
+ |h4
+ |h5
+ |h6">
+ <bridgehead>
+ <xsl:choose>
+ <xsl:when test="count(a/@name)">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$bridgeprefix"/>
+ <xsl:value-of select="a/@name"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when
+ test="preceding-sibling::* = preceding-sibling::a[@name != '']">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$bridgeprefix"/>
+ <xsl:value-of
+ select="concat($prefix,preceding-sibling::a[1]/@name)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when
+ test="following-sibling::* = following-sibling::a[@name != '']">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$bridgeprefix"/>
+ <xsl:value-of
+ select="concat($prefix,following-sibling::a[1]/@name)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates/>
+ </bridgehead>
+ </xsl:template>
+ <!-- These templates perform one-to-one conversions of HTML elements into
+ DocBook elements -->
+ <xsl:template match="p">
+ <!-- if the paragraph has no text (perhaps only a child <img>), don't
+ make it a para -->
+ <xsl:choose>
+ <xsl:when test="normalize-space(.) = ''">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:otherwise>
+ <para>
+ <xsl:apply-templates/>
+ </para>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="pre">
+ <programlisting>
+ <xsl:apply-templates/>
+ </programlisting>
+ </xsl:template>
+ <!-- Hyperlinks -->
+ <xsl:template match="a[contains(@href,'http://')]" priority="1.5">
+ <ulink>
+ <xsl:attribute name="url">
+ <xsl:value-of select="normalize-space(@href)"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </ulink>
+ </xsl:template>
+ <xsl:template match="a[contains(@href,'.htm')]" priority="1.5">
+ <ulink>
+ <xsl:attribute name="url">
+ <xsl:value-of select="$root_url"/>
+ <xsl:value-of select="normalize-space(@href)"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </ulink>
+ </xsl:template>
+ <xsl:template match="a[contains(@href,'ftp://')]" priority="1.5">
+ <ulink>
+ <xsl:attribute name="url">
+ <xsl:value-of select="normalize-space(@href)"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </ulink>
+ </xsl:template>
+ <!--xsl:template match="a[contains(@href,'#')]" priority="0.6">
+ <xref>
+ <xsl:attribute name="linkend">
+ <xsl:call-template name="make_id">
+ <xsl:with-param name="string" select="substring-after(@href,'#')"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xref>
+</xsl:template-->
+ <xsl:template match="a[@name != '']" priority="0.6">
+ <anchor>
+ <xsl:attribute name="id">
+ <xsl:call-template name="make_id">
+ <xsl:with-param name="string" select="@name"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </anchor>
+ </xsl:template>
+ <xsl:template match="a[@href != '']">
+ <xref>
+ <xsl:attribute name="linkend">
+ <xsl:value-of select="$prefix"/>
+ <xsl:text>_</xsl:text>
+ <xsl:call-template name="make_id">
+ <xsl:with-param name="string" select="@href"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xref>
+ </xsl:template>
+ <!-- Need to come up with good template for converting filenames into ID's -->
+ <xsl:template name="make_id">
+ <xsl:param name="string" select="''"/>
+ <xsl:variable name="fixedname">
+ <xsl:call-template name="get_filename">
+ <xsl:with-param name="path"
+ select="translate($string,' \()','_/_')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($fixedname,'.htm')">
+ <xsl:value-of select="substring-before($fixedname,'.htm')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$fixedname"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="string.subst">
+ <xsl:param name="string" select="''"/>
+ <xsl:param name="substitute" select="''"/>
+ <xsl:param name="with" select="''"/>
+ <xsl:choose>
+ <xsl:when test="contains($string,$substitute)">
+ <xsl:variable name="pre"
+ select="substring-before($string,$substitute)"/>
+ <xsl:variable name="post"
+ select="substring-after($string,$substitute)"/>
+ <xsl:call-template name="string.subst">
+ <xsl:with-param name="string"
+ select="concat($pre,$with,$post)"/>
+ <xsl:with-param name="substitute" select="$substitute"/>
+ <xsl:with-param name="with" select="$with"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- Images -->
+ <!-- Images and image maps -->
+ <xsl:template match="img">
+ <xsl:variable name="tag_name">
+ <xsl:choose>
+ <xsl:when
+ test="boolean(parent::p) and
+ boolean(normalize-space(parent::p/text()))">
+ <xsl:text>inlinemediaobject</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>mediaobject</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$tag_name}">
+ <imageobject>
+ <xsl:call-template name="process.image"/>
+ </imageobject>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="process.image">
+ <imagedata>
+ <xsl:attribute name="fileref">
+ <xsl:call-template name="make_absolute">
+ <xsl:with-param name="filename" select="@src"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@height != ''">
+ <xsl:attribute name="depth">
+ <xsl:value-of select="@height"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@width != ''">
+ <xsl:attribute name="width">
+ <xsl:value-of select="@width"/>
+ </xsl:attribute>
+ </xsl:if>
+ </imagedata>
+ </xsl:template>
+ <xsl:template name="make_absolute">
+ <xsl:param name="filename"/>
+ <xsl:variable name="name_only">
+ <xsl:call-template name="get_filename">
+ <xsl:with-param name="path" select="$filename"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$imageLocation"/>
+ <xsl:value-of select="$name_only"/>
+ </xsl:template>
+ <xsl:template match="ul[count(*) = 0]">
+ <xsl:message>Matched</xsl:message>
+ <blockquote>
+ <xsl:apply-templates/>
+ </blockquote>
+ </xsl:template>
+ <xsl:template name="get_filename">
+ <xsl:param name="path"/>
+ <xsl:choose>
+ <xsl:when test="contains($path,'/')">
+ <xsl:call-template name="get_filename">
+ <xsl:with-param name="path"
+ select="substring-after($path,'/')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$path"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- LIST ELEMENTS -->
+ <xsl:template match="ul">
+ <itemizedlist>
+ <xsl:apply-templates/>
+ </itemizedlist>
+ </xsl:template>
+ <xsl:template match="ol">
+ <orderedlist>
+ <xsl:apply-templates/>
+ </orderedlist>
+ </xsl:template>
+ <!-- This template makes a DocBook variablelist out of an HTML definition list -->
+ <xsl:template match="dl">
+ <variablelist>
+ <xsl:for-each select="dt">
+ <varlistentry>
+ <term>
+ <xsl:apply-templates/>
+ </term>
+ <listitem>
+ <xsl:apply-templates select="following-sibling::dd[1]"/>
+ </listitem>
+ </varlistentry>
+ </xsl:for-each>
+ </variablelist>
+ </xsl:template>
+ <xsl:template match="dd">
+ <xsl:choose>
+ <xsl:when test="boolean(p)">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:otherwise>
+ <para>
+ <xsl:apply-templates/>
+ </para>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="li">
+ <listitem>
+ <xsl:choose>
+ <xsl:when test="count(p) = 0">
+ <para>
+ <xsl:apply-templates/>
+ </para>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </listitem>
+ </xsl:template>
+ <xsl:template match="*">
+ <xsl:message>No template for <xsl:value-of select="name()"/>
+ </xsl:message>
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="@*">
+ <xsl:message>No template for <xsl:value-of select="name()"/>
+ </xsl:message>
+ <xsl:apply-templates/>
+ </xsl:template>
+ <!-- inline formatting -->
+ <xsl:template match="b">
+ <emphasis role="bold">
+ <xsl:apply-templates/>
+ </emphasis>
+ </xsl:template>
+ <xsl:template match="i">
+ <emphasis>
+ <xsl:apply-templates/>
+ </emphasis>
+ </xsl:template>
+ <xsl:template match="u">
+ <citetitle>
+ <xsl:apply-templates/>
+ </citetitle>
+ </xsl:template>
+ <!-- Ignored elements -->
+ <xsl:template match="hr"/>
+ <xsl:template match="h1[1]|h2[1]|h3[1]" priority="1"/>
+ <xsl:template match="br"/>
+ <xsl:template match="p[normalize-space(.) = '' and count(*) = 0]"/>
+ <xsl:template match="text()">
+ <xsl:choose>
+ <xsl:when test="normalize-space(.) = ''"></xsl:when>
+ <xsl:otherwise>
+ <xsl:copy/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- Workbench Hacks -->
+ <xsl:template match="div[contains(@style,'margin-left: 2em')]">
+ <blockquote>
+ <para>
+ <xsl:apply-templates/>
+ </para>
+ </blockquote>
+ </xsl:template>
+ <xsl:template
+ match="a[@href != ''
+ and not(boolean(ancestor::p|ancestor::li))]"
+ priority="1">
+ <para>
+ <xref>
+ <xsl:attribute name="linkend">
+ <xsl:value-of select="$prefix"/>
+ <xsl:text>_</xsl:text>
+ <xsl:call-template name="make_id">
+ <xsl:with-param name="string" select="@href"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xref>
+ </para>
+ </xsl:template>
+ <xsl:template
+ match="a[contains(@href,'#')
+ and not(boolean(ancestor::p|ancestor::li))]"
+ priority="1.1">
+ <para>
+ <xref>
+ <xsl:attribute name="linkend">
+ <xsl:value-of select="$prefix"/>
+ <xsl:text>_</xsl:text>
+ <xsl:call-template name="make_id">
+ <xsl:with-param name="string"
+ select="substring-after(@href,'#')"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xref>
+ </para>
+ </xsl:template>
+ <!-- Table conversion -->
+ <xsl:template name="generate-table">
+ <xsl:variable name="column_count">
+ <xsl:call-template name="count_columns">
+ <xsl:with-param name="table" select="."/>
+ </xsl:call-template>
+ </xsl:variable>
+ <informaltable>
+ <tgroup>
+ <xsl:attribute name="cols">
+ <xsl:value-of select="$column_count"/>
+ </xsl:attribute>
+ <xsl:call-template name="generate-colspecs">
+ <xsl:with-param name="count" select="$column_count"/>
+ </xsl:call-template>
+ <thead>
+ <xsl:apply-templates select="tr[1]"/>
+ </thead>
+ <tbody>
+ <xsl:apply-templates select="tr[position() != 1]"/>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </xsl:template>
+ <xsl:template match="table">
+ <xsl:param name="element" select="./tbody"/>
+ <xsl:choose>
+ <xsl:when test="local-name($element) != 'tbody'">
+ <xsl:call-template name="generate-table"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="column_count">
+ <xsl:call-template name="count_columns">
+ <xsl:with-param name="table" select="./tbody"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <informaltable>
+ <tgroup>
+ <xsl:attribute name="cols">
+ <xsl:value-of select="$column_count"/>
+ </xsl:attribute>
+ <xsl:call-template name="generate-colspecs">
+ <xsl:with-param name="count"
+ select="$column_count"/>
+ </xsl:call-template>
+ <thead>
+ <xsl:apply-templates select="./tbody/tr[1]"/>
+ </thead>
+ <tbody>
+ <xsl:apply-templates
+ select="./tbody/tr[position() != 1]"/>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="generate-colspecs">
+ <xsl:param name="count" select="0"/>
+ <xsl:param name="number" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$count < $number"/>
+ <xsl:otherwise>
+ <colspec>
+ <xsl:attribute name="colnum">
+ <xsl:value-of select="$number"/>
+ </xsl:attribute>
+ <xsl:attribute name="colname">
+ <xsl:value-of select="concat('col',$number)"/>
+ </xsl:attribute>
+ </colspec>
+ <xsl:call-template name="generate-colspecs">
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="number" select="$number + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="tr">
+ <row>
+ <xsl:apply-templates/>
+ </row>
+ </xsl:template>
+ <xsl:template match="th|td">
+ <xsl:variable name="position" select="count(preceding-sibling::*) + 1"/>
+ <entry>
+ <xsl:if test="@colspan > 1">
+ <xsl:attribute name="namest">
+ <xsl:value-of select="concat('col',$position)"/>
+ </xsl:attribute>
+ <xsl:attribute name="nameend">
+ <xsl:value-of
+ select="concat('col',$position + number(@colspan) - 1)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@rowspan > 1">
+ <xsl:attribute name="morerows">
+ <xsl:value-of select="number(@rowspan) - 1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </entry>
+ </xsl:template>
+ <xsl:template match="td_null">
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template name="count_columns">
+ <xsl:param name="table" select="."/>
+ <xsl:param name="row" select="$table/tr[1]"/>
+ <xsl:param name="max" select="0"/>
+ <xsl:choose>
+ <!-- let's comment this since it can be a tbody tag
+ <xsl:when test="local-name($table) != 'table'">
+ <xsl:message>Attempting to count columns on a non-table element</xsl:message>
+ </xsl:when>
+ -->
+ <xsl:when test="local-name($row) != 'tr'">
+ <xsl:message>Row parameter is not a valid row</xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Count cells in the current row -->
+ <xsl:variable name="current_count">
+ <xsl:call-template name="count_cells">
+ <xsl:with-param name="cell"
+ select="$row/td[1]|$row/th[1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- Check for the maximum value of $current_count and $max -->
+ <xsl:variable name="new_max">
+ <xsl:choose>
+ <xsl:when test="$current_count > $max">
+ <xsl:value-of select="number($current_count)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number($max)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- If this is the last row, return $max, otherwise continue -->
+ <xsl:choose>
+ <xsl:when test="count($row/following-sibling::tr) = 0">
+ <xsl:value-of select="$new_max"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="count_columns">
+ <xsl:with-param name="table" select="$table"/>
+ <xsl:with-param name="row"
+ select="$row/following-sibling::tr"/>
+ <xsl:with-param name="max" select="$new_max"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="count_cells">
+ <xsl:param name="cell"/>
+ <xsl:param name="count" select="0"/>
+ <xsl:variable name="new_count">
+ <xsl:choose>
+ <xsl:when test="$cell/@colspan > 1">
+ <xsl:value-of
+ select="number($cell/@colspan) + number($count)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number('1') + number($count)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="count($cell/following-sibling::*) > 0">
+ <xsl:call-template name="count_cells">
+ <xsl:with-param name="cell"
+ select="$cell/following-sibling::*[1]"/>
+ <xsl:with-param name="count" select="$new_count"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$new_count"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
Added: activemq/camel/trunk/tooling/maven/maven-html-to-docbook/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/maven-html-to-docbook/pom.xml?view=auto&rev=547564
==============================================================================
--- activemq/camel/trunk/tooling/maven/maven-html-to-docbook/pom.xml (added)
+++ activemq/camel/trunk/tooling/maven/maven-html-to-docbook/pom.xml Fri Jun 15 00:24:27 2007
@@ -0,0 +1,46 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+
+
+ <artifactId>maven-html-to-docbook</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Camel :: Html to Docbook Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>jtidy</groupId>
+ <artifactId>jtidy</artifactId>
+ <version>4aug2000r7-dev</version>
+ </dependency>
+ </dependencies>
+</project>
Added: activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/java/org/apache/camel/maven/GenerateDocBookMojo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/java/org/apache/camel/maven/GenerateDocBookMojo.java?view=auto&rev=547564
==============================================================================
--- activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/java/org/apache/camel/maven/GenerateDocBookMojo.java (added)
+++ activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/java/org/apache/camel/maven/GenerateDocBookMojo.java Fri Jun 15 00:24:27 2007
@@ -0,0 +1,323 @@
+/**
+ *
+ * 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.
+ */
+package org.apache.camel.maven;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
+import java.util.StringTokenizer;
+import java.net.URL;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NamedNodeMap;
+
+import org.w3c.tidy.Tidy;
+
+/**
+ * Goal which extracts the content of a wiki page and converts it to docbook
+ * format
+ *
+ * @goal htmlToDocbook
+ * @phase process-sources
+ */
+public class GenerateDocBookMojo extends AbstractMojo {
+
+ /**
+ * Base URL.
+ *
+ * @parameter expression="${baseURL}"
+ * default-value="http://activemq.apache.org/camel/"
+ * @required
+ */
+ private String baseURL;
+
+ /**
+ * List of resources
+ *
+ * @parameter
+ */
+ private String[] resources;
+
+ /**
+ * List of author's fullname
+ *
+ * @parameter
+ */
+ private String[] authors;
+
+ /**
+ * Location of the xsl file.
+ *
+ * @parameter expression="${configDirectory}"
+ * default-value="${basedir}/src/styles/docbook.xsl"
+ * @required
+ */
+ private String xslFile;
+
+ /**
+ * Location of the output directory.
+ *
+ * @parameter expression="${project.build.directory}/docbkx/source"
+ */
+ private String outputPath;
+
+ /**
+ * @parameter expression="${title}"
+ * @required
+ */
+ private String title;
+
+ /**
+ * @parameter expression="${subtitle}"
+ */
+ private String subtitle;
+
+ /**
+ * @parameter expression="${version}" default-value="${project.version}"
+ */
+ private String version;
+
+ /**
+ * @parameter expression="${legalNotice}"
+ */
+ private String legalNotice;
+
+ /**
+ * Location of image files.
+ *
+ * @parameter expression="${imageLocation}"
+ * ${project.build.directory}/docbkx/source/images"
+ */
+ private String imageLocation;
+
+ private String chapterId;
+
+ private String chapterTitle;
+
+ public void execute() throws MojoExecutionException {
+ File outputDir = new File(outputPath);
+ if (!outputDir.exists()) {
+ outputDir.mkdirs();
+ }
+ this.createMainXML();
+
+ for (int i = 0; i < resources.length; ++i) {
+ this.setChapterId( removeExtension(resources[i]));
+ this.setChapterTitle( removeExtension(resources[i]));
+
+ process(resources[i]);
+ }
+
+ }
+
+
+ /**
+ * Extract the wiki content and tranform it into docbook format
+ *
+ * @param resource
+ */
+ public void process(String resource) {
+
+ Tidy tidy = new Tidy();
+ ByteArrayOutputStream out;
+
+ tidy.setXmlOut(true);
+ try {
+ out = new ByteArrayOutputStream();
+ URL u = new URL(baseURL + resource);
+ Document doc = tidy.parseDOM(
+ new BufferedInputStream(u.openStream()), out);
+ out.close();
+ // let's extract the div element with class="wiki-content
+ // maincontent"
+ NodeList nodeList = doc.getElementsByTagName("div");
+ for (int i = 0; i < nodeList.getLength(); ++i) {
+ Node node = nodeList.item(i);
+
+ NamedNodeMap nm = node.getAttributes();
+ Node attr = nm.getNamedItem("class");
+
+ if (attr != null
+ && attr.getNodeValue().equalsIgnoreCase(
+ "wiki-content maincontent")) {
+
+ // These attributes will be used by xsl to
+ Element element = (Element) node;
+ element.setAttribute("chapterId", chapterId);
+ element.setAttribute("chapterTitle", chapterTitle);
+ element.setAttribute("baseURL", baseURL);
+ element.setAttribute("imageLocation", imageLocation);
+
+ DOMSource source = new DOMSource(node);
+
+
+ BufferedOutputStream output = new BufferedOutputStream(
+ new FileOutputStream(outputPath + File.separator
+ + removeExtension(resource) + ".xml"));
+ StreamResult result = new StreamResult(output);
+ TransformerFactory tFactory = TransformerFactory
+ .newInstance();
+ Transformer transformer = tFactory
+ .newTransformer(new StreamSource(xslFile));
+ transformer.transform(source, result);
+
+ break;
+ }
+
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println(this.toString() + e.toString());
+ }
+ }
+
+
+ /*
+ * create the main docbook xml file
+ */
+ public void createMainXML() {
+ try {
+
+ PrintWriter out = new PrintWriter(new FileWriter(outputPath
+ + File.separator + title + ".xml"));
+
+ out
+ .println("<!DOCTYPE book PUBLIC \"-//OASIS//DTD DocBook XML V4.4//EN\" \"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd\" ");
+ out.println("[");
+
+ for (int i = 0; i < resources.length; ++i) {
+ out.println("<!ENTITY " + removeExtension(resources[i]) + " SYSTEM \"" + removeExtension(resources[i])
+ + ".xml \">");
+ }
+
+ out.println("]>");
+ out.println("<book>");
+ out.println("<bookinfo>");
+ out.println("<title>" + title + "</title>");
+ out.println("<subtitle>" + subtitle + "</subtitle>");
+ out.println("<releaseinfo>" + version + "</releaseinfo>");
+ out.println(" <authorgroup>");
+ if (authors != null) {
+ for (int i = 0; i < authors.length; ++i) {
+ StringTokenizer name = new StringTokenizer(authors[i]);
+ String fname = name.nextToken();
+ String lname = "";
+ if (name.hasMoreTokens()) {
+ lname = name.nextToken();
+ }
+ out.println("<author>");
+ out.println("<firstname>" + fname + "</firstname>");
+ out.println("<surname>" + lname + "</surname>");
+ out.println("</author>");
+
+ }
+ }
+
+ out.println("</authorgroup>");
+ out.println("<legalnotice>");
+ if (legalNotice != null && legalNotice.length() > 0) {
+ out.println("<para>");
+ out.println(legalNotice);
+ out.println("</para>");
+ } else {
+ out
+ .println("<para>Licensed to the Apache Software Foundation (ASF) under one or more");
+ out
+ .println("contributor license agreements. See the NOTICE file distributed with");
+ out
+ .println("this work for additional information regarding copyright ownership. The");
+ out
+ .println("ASF licenses this file to You under the Apache License, Version 2.0 (the");
+ out
+ .println("\"License\"); you may not use this file except in compliance with the");
+ out
+ .println("License. You may obtain a copy of the License at</para>");
+ out
+ .println("<para>http://www.apache.org/licenses/LICENSE-2.0</para>");
+ out
+ .println("<para>Unless required by applicable law or agreed to in writing,");
+ out
+ .println(" software distributed under the License is distributed on an \"AS IS\"");
+ out
+ .println("BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or");
+ out
+ .println("implied. See the License for the specific language governing permissions");
+ out.println("and limitations under the License.</para>");
+ }
+
+ out.println("</legalnotice>");
+ out.println("</bookinfo>");
+ out.println("<toc></toc>");
+
+ for (int i = 0; i < resources.length; ++i) {
+ out.println("&" + removeExtension(resources[i]) + ";");
+ }
+
+ out.println("</book>");
+ out.flush();
+ out.close();
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public String getChapterId() {
+ return chapterId;
+ }
+
+ public void setChapterId(String chapterId) {
+ this.chapterId = chapterId;
+ }
+
+ public String getChapterTitle() {
+ return chapterTitle;
+ }
+
+ public void setChapterTitle(String chapterTitle) {
+ this.chapterTitle = chapterTitle;
+ }
+
+ public String removeExtension(String resource) {
+ int index = resource.indexOf('.');
+ return resource.substring(0, index);
+ }
+}
Added: activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/resources/META-INF/NOTICE.txt
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/resources/META-INF/NOTICE.txt?view=auto&rev=547564
==============================================================================
--- activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/resources/META-INF/NOTICE.txt (added)
+++ activemq/camel/trunk/tooling/maven/maven-html-to-docbook/src/main/resources/META-INF/NOTICE.txt Fri Jun 15 00:24:27 2007
@@ -0,0 +1,12 @@
+=========================================================================
+== NOTICE file corresponding to the section 4 d of ==
+== the Apache License, Version 2.0, ==
+== in this case for the Apache ActiveMQ distribution. ==
+=========================================================================
+
+Apache Camel
+Copyright 2005-2006 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+