From 2b436adf366823020b19c48e0f41255509e53bdb Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Tue, 27 Jul 2021 16:52:31 +0100 Subject: [PATCH] split header --- Gemfile | 3 ++- Gemfile.lock | 9 ++++++--- README.adoc | 6 +++++- build-doc | 31 +++++++++++++++++++++++-------- common.py | 2 ++ publish-gh-pages | 4 +++- 6 files changed, 41 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index e8b6ab5..8da8d40 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,6 @@ source 'https://rubygems.org' -gem 'asciidoctor', '2.0.10' +gem 'asciidoctor', '2.0.11' +gem 'asciidoctor-multipage', '0.0.12' #gem 'jekyll', '3.8.6' gem 'github-pages' diff --git a/Gemfile.lock b/Gemfile.lock index 5f20acb..ede12f4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,9 @@ GEM tzinfo (~> 1.1) addressable (2.6.0) public_suffix (>= 2.0.2, < 4.0) - asciidoctor (2.0.10) + asciidoctor (2.0.11) + asciidoctor-multipage (0.0.12) + asciidoctor (>= 2.0.11, < 2.1) coffee-script (2.4.1) coffee-script-source execjs @@ -243,8 +245,9 @@ PLATFORMS ruby DEPENDENCIES - asciidoctor (= 2.0.10) + asciidoctor (= 2.0.11) + asciidoctor-multipage (= 0.0.12) github-pages BUNDLED WITH - 2.0.2 + 2.2.5 diff --git a/README.adoc b/README.adoc index b29e6bf..f24f62b 100644 --- a/README.adoc +++ b/README.adoc @@ -18,7 +18,11 @@ https://zenodo.org/badge/latestdoi/64534859[image:https://zenodo.org/badge/64534 TL;DR: xref:qemu-buildroot-setup-getting-started[xrefstyle=full] -The source code for this page is located at: https://github.com/cirosantilli/linux-kernel-module-cheat[]. Due to https://github.com/isaacs/github/issues/1610[a GitHub limitation], this README is too long and not fully rendered on github.com, so either use: https://cirosantilli.com/linux-kernel-module-cheat or <>. +The source code for this page is located at: https://github.com/cirosantilli/linux-kernel-module-cheat[]. Due to https://github.com/isaacs/github/issues/1610[a GitHub limitation], this README is too long and not fully rendered on github.com, so either use: + +* https://cirosantilli.com/linux-kernel-module-cheat +* https://cirosantilli.com/linux-kernel-module-cheat/index-split[]: split header version +* <> image::https://raw.githubusercontent.com/cirosantilli/china-dictatorship-media/master/Xinjiang_prisoners_sitting_identified.jpeg[width=800] diff --git a/build-doc b/build-doc index a34d70f..60b0709 100755 --- a/build-doc +++ b/build-doc @@ -32,21 +32,36 @@ from the README to example sources to GitHub rather than locally. link_target_script = 'link-target-github.rb' else: link_target_script = 'link-target-up.rb' + common_cmd = [ + 'bundle', LF, + 'exec', LF, + 'asciidoctor', LF, + '--attribute', 'docinfo=shared', LF, + '--failure-level', 'info', LF, + '--require', os.path.join(asciidoctor_dir, link_target_script), LF, + '--trace', LF, + '--verbose', LF, + ] exit_status = self.sh.run_cmd( + common_cmd + [ - 'asciidoctor', LF, - '--attribute', 'docinfo=shared', LF, - '--failure-level', 'info', LF, - '--require', os.path.join(asciidoctor_dir, link_target_script), LF, '--out-file', self.env['readme_out'], LF, - '--trace', LF, - '--verbose', LF, - ] + - [ self.env['readme'], LF, ], out_file=self.env['build_doc_log'], ) + if exit_status == 0: + exit_status = self.sh.run_cmd( + common_cmd + + [ + '-D', self.env['out_doc_dir'], LF, + '-a', 'multipage-level=6', LF, + '-b', 'multipage_html5', LF, + '-r', 'asciidoctor-multipage', LF, + self.env['readme'], LF, + ], + out_file=self.env['build_doc_multipage_log'], + ) # Check that all local files linked from README exist. external_link_re = re.compile('^https?://') diff --git a/common.py b/common.py index 59812ed..5a0a5be 100644 --- a/common.py +++ b/common.py @@ -53,8 +53,10 @@ if consts['in_docker']: else: consts['out_dir'] = os.path.join(consts['root_dir'], 'out') consts['readme'] = os.path.join(consts['root_dir'], 'README.adoc') +consts['out_doc_dir'] = os.path.join(consts['out_dir'], 'doc') consts['readme_out'] = os.path.join(consts['out_dir'], 'README.html') consts['build_doc_log'] = os.path.join(consts['out_dir'], 'build-doc.log') +consts['build_doc_multipage_log'] = os.path.join(consts['out_dir'], 'build-doc-multipage.log') consts['gem5_out_dir'] = os.path.join(consts['out_dir'], 'gem5') consts['kernel_modules_build_base_dir'] = os.path.join(consts['out_dir'], 'kernel_modules') consts['buildroot_out_dir'] = os.path.join(consts['out_dir'], 'buildroot') diff --git a/publish-gh-pages b/publish-gh-pages index 6942322..26c03b9 100755 --- a/publish-gh-pages +++ b/publish-gh-pages @@ -10,7 +10,9 @@ git checkout master -- \ _config.yml \ ; cp out/README.html index.html -git add index.html +cp out/doc/* . +mv README.html index.html +git add . git commit --message "$(git log -n1 --pretty='%H' master)" git push git checkout -