You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2017/06/30 21:29:50 UTC
[3/3] ant-ivy git commit: Make the generation the book.html file,
the doc in one page
Make the generation the book.html file, the doc in one page
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/7e764a32
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/7e764a32
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/7e764a32
Branch: refs/heads/master
Commit: 7e764a320cc186ce9ae1f9cd54b0f00857e89983
Parents: e45dd5d
Author: Nicolas Lalevée <ni...@hibnet.org>
Authored: Fri Jun 30 23:29:29 2017 +0200
Committer: Nicolas Lalevée <ni...@hibnet.org>
Committed: Fri Jun 30 23:29:29 2017 +0200
----------------------------------------------------------------------
asciidoc/templates/book/document.html.slim | 53 ++++++++++++++++++
build-release.xml | 71 ++++++++++++++++++++++---
2 files changed, 117 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/7e764a32/asciidoc/templates/book/document.html.slim
----------------------------------------------------------------------
diff --git a/asciidoc/templates/book/document.html.slim b/asciidoc/templates/book/document.html.slim
new file mode 100644
index 0000000..126676e
--- /dev/null
+++ b/asciidoc/templates/book/document.html.slim
@@ -0,0 +1,53 @@
+doctype transitional
+/!
+/! 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.
+html lang=(attr :lang, 'en' unless attr? :nolang)
+ head
+ meta http-equiv="Content-Type" content="text/html; charset=utf-8"
+ meta name='generator' content="Asciidoctor #{attr 'asciidoctor-version'}"
+ title="Apache Ivy™ Documentation #{attr 'version'}"
+ link rel="stylesheet" type="text/css" href="./style/style.css"
+ link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css"
+ script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js" type="text/javascript"
+ javascript:
+ hljs.initHighlightingOnLoad();
+ body id="book"
+ div id="body"
+ table id="header" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%"
+ tr
+ td id="home" width="30%"
+ a href="http://ant.apache.org/" title="Apache Ant"
+ img src="./images/ant-project-logo.svg" alt="Apache Ant" border="0" height="80px"/
+ td class="product" width="70%" align="right" valign="middle"
+ img src="./images/logo.png" alt="ivy" border="0"/
+ div id="title"
+ | Documentation (#{attr 'version'})
+ div id="main"
+ #content=content
+ div id="footer-message" class="footer"
+ hr/
+ i
+ | Copyright © 2017 The Apache Software Foundation, Licensed under the
+ a href="http://www.apache.org/licenses/" Apache License, Version 2.0
+ | .
+ br/
+ i
+ | Apache Ivy, Apache Ant, Ivy, Ant, Apache, the Apache Ivy logo, the Apache Ant logo and the Apache feather logo are trademarks of The Apache Software Foundation.
+ br/
+ i
+ | All other marks mentioned may be trademarks or registered trademarks of their respective owners.
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/7e764a32/build-release.xml
----------------------------------------------------------------------
diff --git a/build-release.xml b/build-release.xml
index 4b138d3..84bd0e2 100644
--- a/build-release.xml
+++ b/build-release.xml
@@ -165,9 +165,19 @@
<replace dir="${output.dir}" token="${ivy.revision}" value="working@apache"/>
</target>
- <target name="generate-doc" depends="generate-tutorial-output,default-version">
+ <target name="init-asciidoctor" depends="init-ivy" unless="skip.doc">
<ivy:cachepath pathid="asciidoctor.path" organisation="org.asciidoctor" module="asciidoctor-ant" revision="1.5.4" inline="true"/>
<taskdef uri="antlib:org.asciidoctor.ant" resource="org/asciidoctor/ant/antlib.xml" classpathref="asciidoctor.path"/>
+ </target>
+
+ <target name="copy-doc-files" unless="skip.doc">
+ <copy todir="${doc.build.dir}">
+ <fileset dir="${doc.src.dir}" includes="images/**,style/**,samples/**,js/**,ivy.xsd"/>
+ <fileset dir="${doc.src.dir}" includes="tutorial/log/multi-project-general-publishall.txt"/>
+ </copy>
+ </target>
+
+ <target name="generate-doc" depends="generate-tutorial-output,default-version,init-asciidoctor,copy-doc-files" unless="skip.doc">
<asciidoctor:convert sourceDirectory="${doc.src.dir}" outputDirectory="${doc.build.dir}" backend="xhtml5"
templateDir="${doc.src.dir}/templates" preserveDirectories="true"
sourceHighlighter="highlightjs">
@@ -175,14 +185,61 @@
<attribute key="imagesdir" value=""/>
<attribute key="version" value="${build.version}" />
</asciidoctor:convert>
- <!-- copy static resources -->
- <copy todir="${doc.build.dir}">
- <fileset dir="${doc.src.dir}" includes="images/**,style/**,samples/**,js/**,ivy.xsd"/>
- <fileset dir="${doc.src.dir}" includes="tutorial/log/multi-project-general-publishall.txt"/>
- </copy>
</target>
- <target name="all-doc" depends="javadoc,generate-doc"/>
+ <target name="generate-book-adoc" depends="default-version,copy-doc-files" unless="skip.doc">
+ <scriptdef name="generate-book-adoc" language="javascript">
+ <attribute name="jsontocfile" />
+ <attribute name="destFile" />
+ <![CDATA[
+ var tocfile = self.getProject().resolveFile(attributes.get("jsontocfile"))
+ r = new java.io.BufferedReader(new java.io.FileReader(tocfile));
+ var val = "";
+ while((s = r.readLine()) != null) {
+ val += s;
+ }
+ r.close();
+ var toc = eval("("+val+")")
+
+ var writeToc = function(o, children, level) {
+ for(var c in children) {
+ o.write(level + ' link:#' + children[c].id.replace(/\//g, '_') + '[' + children[c].title + ']\n');
+ if (children[c].children && children[c].children.length && children[c].children.length != 0) {
+ writeToc(o, children[c].children, level+'*');
+ }
+ }
+ };
+
+ var writeInclude = function(o, children) {
+ for(var c in children) {
+ o.write('== [[' + children[c].id.replace(/\//g, '_') + ']]' + children[c].title + '\n\n');
+ o.write('include::../asciidoc/' + children[c].id + '.adoc[]\n\n');
+ if (children[c].children && children[c].children.length && children[c].children.length != 0) {
+ writeInclude(o, children[c].children);
+ }
+ }
+ };
+
+ out = new java.io.FileWriter(self.getProject().resolveFile(attributes.get("destfile")));
+ out.write('== Table of Contents\n\n');
+ writeToc(out, toc.children[0].children, '*');
+ out.write('\n\n');
+ writeInclude(out, toc.children[0].children, '*');
+ out.close();
+ ]]>
+ </scriptdef>
+ <mkdir dir="${build.dir}/book" />
+ <generate-book-adoc jsontocfile="${doc.src.dir}/toc.json" destFile="${build.dir}/book/book.adoc" />
+ </target>
+
+ <target name="generate-book" depends="generate-book-adoc,init-asciidoctor">
+ <asciidoctor:convert sourceDirectory="${build.dir}/book" outputDirectory="${doc.build.dir}" backend="xhtml5"
+ templateDir="${doc.src.dir}/templates/book" sourceHighlighter="highlightjs" doctype="book">
+ <attribute key="version" value="${build.version}" />
+ </asciidoctor:convert>
+ </target>
+
+ <target name="all-doc" depends="javadoc,generate-doc,generate-book"/>
<target name="init-snapshot" depends="default-version">
<property name="snapshot.full.name" value="apache-ivy-${build.version}"/>