You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2020/01/17 14:04:59 UTC
[isis] 01/05: ISIS-2062: uses pandoc to convert generated docs from
html to adoc
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
commit 71b2d2d9bf309b914a391a3b76d9e2e8216b0acd
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jan 17 14:22:24 2020 +0100
ISIS-2062: uses pandoc to convert generated docs from html to adoc
---
build-site.sh | 2 +-
scripts/ci/{build-site.sh => _build-site.sh} | 0
scripts/generateConfigDocs.groovy | 21 +++++++++------------
3 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/build-site.sh b/build-site.sh
index ddfe33d..33ee109 100644
--- a/build-site.sh
+++ b/build-site.sh
@@ -1,3 +1,3 @@
#!/bin/bash
export ANTORA_CACHE_DIR=.antora-cache-dir
-sh scripts/ci/build-site.sh $*
+sh scripts/ci/_build-site.sh $*
diff --git a/scripts/ci/build-site.sh b/scripts/ci/_build-site.sh
similarity index 100%
rename from scripts/ci/build-site.sh
rename to scripts/ci/_build-site.sh
diff --git a/scripts/generateConfigDocs.groovy b/scripts/generateConfigDocs.groovy
index b476c94..f21634c 100644
--- a/scripts/generateConfigDocs.groovy
+++ b/scripts/generateConfigDocs.groovy
@@ -255,25 +255,22 @@ for (PropertyGroup group in groups) {
outputFile.write(buf.toString())
}
}
+System.out.println("");
+System.out.println("");
static String toAsciidoc(String str) {
- String lineFeed = " +\n";
+ System.out.print(".");
- // simple html -> asciidoc substitutions
- str = str.replace("<p>", lineFeed);
- str = str.replace("</p>", "");
+ File tf = File.createTempFile("input",".html")
+ tf.write(str) // write to the file
- str = str.replace("<i>", "_");
- str = str.replace("<b>", "*");
- //str = str.replaceAll("<a href=\"(.*)\">(.*?)</a>", "link:$1[$2]");
+ String cmd = "pandoc --wrap=none -f html -t asciidoc " + tf.getCanonicalPath()
+ String adoc = cmd.execute().text
- str = str.replace("<code>", "`");
- str = str.replace("<\\code>", "`");
- str = str.replace("<tt>", "`");
- str = str.replace("<\\tt>", "`");
+ tf.delete()
- return str;
+ return adoc;
}
static String format(String str, int len = 30) {