Blog

Article Tags

Hua Error Handling Enhancements

By William Jeffrey Rankin, Sat Nov 23 2024

Revision 195 includes improvements to Hua's handling of non-critical errors. These are instances where Hua will continue processing all content except for the suspect entries. Examples of this include zero-length (empty) article files, entries lacking a filename, and entries lacking an ID. When possible, the entry ID is shown so the record can be quickly located and fixed.

The latest Hua download package demonstrates these errors. For example:

jeffr@Callisto: ~/Documents/Hua $ pwsh ./hua.ps1 ./hua.cfg 
Content file error. File (ID: 000045) is empty. Skipping.
Entries file error. There is an entry (ID: 000040) without a filename. Skipping.
...
Entries file error. There is an entry without an ID. Skipping.

Related Articles

    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

                    Newer Articles Older Articles