diff options
Diffstat (limited to 'legacy')
-rw-r--r-- | legacy/GROFF.md | 50 | ||||
-rw-r--r-- | legacy/GROFF.pdf | bin | 0 -> 16389 bytes | |||
-rw-r--r-- | legacy/README.gd | 65 | ||||
-rw-r--r-- | legacy/README.md | 79 | ||||
-rw-r--r-- | legacy/README.ms | 115 | ||||
-rw-r--r-- | legacy/README.pdf | bin | 0 -> 29333 bytes | |||
-rwxr-xr-x | legacy/groffdown | 54 |
7 files changed, 363 insertions, 0 deletions
diff --git a/legacy/GROFF.md b/legacy/GROFF.md new file mode 100644 index 0000000..548c786 --- /dev/null +++ b/legacy/GROFF.md @@ -0,0 +1,50 @@ +GNU/Troff macros and macro packages +=================================== + +man: The traditional man page format (`man groff_man`) +------------------------------------------------------ + +me: The classical `me` document format (`man groff_me`) +------------------------------------------------------- + +mm: The classical `mm` document format (`man groff_mm`) +------------------------------------------------------- + +ms: The classical `ms` document format (`man groff_ms`) +------------------------------------------------------- + +www: HTML-like macros (`man groff_www`) +--------------------------------------- + +| Macro | Meaning | Subsection | Sets | MD Alternative | +| ----- | ----------------------------- | -------------------------- | ---- | ------------------- | +| .B | Bold | Font style macros | man, | **Bold** | +| .BI | Bold, italic alternating | Font style macros | man, | ***Bold & italic*** | +| .BR | Bold, roman alternating | Font style macros | man, | N/A | +| .EE | Example end | Document structure macros | man, | N/A | +| .EX | Example begin | Document structure macros | man, | N/A | +| .I | Italic | Font style macros | man, | *Italic* | +| .IP | Indented paragraph | Paragraph macros | man, | ` ` Tabs | +| .IR | Italic, roman alternating | Font style macros | man, | +| .LP | (Left) paragraph | Paragraph macros | man, | +| .ME | Mail-to end | Hyperlink and email macros | man, | +| .MT | Mail-to start | Hyperlink and email macros | man, | +| .OP | (Command-line) option | Command synopsis macros | man, | +| .P | Paragraph | Paragraph macros | man, | +| .PP | Paragraph | Paragraph macros | man, | +| .RB | Roman, bold alternating | Font style macros | man, | +| .RE | Relative-indent end | Document structure macros | man, | +| .RI | Roman, italic alternating | Font style macros | man, | +| .RS | Relative-indent start | Document structure macros | man, | +| .SB | Small bold | Font style macros | man, | +| .SH | Section heading | Document structure macros | man, | +| .SM | Small | Font style macros | man, | +| .SS | Subection heading | Document structure macros | man, | +| .SY | Synopsis start | Command synopsis macros | man, | +| .TH | Title heading | Document structure macros | man, | +| .TP | Tagged paragraph | Paragraph macros | man, | +| .TQ | Tagged paragraph continuation | Paragraph macros | man, | +| .UE | URL end | Hyperlink and email macros | man, | +| .UR | URL start | Hyperlink and email macros | man, | +| .YS | Synopsis end | Command synopsis macros | man, | + diff --git a/legacy/GROFF.pdf b/legacy/GROFF.pdf Binary files differnew file mode 100644 index 0000000..562b680 --- /dev/null +++ b/legacy/GROFF.pdf diff --git a/legacy/README.gd b/legacy/README.gd new file mode 100644 index 0000000..df3d0d0 --- /dev/null +++ b/legacy/README.gd @@ -0,0 +1,65 @@ +--- +title: Groffdown +author: Benjamin Chausse +date: 2019-09-19 +Markdown syntax with GNU/Troff-like compilation speeds. +--- + + +# What is Groffdown? +Groffdown aims to take the already existing (and well-known) +markdown syntax and make it compile at speed similar to the +ones of groff. The main compiler for markdown to pdf usually +being `pandoc`, it can be quite long to compile a document (up +to four seconds for one page documents +in some cases) unlike Groff which is known +to usually compile very quickly (0.1 second on average for +one page documents). As a proof of concept, this *README* +pages can be fully compiled using groffdown to then be used by groff. + +# Example piping workflow +Groffdown is a script which when run on a markdown document, +will convert the most typical markdown syntax into groff +(using the `ms` macros) to then send it to standard output. +Therefore, it can be piped directly into groff (or +it's related software). Here is an example of a complete piping +command: + +- groffdown <filename>.gd | refer -PS -e "-p$REFERBIB" | groff -me -ms -kejpt -T pdf > <filename>.pdf + +# Syntax goals +- Speed +- Markdown Syntax (with yaml preamble) +- LaTeX where markdown lacks + + +## Existing Syntax + +### Commands similar to markdown +- Headers (1-5) +- *Italic* +- **Bold** +- ***Bold & Italic*** +- Bullet points +- `Code blocks (in a monospaced font)` + +### Commands similar to LaTeX +- Abstract +- Inline equations +- Centered equations +- Citations + +### Commands similar to YAML +- Titles +- Authors +- Dates +- Author's Institution + +# Current issues +- All text formatings need to be on the same line (you can't start bold + on one line and finish on the other) Doing otherwise seems to trigger + an unescapable recursive loop on the groff side of things. + +# Needed implementations +- Numbered lists +- multi-macro compatibility (mom macros for urls) diff --git a/legacy/README.md b/legacy/README.md new file mode 100644 index 0000000..258df20 --- /dev/null +++ b/legacy/README.md @@ -0,0 +1,79 @@ +--- +title: Groffdown +author: Benjamin Chausse +date: 2019-09-19 +A markdown to GNU/Troff transpiler +--- + +What is Groffdown? +------------------ + +Groffdown aims to take the already existing (and well-known) +markdown syntax and make it compile at speed similar to the +ones of groff. The main compiler for markdown to pdf usually +being `pandoc`, it can be quite long to compile a document (up +to four seconds for one page documents +in some cases) unlike Groff which is known +to usually compile very quickly (0.1 second on average for +one page documents). As a proof of concept, this *README* +pages can be fully compiled using groffdown to then be used by groff. + +Example piping workflow +======================= + +Groffdown is a script which when run on a markdown document, +will convert the most typical markdown syntax into groff +(using the `ms` macros) to then send it to standard output. +Therefore, it can be piped directly into groff (or +it's related software). Here is an example of a complete piping +command: + +- groffdown <filename>.gd | refer -PS -e "-p$REFERBIB" | groff -me -ms -kejpt -T pdf > <filename>.pdf + +Syntax goals +============ +- Speed +- Markdown Syntax (with yaml preamble) +- LaTeX where markdown lacks + + +Existing Syntax +=============== + +Commands similar to markdown +---------------------------- + +- Headers (1-5) +- *Italic* +- **Bold** +- ***Bold & Italic*** +- Bullet points +- `Code blocks (in a monospaced font)` + +Commands similar to LaTeX +------------------------- +- Abstract +- Inline equations +- Centered equations +- Citations + +Commands similar to YAML +------------------------ + +- Titles +- Authors +- Dates +- Author's Institution + +Current issues +============== + +- All text formatings need to be on the same line (you can't start bold + on one line and finish on the other) Doing otherwise seems to trigger + an unescapable recursive loop on the groff side of things. + +Needed implementations +====================== + +- Numbered lists +- multi-macro compatibility (mom macros for urls) diff --git a/legacy/README.ms b/legacy/README.ms new file mode 100644 index 0000000..8256b06 --- /dev/null +++ b/legacy/README.ms @@ -0,0 +1,115 @@ +.TL + Groffdown +.AU + Benjamin Chausse +.ND + 2019-09-19 +Markdown syntax with GNU/Troff-like compilation speeds. +--- + + +.NH 1 +What is Groffdown? +.PP +Groffdown aims to take the already existing (and well-known) +markdown syntax and make it compile at speed similar to the +ones of groff. The main compiler for markdown to pdf usually +being +.CW "pandoc" "," + it can be quite long to compile a document (up +to four seconds for one page documents +in some cases) unlike Groff which is known +to usually compile very quickly (0.1 second on average for +one page documents). As a proof of concept, this +.I "README" +pages can be fully compiled using groffdown to then be used by groff. + +.NH 1 +Example piping workflow +.PP +Groffdown is a script which when run on a markdown document, +will convert the most typical markdown syntax into groff +(using the +.CW "ms" " " +macros) to then send it to standard output. +Therefore, it can be piped directly into groff (or +it's related software). Here is an example of a complete piping +command: + +.IP \(bu 2 +groffdown <filename>.gd | refer -PS -e "-p$REFERBIB" | groff -me -ms -kejpt -T pdf > <filename>.pdf + +.NH 1 +Syntax goals +.PP +.IP \(bu 2 +Speed +.IP \(bu 2 +Markdown Syntax (with yaml preamble) +.IP \(bu 2 +LaTeX where markdown lacks + + +.NH 2 +Existing Syntax +.PP + +.NH 3 +Commands similar to markdown +.PP +.IP \(bu 2 +Headers (1-5) +.IP \(bu 2 + +.I "Italic" +.IP \(bu 2 + +.B "Bold" +.IP \(bu 2 + +.BI "Bold & Italic" +.IP \(bu 2 +Bullet points +.IP \(bu 2 + +.CW "Code blocks (in a monospaced font)" + +.NH 3 +Commands similar to LaTeX +.PP +.IP \(bu 2 +Abstract +.IP \(bu 2 +Inline equations +.IP \(bu 2 +Centered equations +.IP \(bu 2 +Citations + +.NH 3 +Commands similar to YAML +.PP +.IP \(bu 2 +Titles +.IP \(bu 2 +Authors +.IP \(bu 2 +Dates +.IP \(bu 2 +Author's Institution + +.NH 1 +Current issues +.PP +.IP \(bu 2 +All text formatings need to be on the same line (you can't start bold + on one line and finish on the other) Doing otherwise seems to trigger + an unescapable recursive loop on the groff side of things. + +.NH 1 +Needed implementations +.PP +.IP \(bu 2 +Numbered lists +.IP \(bu 2 +multi-macro compatibility (mom macros for urls) diff --git a/legacy/README.pdf b/legacy/README.pdf Binary files differnew file mode 100644 index 0000000..cf39aba --- /dev/null +++ b/legacy/README.pdf diff --git a/legacy/groffdown b/legacy/groffdown new file mode 100755 index 0000000..f2810a5 --- /dev/null +++ b/legacy/groffdown @@ -0,0 +1,54 @@ +#!/bin/bash + +file=$(readlink -f "$1") +dir=$(dirname "$file") +base="${file%.*}" + +output=$( sed -e '1,1d + s/title:/\.TL\n/ + s/author:/\.AU\n/ + s/date:/\.ND\n/ + s/institution:/\.AI\n/ + + s/\\begin{abstract}/\.AB/ + s/\\end{abstract}/\.AE/ + + s/^\#####.\(.*\)/\.NH 5\n\1\n\.PP/g + s/^\####.\(.*\)/\.NH 4\n\1\n\.PP/g + s/^\###.\(.*\)/\.NH 3\n\1\n\.PP/g + s/^\##.\(.*\)/\.NH 2\n\1\n\.PP/g + s/^\#.\(.*\)/\.NH 1\n\1\n\.PP/g + + s/\*\*\*\(.*\)\*\*\*$/\n\.BI\ \"\1\"\ /g + s/\*\*\*\(.*\)\*\*\*\(.\)$/\n\.BI\ \"\1\"\ \"\2\"/g + s/\*\*\*\(.*\)\*\*\*\(.\)/\n\.BI\ \"\1\"\ \"\2\"\n/g + + s/\*\*\(.*\)\*\*$/\n\.B\ \"\1\"\ /g + s/\*\*\(.*\)\*\*\(.\)$/\n\.B\ \"\1\"\ \"\2\"/g + s/\*\*\(.*\)\*\*\(.\)/\n\.B\ \"\1\"\ \"\2\"\n/g + + s/\*\(.*\)\*$/\n\.I\ \"\1\"\ /g + s/\*\(.*\)\*\(.\)$/\n\.I\ \"\1\"\ \"\2\"/g + s/\*\(.*\)\*\(.\)/\n\.I\ \"\1\"\ \"\2\"\n/g + + s/`\(.*\)`$/\n\.CW\ \"\1\"\ /g + s/`\(.*\)`\(.\)$/\n\.CW\ \"\1\"\ \"\2\"/g + s/`\(.*\)`\(.\)/\n\.CW\ \"\1\"\ \"\2\"\n/g + + s/^\ ...............-\ /.IP\ \\(bu\ 10\n/g + s/^\ ...........-\ /.IP\ \\(bu\ 8\n/g + s/^\ .......-\ /.IP\ \\(bu\ 6\n/g + s/^\ ...-\ /.IP\ \\(bu\ 4\n/g + s/^-\ /.IP\ \\(bu\ 2\n/g + s/^\ .*-\ /.IP\ \\(bu\ 12\n/g + + ' $1) +# echo "$output" | groff -me -ms -kejpt -T pdf > $base.pdf + +# echo "$output" > $base.ms +# groff -ms $base.ms -T pdf > $base.pdf + +echo "$output" + +# $output >> output.ms +# s/\*\*\*.*\*\*\*/Hi\1hi/g |