/******************************************************************************/ /* */ /* md2html.custom.rex -- SAMPLE customization layer for md2html */ /* ============================================================ */ /* */ /* This program is part of the Rexx Parser package */ /* [See https://rexx.epbcn.com/rexx-parser/] */ /* */ /* Copyright (c) 2024-2026 Josep Maria Blasco */ /* */ /* License: Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0) */ /* */ /* Version history: */ /* */ /* Date Version Details */ /* -------- ------- --------------------------------------------------------- */ /* 20241223 0.4a First version, based cgi/on rexx.epbcn.com.optional.cls */ /* */ /******************************************************************************/ pkgLocal = .Context~package~local -- .Exception will be used by md2html.Exception below pkgLocal~Exception = .Stem~new .Exception[] = 0 .Exception["test_fenced_code_blocks.md"] = 1 -- .TranslateFilename will be used by md2html.TranslateFilename below pkgLocal~TranslateFilename = .Stem~new .TranslateFilename[] = .Nil -- .Nil means no change .TranslateFilename["readme.md"] = "index" -- Note: index has no extension -- .FilenameSpecificStyle will be used by md2html.FilenameSpecificStyle below pkgLocal~FilenameSpecificStyle = .Stem~new .FilenameSpecificStyle[] = "" -- .Nil means no change .FilenameSpecificStyle["article.md"] = "article" .FilenameSpecificStyle["slides.md" ] = "slides" -- Output files will have this extension. See md2html.Extension pkgLocal~Extension = "html" -- The following set of routines is provided AS A SAMPLE ONLY. -- You will have to customize them (and default.m2html) for your own needs. -------------------------------------------------------------------------------- -- Page header -- Displays a top menu, a logo, and the page title -- -------------------------------------------------------------------------------- ::Routine md2html.Header Public Use Arg array, title Do line Over .resources~Header~makeString~changeStr("%title%",title) array~append( line ) End ::Resource Header

The Rexx-Parser


::END -------------------------------------------------------------------------------- -- Content header -- -- -------------------------------------------------------------------------------- ::Routine md2html.ContentHeader Public Use Arg filename -- You might generate a breadcrumb from parts of the filename here -------------------------------------------------------------------------------- -- Side bar -- -------------------------------------------------------------------------------- ::Routine md2html.SideBar Public Use Arg array Loop line Over .resources~SideBar array~append( line ) End ::Resource SideBar ::END -------------------------------------------------------------------------------- -- Page footer -- -------------------------------------------------------------------------------- ::Routine md2html.Footer Public Use Arg array year = Date("S")[1,4] Loop line Over .resources~PageFooter~makeString~changeStr("%year%",year) array~append( line ) End ::Resource PageFooter ::END -------------------------------------------------------------------------------- -- Exceptions (files that should not be processed) -- -------------------------------------------------------------------------------- ::Routine md2html.Exception Public Return .Exception[Arg(1)] -------------------------------------------------------------------------------- -- Extension the output HTML files will have -- -------------------------------------------------------------------------------- ::Routine md2html.Extension Public Return .Extension -------------------------------------------------------------------------------- -- Returns the translated filename -- -------------------------------------------------------------------------------- ::Routine md2html.TranslateFilename Public Return .TranslateFilename[Arg(1)] -- .Nil when no change -------------------------------------------------------------------------------- -- Returns the translated filename -- -------------------------------------------------------------------------------- ::Routine md2html.FilenameSpecificStyle Public Return .FilenameSpecificStyle[Arg(1)] -- A boolean