You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ja...@apache.org on 2017/06/19 01:58:49 UTC
[06/29] ant-ivy git commit: - update asciidoctor - improve
transforming xooki source into asciidoc source
- update asciidoctor
- improve transforming xooki source into asciidoc source
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/1760b262
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/1760b262
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/1760b262
Branch: refs/heads/master
Commit: 1760b262c2d99d7803184e471116478ef18ff4c8
Parents: 3d72f1d
Author: Nicolas Lalevée <ni...@hibnet.org>
Authored: Thu May 25 14:55:24 2017 +0200
Committer: Nicolas Lalevée <ni...@hibnet.org>
Committed: Thu May 25 14:55:24 2017 +0200
----------------------------------------------------------------------
build-release.xml | 36 +++++++---------
doc/xooki2asciidoc/xooki2asciidoc.js | 70 +++++++++++++++++++++++++++----
2 files changed, 75 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/1760b262/build-release.xml
----------------------------------------------------------------------
diff --git a/build-release.xml b/build-release.xml
index 7e3fc23..65c13c5 100644
--- a/build-release.xml
+++ b/build-release.xml
@@ -63,8 +63,8 @@
</sequential>
</macrodef>
- <target name="generate-tutorial-output" depends="jar, generate-doc-init">
- <property name="output.dir" value="${build.dir}/output" />
+ <target name="generate-tutorial-output" depends="jar" unless="skip.generate-tutorial-output">
+ <property name="output.dir" value="${basedir}/asciidoc/tutorial/log" />
<delete dir="${output.dir}" />
<mkdir dir="${output.dir}" />
@@ -164,35 +164,27 @@
<replace dir="${output.dir}" token="-f build.xml " value="" />
<replace dir="${output.dir}" token="${ivy.revision}" value="working@apache" />
- <copy todir="${doc.tmp.dir}/tutorial/log">
- <fileset dir="${output.dir}" />
- </copy>
- </target>
-
- <target name="generate-doc-init" depends="release-version">
- <!-- copy documentation to temp dir to replace version tokens -->
- <property name="doc.tmp.dir" value="${build.dir}/tempdoc" />
- <mkdir dir="${doc.tmp.dir}" />
- <copy todir="${doc.tmp.dir}" preservelastmodified="true" overwrite="true">
- <fileset dir="${doc.src.dir}" />
- <filterset>
- <filter token="version" value="${build.version}"/>
- </filterset>
- </copy>
</target>
- <target name="generate-doc" depends="init-ivy,generate-doc-init,generate-tutorial-output">
+ <target name="generate-doc" depends="init-ivy">
<ivy:cachepath pathid="asciidoctor.path">
- <dependency org="org.asciidoctor" name="asciidoctor-ant" rev="1.5.0" />
+ <dependency org="org.asciidoctor" name="asciidoctor-ant" rev="1.5.4" />
</ivy:cachepath>
<taskdef uri="antlib:org.asciidoctor.ant" resource="org/asciidoctor/ant/antlib.xml" classpathref="asciidoctor.path" />
- <asciidoctor:convert sourceDirectory="${doc.tmp.dir}" outputDirectory="${doc.build.dir}" backend="xhtml5" templateDir="${doc.src.dir}/templates" preserveDirectories="true">
- <attribute key="basedir" value="${doc.tmp.dir}" />
+ <asciidoctor:convert sourceDirectory="${doc.src.dir}" outputDirectory="${doc.build.dir}" backend="xhtml5" templateDir="${doc.src.dir}/templates" preserveDirectories="true">
+ <attribute key="basedir" value="${doc.src.dir}" />
<attribute key="imagesdir" value="" />
</asciidoctor:convert>
+ <!-- the basedir seems to fuck up the path to the output directory, let's fix that manually >
+ <delete dir="${doc.build.dir}" />
+ <mkdir dir="${doc.build.dir}" />
+ <copy todir="${doc.build.dir}">
+ <fileset dir="${doc.src.dir}/${doc.build.dir}" />
+ </copy-->
+ <!-- copy static resources -->
<copy todir="${doc.build.dir}">
<fileset dir="${doc.src.dir}" includes="images/**,style/**,samples/**,js/**,ivy.xsd" />
- <fileset dir="${doc.tmp.dir}" includes="tutorial/log/multi-project-general-publishall.txt" />
+ <fileset dir="${doc.src.dir}" includes="tutorial/log/multi-project-general-publishall.txt" />
</copy>
</target>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/1760b262/doc/xooki2asciidoc/xooki2asciidoc.js
----------------------------------------------------------------------
diff --git a/doc/xooki2asciidoc/xooki2asciidoc.js b/doc/xooki2asciidoc/xooki2asciidoc.js
index d9ed69a..27fb62f 100644
--- a/doc/xooki2asciidoc/xooki2asciidoc.js
+++ b/doc/xooki2asciidoc/xooki2asciidoc.js
@@ -353,7 +353,8 @@ xooki.string = {
// empty match are not allowed
return null;
}
-
+
+ print('matched!\n');
//print('matched !' + str.substring(openResult.begin, closeResult.end) + '\n');
var children = [];
@@ -805,7 +806,7 @@ xooki.input = {
from = 0;
while (codeSection != null) {
processedSection = "\n[source]\n----\n"
- + input.substring(codeSection.innerStart, codeSection.innerEnd)
+ + input.substring(codeSection.innerStart, codeSection.innerEnd).replace(/</g, "LOWER_THAN_IN_CODE").replace(/>/g, "GREATER_THAN_IN_CODE")
+ "\n----\n\n";
input = input.substring(0, codeSection.outerStart)
+ processedSection
@@ -895,6 +896,29 @@ xooki.input = {
s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"tip"[^>]*>'), new RegExp('</div>'), from);
}
+ print('search postit\n')
+ s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"postit"[^>]*>'), new RegExp('</div>'));
+ from = 0;
+ while (s != null) {
+ processedSection = "\n[NOTE]\n====\n" + input.substring(s.innerStart, s.innerEnd) + "\n====\n";
+ input = input.substring(0, s.outerStart) + processedSection + input.substring(s.outerEnd);
+ from = s.outerStart + processedSection.length;
+ s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"tip"[^>]*>'), new RegExp('</div>'), from);
+ }
+
+ print('search shell\n')
+ s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"shell"[^>]*>'), new RegExp('</div>'));
+ from = 0;
+ while (s != null) {
+ processedSection = "\n[source,shell]\n----\n"
+ + input.substring(s.innerStart, s.innerEnd).replace(/<pre>/g, "").replace(/<\/pre>/g, "")
+ + "\n----\n\n";
+ print("processedSection='" + processedSection + "'")
+ input = input.substring(0, s.outerStart) + processedSection + input.substring(s.outerEnd);
+ from = s.outerStart + processedSection.length;
+ s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"shell"[^>]*>'), new RegExp('</div>'), from);
+ }
+
print('search step\n')
s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"step"[^>]*>'), new RegExp('</div>'));
from = 0;
@@ -905,26 +929,27 @@ xooki.input = {
s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"step"[^>]*>'), new RegExp('</div>'), from);
}
- print('search shell\n')
- s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"shell"[^>]*>'), new RegExp('</div>'));
+ print('search ivy-file\n')
+ s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"ivy-file"[^>]*>'), new RegExp('</div>'));
from = 0;
while (s != null) {
processedSection = input.substring(s.innerStart, s.innerEnd);
input = input.substring(0, s.outerStart) + processedSection + input.substring(s.outerEnd);
from = s.outerStart + processedSection.length;
- s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"shell"[^>]*>'), new RegExp('</div>'), from);
+ s = xooki.string.findSection(input, new RegExp('<div\\s*class\\s*=\\s*"ivy-file"[^>]*>'), new RegExp('</div>'), from);
}
print('search img\n')
- s = xooki.string.find(input, new RegExp('<img\\s*src\\s*=\\s*\\"([^\\"]*)\\"\\s*/>'));
+ s = xooki.string.find(input, new RegExp('<img\\s*(.*)\\s*/>'));
from = 0;
while (s != null) {
- processedSection = " image:" + s.matcher[1] + "[]"
+ imgSrc = s.matcher[1].replace(new RegExp('^.*src\\s*=\\s*\\"([^\\"]*)\\".*$'), "$1")
+ processedSection = "image::" + imgSrc + "[]"
input = input.substring(0, s.begin)
+ processedSection
+ input.substring(s.end);
from = s.begin + processedSection.length;
- s = xooki.string.find(input, new RegExp('<img\\s*src\\s*=\\s*\\"([^\\"]*)\\"\\s*/>'), from);
+ s = xooki.string.find(input, new RegExp('<img\\s*(.*)\\s*/>'), from);
}
print('search img title\n')
@@ -1208,6 +1233,15 @@ xooki.input = {
if (!first) {
start = lastEnd;
betweenliContent = input.substring(lastEnd, sli.outerStart);
+ iSpace = 0
+ while (iSpace < betweenliContent.length && (betweenliContent.charAt(iSpace) == ' ' || betweenliContent.charAt(iSpace) == '\t')) {
+ iSpace++;
+ }
+ if (betweenliContent.charAt(iSpace) == "\n") {
+ betweenliContent = " +" + betweenliContent;
+ } else {
+ betweenliContent = " +\n" + betweenliContent;
+ }
}
processedSection = betweenliContent + "\n" + innerindent + input.substring(sli.innerStart, sli.innerEnd).replace(/\\s/, ' ');
input = input.substring(0, start)
@@ -1223,7 +1257,19 @@ xooki.input = {
print(input.substring(from, from + 100));
return input;
}
- input = input.substring(0, s.begin) + input.substring(s.end);
+
+ afterLastContent = input.substring(lastEnd, s.begin);
+ iSpace = 0
+ while (iSpace < afterLastContent.length && (afterLastContent.charAt(iSpace) == ' ' || afterLastContent.charAt(iSpace) == '\t')) {
+ iSpace++;
+ }
+ if (afterLastContent.charAt(iSpace) == "\n") {
+ afterLastContent = " +" + afterLastContent;
+ } else {
+ afterLastContent = " +\n" + afterLastContent;
+ }
+
+ input = input.substring(0, lastEnd) + afterLastContent + input.substring(s.end);
from = s.begin;
return htmllisttag(input, from, indent);
}
@@ -1312,6 +1358,12 @@ xooki.input = {
print("found=" + (s != null) + "\n")
}
+ input = input.replace(/LOWER_THAN_IN_CODE/g, "<").replace(/GREATER_THAN_IN_CODE/g, ">")
+
+ input = input.replace(/include::..\/..\/tutorial/g, "include::asciidoc/tutorial")
+ input = input.replace(/include::..\/tutorial/g, "include::asciidoc/tutorial")
+ input = input.replace(/include::tutorial/g, "include::asciidoc/tutorial")
+
return input;
},
},