|
MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
|
mxvm-html command-line tool — converts MXVM source to syntax-highlighted HTML More...
#include "mxvm/html_gen.hpp"#include "argz.hpp"#include <cctype>#include <fstream>#include <iostream>#include <sstream>#include <string>#include <vector>
Go to the source code of this file.
Functions | |
| static std::string | readFile (const std::string &path) |
| static bool | endsWith (const std::string &s, const std::string &suffix) |
| static std::string | dirOf (const std::string &path) |
| static bool | fileExists (const std::string &path) |
| static void | ensureCss (const std::string &outPath) |
| static void | writeHtml (const std::string &src, const std::string &inPath, const std::string &outPath, const std::string &cssHref="") |
| static std::string | extractDeclName (const std::string &src) |
| int | main (int argc, char **argv) |
mxvm-html command-line tool — converts MXVM source to syntax-highlighted HTML
Usage: mxvm-html -i input.mxvm [-o output.html] [-s style.css] mxvm-html -i input.pas [-o output.html] [-s style.css] mxvm-html -c file1.mxvm file2.pas ... [-s style.css] mxvm-html -h
For .pas input the output is Pascal-syntax-highlighted using PasHTMLGen. An external stylesheet is linked from the HTML so you can change the look without recompiling. By default mxvm-highlight.css is written to the same directory as the first output file (only when the file does not exist yet). Use -s to point to an existing stylesheet instead.
Output filenames are auto-derived from the program/unit/object declaration in the source unless -o is supplied.
Definition in file html.cpp.
|
static |
Return the directory portion of a path, including the trailing slash.
Definition at line 47 of file html.cpp.
References pos().
Referenced by ensureCss().
|
static |
Definition at line 41 of file html.cpp.
Referenced by writeHtml().
|
static |
Write mxvm-highlight.css next to outPath if it does not already exist.
Definition at line 58 of file html.cpp.
References mxvm::PasHTMLGen::defaultCss(), dirOf(), and fileExists().
Referenced by writeHtml().
|
static |
|
static |
Definition at line 52 of file html.cpp.
Referenced by ensureCss().
| int main | ( | int | argc, |
| char ** | argv ) |
Definition at line 161 of file html.cpp.
References mx::Argz< String >::addOptionSingleValue(), mx::Argument< String >::arg_value, argc(), argv(), extractDeclName(), mx::Argz< String >::help(), mx::Argz< String >::proc(), readFile(), mx::ArgException< String >::text(), and writeHtml().
|
static |
|
static |
Render src to outPath. For .pas input PasHTMLGen is used and the HTML links to cssHref; if cssHref is empty the default stylesheet is written alongside the output.
Definition at line 74 of file html.cpp.
References endsWith(), ensureCss(), mxvm::HTMLGen::output(), and mxvm::PasHTMLGen::output().
Referenced by main().