diff --git a/content-de/pom.xml b/content-de/pom.xml index 07a7477..84372b4 100644 --- a/content-de/pom.xml +++ b/content-de/pom.xml @@ -125,8 +125,8 @@ org.sonatype.book - maven-book-sitemesh-plugin - 1.0-SNAPSHOT + book-sitemesh-plugin + 1.0 mesh-velocity diff --git a/content-en/pom.xml b/content-en/pom.xml index a416ea6..a5d5688 100644 --- a/content-en/pom.xml +++ b/content-en/pom.xml @@ -140,8 +140,8 @@ org.sonatype.book - maven-book-sitemesh-plugin - 1.0-SNAPSHOT + book-sitemesh-plugin + 1.0 mesh-velocity diff --git a/content-fr/pom.xml b/content-fr/pom.xml index d1c9fb3..de0a67f 100644 --- a/content-fr/pom.xml +++ b/content-fr/pom.xml @@ -125,8 +125,8 @@ org.sonatype.book - maven-book-sitemesh-plugin - 1.0-SNAPSHOT + book-sitemesh-plugin + 1.0 mesh-velocity diff --git a/content-fr/pom.xml~ b/content-fr/pom.xml~ deleted file mode 100644 index 2243d64..0000000 --- a/content-fr/pom.xml~ +++ /dev/null @@ -1,204 +0,0 @@ - - 4.0.0 - - org.sonatype.mavenbook - book - 0.3-SNAPSHOT - - content-fr - jar - Maven: The Definitive Guide (French Translation) - A book about Apache Maven 2.x - - Sonatype, Inc. - - - http://sonatype.com/book - - - Maven: The Definitive Guide - A Comprehensive Guide to Apache Maven (French Translation) - 800 W. El Camino Real, Suite 400, Mountain View, CA, 94040 - Sonatype: The Maven Company - http://cms.sonatype.com/sites/all/themes/sonatype/images/sonatype_logo.gif - 2008 - nexus-enterprise-webapp-1.2.0-beta-4-bundle - nexus-enterprise-1.2.0-beta-4 - 1.2.0-beta-4 - 2.0.10 - http://books.sonatype.com/nexus-book-stage/ - Repository Management with Nexus - http://books.sonatype.com/m2eclipse-book-stage/ - Developing with Eclipse and Maven - - - - book - - - src/main/resources - true - - docbook/*.xml - xsl/html_chunk.xsl - xsl/fopdf.xsl - - - - src/main/resources - false - - docbook/*.xml - xsl/html_chunk.xsl - xsl/fopdf.xsl - - - - - - org.apache.maven.plugins - maven-resources-plugin - 2.3 - - \ - UTF-8 - - - - com.agilejava.docbkx - docbkx-maven-plugin - 2.0.7 - - - docbook - docbook - 4.5 - - - - - - generate-pdf - compile - - generate-pdf - - - ${basedir}/target/classes/docbook/ - ${basedir}/target/classes/xsl/fopdf.xsl - - - - - - - - - generate-html - compile - - generate-html - - - true - 2 - 1 - 1 - ${basedir}/target/classes/xsl/html_chunk.xsl - - - - - - - - - - - - - ${basedir}/target/classes/docbook - public-book.xml - true - - - - org.sonatype.book - maven-book-sitemesh-plugin - 1.0-SNAPSHOT - - - mesh-velocity - site - - mesh-velocity - - - src/main/resources/vm/site.vm - - - - - - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.0.1 - - - - project-team - license - mailing-list - summary - cim - - - - - - - - - publish - - - sonatype-site - Sonatype Book Examples - scp://deployer@172.16.0.1/var/www/domains/sonatype.com/books/htdocs/maven-book/ - - - - scp://deployer@172.16.0.1/var/www/domains/sonatype.com/books/htdocs/ - http://books.sonatype.com/nexus-book/ - http://books.sonatype.com/m2eclipse-book/ - - - - stage - - - sonatype-site - Sonatype Book Examples - scp://deployer@172.16.0.1/var/www/domains/sonatype.com/books/htdocs/maven-book-stage/ - - - - scp://deployer@172.16.0.1/var/www/domains/sonatype.com/books/htdocs/ - - - - - - examples - ${project.groupId} - 1.0 - pom - - - diff --git a/content-zh/pom.xml b/content-zh/pom.xml index 319d93e..5fac39b 100644 --- a/content-zh/pom.xml +++ b/content-zh/pom.xml @@ -122,8 +122,8 @@ org.sonatype.book - maven-book-sitemesh-plugin - 1.0-SNAPSHOT + book-sitemesh-plugin + 1.0 mesh-velocity diff --git a/maven-book-sitemesh-plugin/pom.xml b/maven-book-sitemesh-plugin/pom.xml deleted file mode 100644 index 17e413e..0000000 --- a/maven-book-sitemesh-plugin/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - book - org.sonatype.mavenbook - 0.3-SNAPSHOT - - 4.0.0 - org.sonatype.book - maven-book-sitemesh-plugin - maven-plugin - maven-book-sitemesh-plugin Maven Mojo - 1.0-SNAPSHOT - http://maven.apache.org - - - org.apache.maven - maven-plugin-api - 2.0 - - - junit - junit - 3.8.1 - test - - - org.apache.velocity - velocity - 1.6.1 - jar - compile - - - opensymphony - sitemesh - 2.4 - jar - compile - - - commons-io - commons-io - 1.4 - - - diff --git a/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/ContentHandler.java b/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/ContentHandler.java deleted file mode 100644 index 1eab475..0000000 --- a/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/ContentHandler.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.sonatype.book; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.util.Collection; - -import org.apache.commons.io.DirectoryWalker; -import org.apache.commons.io.filefilter.IOFileFilter; - -public class ContentHandler extends DirectoryWalker { - - private VelocityMerger velocityMerger; - - public ContentHandler(IOFileFilter directoryFilter, - IOFileFilter fileFilter, int depthLimit, VelocityMerger vMerger) { - super(directoryFilter, fileFilter, depthLimit); - this.velocityMerger = vMerger; - } - - - - @Override - protected boolean handleDirectory(File directory, int depth, - Collection results) throws IOException { - System.out.println( "WHOP: " + directory.getAbsolutePath() ); - - return true; - } - - - - @Override - protected void handleFile(File file, int depth, Collection results) - throws IOException { - System.out.println("File: " + file.getAbsolutePath()); - - SiteMeshPageExtractor extractor = new SiteMeshPageExtractor(); - extractor.parse( file ); - - try { - velocityMerger.mergeFile( file, extractor ); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - public void go(File dir, Collection results) throws IOException { - walk( dir, results); - } -} diff --git a/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/MeshVelocityMojo.java b/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/MeshVelocityMojo.java deleted file mode 100644 index 72fc901..0000000 --- a/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/MeshVelocityMojo.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.sonatype.book; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; - -import org.apache.commons.io.DirectoryWalker; -import org.apache.commons.io.filefilter.FileFilterUtils; -import org.apache.commons.io.filefilter.HiddenFileFilter; -import org.apache.commons.io.filefilter.IOFileFilter; - -/** - * @goal mesh-velocity - * - * @phase test - */ -public class MeshVelocityMojo - extends AbstractMojo -{ - /** - * Location of the file. - * @parameter expression="${basedir}/target/site" - * @required - */ - private File htmlDirectory; - - - /** - * Velocity Template - * @parameter - * @required - */ - private File velocityTemplate; - - - public void execute() - throws MojoExecutionException - { - - // Create a filter for Non-hidden directories - IOFileFilter fooDirFilter = - FileFilterUtils.andFileFilter(FileFilterUtils.directoryFileFilter(), - HiddenFileFilter.VISIBLE); - - ContentHandler handler = new ContentHandler( fooDirFilter, FileFilterUtils.suffixFileFilter(".html"), -1, new VelocityMerger( velocityTemplate )); - try { - handler.go( htmlDirectory, new ArrayList() ); - } catch (IOException e) { - throw new MojoExecutionException( "Problem during directory scan", e ); - } - - - } -} - - diff --git a/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/SiteMeshPageExtractor.java b/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/SiteMeshPageExtractor.java deleted file mode 100644 index b0af562..0000000 --- a/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/SiteMeshPageExtractor.java +++ /dev/null @@ -1,154 +0,0 @@ - package org.sonatype.book; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import org.apache.commons.io.FileUtils; - -import com.opensymphony.module.sitemesh.html.BasicRule; -import com.opensymphony.module.sitemesh.html.HTMLProcessor; -import com.opensymphony.module.sitemesh.html.Tag; -import com.opensymphony.module.sitemesh.html.TagRule; -import com.opensymphony.module.sitemesh.html.TextFilter; -import com.opensymphony.module.sitemesh.html.rules.BodyTagRule; -import com.opensymphony.module.sitemesh.html.rules.HeadExtractingRule; -import com.opensymphony.module.sitemesh.html.rules.MetaTagRule; -import com.opensymphony.module.sitemesh.html.rules.PageBuilder; -import com.opensymphony.module.sitemesh.html.rules.TitleExtractingRule; -import com.opensymphony.module.sitemesh.html.util.CharArray; - -/** - * PageExtractor which extract page information from an HTML file using the SiteMesh library. - * - * @author Joe Walnes - * @author Jörg Schaible - */ -public class SiteMeshPageExtractor -{ - private Properties properties; - private String filename; - private String head; - private String body; - private List links; - private final TagRule[] rules; - private final TextFilter[] filter; - - public SiteMeshPageExtractor() - { - rules = new TagRule[0]; - filter = new TextFilter[0]; - links = new ArrayList(); - } - - public void parse(File htmlFile) { - try { - extractContentFromHTML( FileUtils.readFileToString( htmlFile ).toCharArray() ); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private void extractContentFromHTML( char[] rawHTML ) throws IOException - { - // where to dump properties extracted from the page - properties = new Properties(); - PageBuilder pageBuilder = new PageBuilder() - { - public void addProperty( String key, String value ) - { - properties.setProperty( key, value ); - } - }; - - // buffers to hold head and body content - CharArray headBuffer = new CharArray( 64 ); - CharArray bodyBuffer = new CharArray( 4096 ); - - // setup rules for html processor - HTMLProcessor htmlProcessor = new HTMLProcessor( rawHTML, bodyBuffer ); - htmlProcessor.addRule( new BodyTagRule( pageBuilder, bodyBuffer ) ); - htmlProcessor.addRule( new HeadExtractingRule( headBuffer ) ); - htmlProcessor.addRule( new TitleExtractingRule( pageBuilder ) ); - htmlProcessor.addRule( new MetaTagRule( pageBuilder ) ); - htmlProcessor.addRule( new LinkExtractingRule() ); - - for ( int i = 0; i < rules.length; i++ ) - { - htmlProcessor.addRule( rules[i] ); - } - for ( int i = 0; i < filter.length; i++ ) - { - htmlProcessor.addTextFilter( filter[i] ); - } - - // go! - htmlProcessor.process(); - this.head = headBuffer.toString(); - this.body = bodyBuffer.toString(); - } - - public static class CannotParsePageException extends RuntimeException - { - public CannotParsePageException( Throwable cause ) - { - super( cause ); - } - } - - /** Rule for HTMLProcessor that records all links. */ - private class LinkExtractingRule extends BasicRule - { - - public boolean shouldProcess( String tag ) - { - return tag.equalsIgnoreCase( "a" ); - } - - public void process( Tag tag ) - { - if ( tag.hasAttribute( "href", false ) ) - { - links.add( tag.getAttributeValue( "href", false ) ); - } - tag.writeTo( currentBuffer() ); - } - } - - public Properties getProperties() { - return properties; - } - - public void setProperties(Properties properties) { - this.properties = properties; - } - - public String getFilename() { - return filename; - } - - public void setFilename(String filename) { - this.filename = filename; - } - - public String getHead() { - return head; - } - - public void setHead(String head) { - this.head = head; - } - - public String getBody() { - return body; - } - - public void setBody(String body) { - this.body = body; - } - - - -} diff --git a/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/VelocityMerger.java b/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/VelocityMerger.java deleted file mode 100644 index 7b597e2..0000000 --- a/maven-book-sitemesh-plugin/src/main/java/org/sonatype/book/VelocityMerger.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.sonatype.book; - -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.Reader; -import java.io.StringWriter; - -import org.apache.commons.io.IOUtils; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; - -public class VelocityMerger { - - private File velocityTemplate; - - public VelocityMerger(File velocityTemplate) { - this.velocityTemplate = velocityTemplate; - } - - public void mergeFile( File htmlFile, SiteMeshPageExtractor extractor ) throws Exception { - - - Velocity.setProperty("input.encoding", "UTF-8"); - Velocity.setProperty("output.encoding", "UTF-8"); - Velocity.setProperty("response.encoding", "UTF-8"); - Velocity.init(); - - VelocityContext context = new VelocityContext(); - context.put( "title", extractor.getProperties().get("title") ); - context.put( "head", extractor.getHead() ); - context.put( "body", extractor.getBody() ); - - Reader template = new FileReader( velocityTemplate ); - - StringWriter writer = new StringWriter(); - - Velocity.evaluate( context, writer, "MERGE", template ); - - FileWriter output = new FileWriter( htmlFile ); - IOUtils.write( writer.toString(), output ); - output.close(); - } - -} diff --git a/pom.xml b/pom.xml index 8667bc6..0cbc486 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,6 @@ content-fr content-de content-zh - maven-book-sitemesh-plugin