Repository: ant-ivy Updated Branches: refs/heads/master 80d9b0c38 -> c1c99616f
display the version of the doc in the toc Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/c1c99616 Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/c1c99616 Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/c1c99616 Branch: refs/heads/master Commit: c1c99616f353d8afb990cfc000c916fbd4d1d648 Parents: 80d9b0c Author: Nicolas LaleveÌe <[email protected]> Authored: Sun Jun 25 17:32:20 2017 +0200 Committer: Nicolas LaleveÌe <[email protected]> Committed: Sun Jun 25 17:32:20 2017 +0200 ---------------------------------------------------------------------- asciidoc/templates/document.html.slim | 2 +- asciidoc/templates/helpers.rb | 15 ++++++++------- asciidoc/toc.json | 2 +- build-release.xml | 3 ++- 4 files changed, 12 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/c1c99616/asciidoc/templates/document.html.slim ---------------------------------------------------------------------- diff --git a/asciidoc/templates/document.html.slim b/asciidoc/templates/document.html.slim index 637affb..dcb6667 100644 --- a/asciidoc/templates/document.html.slim +++ b/asciidoc/templates/document.html.slim @@ -16,7 +16,7 @@ doctype transitional /! KIND, either express or implied. See the License for the /! specific language governing permissions and limitations /! under the License. -- page = IvyDocHelpers.page(attr("basedir"), attr("docfile")) +- page = IvyDocHelpers.page(attr("basedir"), attr("docfile"), attr("version")) html lang=(attr :lang, 'en' unless attr? :nolang) head meta http-equiv="Content-Type" content="text/html; charset=utf-8" http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/c1c99616/asciidoc/templates/helpers.rb ---------------------------------------------------------------------- diff --git a/asciidoc/templates/helpers.rb b/asciidoc/templates/helpers.rb index d7d9c9d..038f7f3 100644 --- a/asciidoc/templates/helpers.rb +++ b/asciidoc/templates/helpers.rb @@ -122,8 +122,8 @@ module IvyDocHelpers end - def self.page(basedir, docfile) - rootpage = loadPages(basedir) + def self.page(basedir, docfile, version) + rootpage = loadPages(basedir, version) pageId = docfile[basedir.length+1..docfile.rindex(/\./)-1] p = findPage(rootpage, pageId) if !p @@ -132,25 +132,26 @@ module IvyDocHelpers return p end - def self.loadPages(basedir) + def self.loadPages(basedir, version) rootpage = Page.new toc = JSON.parse(IO.read(basedir + "/toc.json")) toc['children'].each do |child| - rootpage.children << loadPage(basedir, rootpage, child, "") + rootpage.children << loadPage(basedir, rootpage, child, "", version) end return rootpage end - def self.loadPage(basedir, parent, node, path) + def self.loadPage(basedir, parent, node, path, version) p = Page.new p.title = node['title'] + p.title.sub! '${version}', version p.parent = parent if node.has_key?("importRoot") p.id = path + node['importRoot'] + '/' + node['importNode'] p.url = p.id + ".html" toc = JSON.parse(IO.read(basedir + '/' + node['importRoot'] + "/toc.json")) toc['children'].each do |child| - p.children << loadPage(basedir, node, child, path + node['importRoot'] + '/') + p.children << loadPage(basedir, node, child, path + node['importRoot'] + '/', version) end else p.id = node['id'] @@ -163,7 +164,7 @@ module IvyDocHelpers end if node.has_key?("children") node['children'].each do |child| - p.children << loadPage(basedir, p, child, path) + p.children << loadPage(basedir, p, child, path, version) end end end http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/c1c99616/asciidoc/toc.json ---------------------------------------------------------------------- diff --git a/asciidoc/toc.json b/asciidoc/toc.json index 55a0f21..551b175 100644 --- a/asciidoc/toc.json +++ b/asciidoc/toc.json @@ -2,7 +2,7 @@ "children": [ { "id":"index", - "title":"Documentation", + "title":"Documentation (${version})", "children": [ { "id":"release-notes", http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/c1c99616/build-release.xml ---------------------------------------------------------------------- diff --git a/build-release.xml b/build-release.xml index 5e47643..baf8f3f 100644 --- a/build-release.xml +++ b/build-release.xml @@ -165,12 +165,13 @@ <replace dir="${output.dir}" token="${ivy.revision}" value="working@apache"/> </target> - <target name="generate-doc" depends="generate-tutorial-output"> + <target name="generate-doc" depends="generate-tutorial-output,default-version"> <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"/> <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=""/> + <attribute key="version" value="${build.version}" /> </asciidoctor:convert> <!-- copy static resources --> <copy todir="${doc.build.dir}">
