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

            Data File Generator for aa (astronomical almanac)

            By William Jeffrey Rankin, Sat Aug 31 2024

            I've added a bash script (gen-planets.sh) to the planet-rs package that generates data files for aa (Stephen L. Moshier's astronomical almanac). It currently outputs files for the Sun, Venus, Mars, Jupiter, and Saturn, but the planets variable can be modified to include any object from the catalog.

            planet-rs.tar.gz, 5.8K

            Related Articles

                Article Tags

                Minimal Mutt Config Files

                By William Jeffrey Rankin, Sat July 13 2024

                My minimal Mutt configuration files for iCloud Mail and Gmail. Both require two-factor authentication, and app-specific passwords be generated. Notes: <username> refers to the email address prefix. editor can be any editor you choose but should, of course, be Vim.

                iCloud Mail

                set imap_user = '<username>'
                set imap_pass = '<app-specific password>'
                
                set smtp_pass = '<app-specific password>'
                set smtp_url  = 'smtp://<icloud email address>@smtp.mail.me.com:587/'
                
                set from      = '<icloud email address>'
                set realname  = '<full name>'
                set editor    = 'vim'
                
                set folder    = "imaps://$imap_user:$imap_pass@imap.mail.me.com:993/"
                set spoolfile = '+INBOX'
                set postponed = '+Drafts'
                set record    = '+Sent Messages'
                set trash     = '+Deleted Messages'
                set mbox      = '+Archive'
                
                set ssl_starttls = yes
                set ssl_force_tls = yes
                

                Gmail

                set imap_user = '<gmail address>'
                set imap_pass = '<app-specific password>'
                
                set smtp_pass = '<app-specific password>'
                set smtp_url  = 'smtps://<username>@smtp.gmail.com'
                
                set from      = '<gmail email address>'
                set realname  = '<full name>'
                set editor    = 'vim'
                
                set folder    = 'imaps://imap.gmail.com/'
                set spoolfile = '+INBOX'
                set trash     = '+[Gmail]/Trash'
                set postponed = '+[Gmail]/Drafts'
                set record    = '+[Gmail]/Sent Mail'
                
                set ssl_starttls = yes
                set ssl_force_tls = yes
                

                    Newer Articles Older Articles