{"id":21633846,"url":"https://github.com/rhaberkorn/groff-tools","last_synced_at":"2025-03-18T22:37:10.741Z","repository":{"id":139473056,"uuid":"14962447","full_name":"rhaberkorn/groff-tools","owner":"rhaberkorn","description":"Various Groff preprocessors and tools","archived":false,"fork":false,"pushed_at":"2024-08-01T00:02:46.000Z","size":21,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-25T00:14:34.690Z","etag":null,"topics":["ebnf","groff","preprocessor","syntax-highlighting"],"latest_commit_sha":null,"homepage":null,"language":"Roff","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhaberkorn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-05T18:43:24.000Z","updated_at":"2024-08-01T00:02:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f8ed202-302c-40b3-978b-e80489ea4fbd","html_url":"https://github.com/rhaberkorn/groff-tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaberkorn%2Fgroff-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaberkorn%2Fgroff-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaberkorn%2Fgroff-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaberkorn%2Fgroff-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhaberkorn","download_url":"https://codeload.github.com/rhaberkorn/groff-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244320249,"owners_count":20434088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ebnf","groff","preprocessor","syntax-highlighting"],"created_at":"2024-11-25T03:14:19.358Z","updated_at":"2025-03-18T22:37:10.712Z","avatar_url":"https://github.com/rhaberkorn.png","language":"Roff","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Groff Preprocessors and Tools\n\nThis repository is home to an assortment of preprocessors and\nmacros for the [GNU Troff](http://www.gnu.org/software/groff/) typesetting\npackage.\n\nI have written all of them except `sequence.pic` which is part of the\n[UML Graph](http://www.umlgraph.org/) package and included here for convenience\nonly.\nThese scripts do not strive to be complete, well tested and fit for general usage - they\nare merely quick and dirty hacks that accumulated on my hard drive :-).\n\n## EBNF\n\n`ebnf.sno` is a [CSNOBOL4](http://www.regressive.org/snobol4/csnobol4/) program that compiles\nextended BNF descriptions into GNU pic code using macros from `syntax.pic`.\nThis effectively allows you to embed EBNF grammars in Groff source code and\nhave it rendered as (box and arrow) syntax diagrams.\nMost EBNF constructs and some extensions are supported, but I'm too lazy to document\nall of them now.\n\nTo build the sample `select-from.ebnf`, type something like:\n\n    cat samples/select-from.ebnf | ./ebnf.sno | pic | groff -Tps \u003eselect-from.ps\n\n## HIGHLIGHT (Python)\n\n`pygments-groff.py` is a syntax highlighting preprocessor based on [Pygments](https://pygments.org/) and\nconsequently written in Python 3.\nIt is the most powerful (and probably fastest) of the syntax highlighting preprocessors presented here.\nIt should also be more portable as it does not rely on stdout redirection magic.\nIt should work with all Groff macro suites and even preserves the line numbering\nin Groff error messages.\n\nYou can process embedded blocks of code as in the following ms-based example:\n\n```groff\n.LD\n.CW\n.lg 0\n.HIGHLIGHT c\n#include \u003cstdio.h\u003e\n\nint main(int argc, char **argv)\n{\n\tprintf(\"Hello world!\\n\");\n\treturn 0;\n}\n.HIGHLIGHT\n.DE\n```\n\nNote that you may have to do more before `.HIGHLIGHT` - for instance redefine chars -\ndepending on your use case.\n\nThe `default` language identifier is useful to include code without highlighting,\nbut still benefit from Pygment's preprocessing in order to achieve verbatim text.\nA list of language identifiers (short names) can be found on the [Pygments website](https://pygments.org/languages/).\n\nJust like `highlight.lua`, you can specify a file name directly after the language identifier:\n\n```groff\n.HIGHLIGHT c hello.c\n```\n\n## HIGHLIGHT (SNOBOL4)\n\n`highlight.sno` is a small preprocessor written in [CSNOBOL4](http://www.regressive.org/snobol4/csnobol4/)\nthat processes blocks of source code embedded in your Groff document with\n[GNU Source-highlight](http://www.gnu.org/software/src-highlite/) to produce\nsyntax highlighted text.\n\nThe output is formatted according to `groff.outlang`.\nVersions for the [mom macros](http://www.schaffter.ca/mom/) (`groff-mom.outlang`) and\nfor the classic ms macros (`groff-ms.outlang`) are provided.\n\nExample (mom):\n\n```groff\n.QUOTE\n.CODE\n.HIGHLIGHT c\n#include \u003cstdio.h\u003e\n\nint main(int argc, char **argv)\n{\n\tprintf(\"Hello world!\\n\");\n\treturn 0;\n}\n.HIGHLIGHT\n.CODE OFF\n.QUOTE OFF\n```\n\n## HIGHLIGHT (Lua)\n\n`highlight.lua` is a reimplementation of `highlight.sno` in Lua 5.2 and may work\nbetter on some operating systems.\n\nIn addition to the aforementioned syntax, the Lua version allows you to specify a filename after\nthe language identifier to process an external file:\n\n```groff\n.HIGHLIGHT c hello.c\n```\n\n## UML\n\n`uml.sno` is a small preprocessor (again requires CSNOBOL4) that\nrenders an embedded diagram with [PlantUML](http://plantuml.sourceforge.net/)\nand automatically emits the appropriate Mom `PDF_IMAGE` macro calls.\n\nNaturally, this leaves around PDF images (`uml_tempX.pdf`) that you should remove\nafter generating your document.\n\n## HTML Tables\n\n`htbl.tes` is a quick and dirty [SciTECO](http://rhaberkorn.github.com/sciteco/) script\nthat can act as a drop-in replacement for the tbl preprocessor that generates\nproper HTML tables when the Groff html output device is used.\nWith the original tbl preprocessor, tables are (and must be) rendered by the postscript\ndevice and will be embedded as images into the HTML page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhaberkorn%2Fgroff-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhaberkorn%2Fgroff-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhaberkorn%2Fgroff-tools/lists"}