Blog

Article Tags

Hua Pandoc Integration

By William Jeffrey Rankin, Mon Oct 14 2024

Revision 169 of Hua supports PDF generation through Pandoc and the GNU roff (groff) typesetting system. This allows for much better looking print output than is possible through HTML and CSS.

Example Usage & Output

Groff output mode is used in conjunction with article mode:

.\hua.ps1 .\hua.cfg -A '00110' -G

This command outputs two files: the HTML version of the article and a version for use in groff (it's given an .ms extension). To convert this file to PDF, run the following:

pdfroff -ms -mpdfmark -mspdf pandoc-int.html.ms > pandoc-int.html.pdf

The result looks like this (pandoc-int.html.pdf). Here's a more verbose example (old-church-stone.html.pdf). Note that only absolute links work in documents generated this way.

Related Articles

    Article Tags

    Hua Article Mode

    By William Jeffrey Rankin, Thu Sep 26 2024

    As of revision 165, Hua has an article mode that enables processing of an individual article. This is useful in instances where an article is in development and requires review. In this mode only the specified article is generated; index, archive, and tagged-with files are not touched. Since only one article is processed, this mode is significantly faster as well.

    Article Mode Usage & Performance (this blog)

    jeffr@CALLISTO: D:\Documents\wjr-blog $ Measure-Command { ..\Hua\hua.ps1 .\hua.cfg -A '00100' | Out-Default }
    
    ...
    Seconds           : 0
    Milliseconds      : 375
    ...
    

    Normal Mode Usage & Performance (this blog)

    jeffr@CALLISTO: D:\Documents\wjr-blog $ Measure-Command { ..\Hua\hua.ps1 .\hua.cfg | Out-Default }
    
    ...
    Seconds           : 3
    Milliseconds      : 27
    ...
    

    Related Articles

        Article Tags

        Hua Error Status Codes

        By William Jeffrey Rankin, Thu Sep 19 2024

        As of revision 157 (released Sep 18, 2024) Hua outputs specific codes based upon error condition. Normally, if all goes well, Hua exits with a status of 0. But when an error condition results, Hua outputs a message and, depending upon the severity of the error, either continues processing content or stops entirely. When the latter occurs, a non-zero exit status is generated. It can be output as seen in the examples below.

        PowerShell Session

        jeffr@CALLISTO: D:\Documents\wjr-blog $ ..\Hua\hua.ps1 .\wrong.cfg
        Config file error. Config file path specified as .\wrong.cfg . Quitting.
        jeffr@CALLISTO: D:\Documents\wjr-blog $ $LASTEXITCODE
        2
        

        Bash Session

        jeffr@Phobos: ~/Hua $ pwsh ./hua.ps1 hua.cfg 
        Meta info file error. Meta file path set as .\met.csv. Quitting.
        jeffr@Phobos: ~/Hua $ echo $?
        9
        

        This is useful in instances where Hua is invoked from a script or as part of a toolchain and exit status needs to be introspected. For more information, refer to the Errors section of the main Hua page.

        Related Articles

            Article Tags

            Hua Paging Labels

            By William Jeffrey Rankin, Thu July 4 2024

            Hua now supports custom labels for paging. Labels are specified in the Hua configuration file:

            next_label = Next Page
            prev_label = Previous Page
            

            Note: Spaces in labels are represented by  .

            Related Articles

                Article Tags

                Hua Feature Completion

                By William Jeffrey Rankin, Sat Apr 6 2024

                With the inclusion of paging for tagged-with-* files (revision 140), Hua is now feature complete. There's still work to do: for example, I want to simplify some of the code and I'm very interested in how well Hua performs with a large number of articles. But, for now, the tool does everything I want it to do while retaining the flexibility and simplicity I envisioned from the beginning.

                Related Articles

                    Newer Articles Older Articles