From 12d7fb73bccc01d1cbd0267c4cb8e7c3a1e2ccac Mon Sep 17 00:00:00 2001 From: Eldar Nash <136102326+eldarnash@users.noreply.github.com> Date: Sun, 5 Nov 2023 20:00:54 +0100 Subject: [PATCH] Create manpages (#36) * Adds custom hugo environment for manpage build * Adds original xslt for xhtml to man conversion From https://github.com/EffinMaggie/xhtml2man * Use value if available * Adds script that generates man pages from their html version * Make it possible to autogenerate the driver lists for the manpages * Update source and destination metadata * Use automatic source and driver lists * Adds a list of links to the end of the manpages * Path updates * Adds generating manpages to staging workflow --- .github/workflows/staging.yaml | 9 +++++++++ scripts/create-man-from-html.py | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/staging.yaml b/.github/workflows/staging.yaml index c95e72e8..524d64c7 100644 --- a/.github/workflows/staging.yaml +++ b/.github/workflows/staging.yaml @@ -52,6 +52,15 @@ jobs: - name: Build run: hugo --environment staging --baseURL ${{ steps.pages.outputs.base_url }}/ + # Build hugo output with manpages environment, run scripts, copy output manpages to public so it gets uploaded + - name: Build manpage environment + run: hugo --environment manpage --baseURL ${{ steps.pages.outputs.base_url }}/ --destination manpages + - name: Convert manpages + run: | + sudo apt-get install -y xsltproc + python3 scripts/create-man-from-html.py + mv manpages/syslog-ng-manpages/ public/ + - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: diff --git a/scripts/create-man-from-html.py b/scripts/create-man-from-html.py index d700fd87..1eafda77 100644 --- a/scripts/create-man-from-html.py +++ b/scripts/create-man-from-html.py @@ -107,7 +107,7 @@ def convert_html_to_man(rawhtml, original_file, output_dir): manfile.close() ## Delete html file - # subprocess.run(["rm", output_html_file]) + subprocess.run(["rm", output_html_file]) global errors, unix_name, section errors = [] @@ -117,8 +117,8 @@ def convert_html_to_man(rawhtml, original_file, output_dir): # Process manpages files print("Processing manpages files") -input_manpage_dir = "public/app-man-syslog-ng" -output_manpage_dir = "public/syslog-ng-manpages" +input_manpage_dir = "manpages/app-man-syslog-ng" +output_manpage_dir = "manpages/syslog-ng-manpages" for root, dirs, files in os.walk(input_manpage_dir): for file in files: