Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.7k views
in Technique[技术] by (71.8m points)

asciidoc, doctoolchain, target github readme.adoc - how to export asciidoc file containing includes into ONE file without include?

GitHub supports asciidoc readme files, but it looks like "include" is not supported. I want to use doctoolchain which can render and export to html and pdf (and maybe into other formats). This tool works great.

I could use raw.githack.com to show the generated html file from the GitHub repository.

But I think it would be a good idea to have the result also as one (1) readme.adoc file.

How to export into one (1) asciidoc file, which I could use as it is as readme file so that github will render it and show? Best would be to use doctoolchain, when this tool will render my documentation it could also generate the one-file-asciidoc-documentation.

I think internally asciidoctor collects and merge all these "include" files. So maybe this file is already available in any place? The doctoolchain build folder contains only the target files.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You are right there is a long dicussion why includeis not supported by github.

You can achieve your goal with doctoolChain and pandoc(https://pandoc.org/). Following steps are required:

  • configure your docDir/Config.groovy
    • inputFiles should have docbook defined
    • inputFiles = [[file: 'yourfile', formats['docbook']]]
  • run the doctoolchain task generateDocbook - it creates ???.xml file somewhere in docDir/build
  • generate from the generated docbook again an asciidoctor file - `pandoc <FILENAME_OF_GENERATED_DOCBOOK.XML> -f docbook -t asciidoctor -o <FILENAME_OF_ASCIIDOCTOR_WHICH_HAS_EVERYTHING>
  • make sure it runs automatically and you commit it regulary
  • now you are ready

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...