From f8dab94fc7adb9058c52923ac021cb5782e4e16b Mon Sep 17 00:00:00 2001 From: Xfnw knuu Date: Wed, 13 Jan 2021 22:40:43 -0500 Subject: [PATCH] fix man html generation so it has actually correct tags --- .Xmodmap | 4 +- .vim/templates/man.css | 120 ++++++++++++++++++++ .vim/templates/man.html | 240 ++++++++++++++++++++-------------------- .vim/vimrc | 2 +- 4 files changed, 245 insertions(+), 121 deletions(-) create mode 100644 .vim/templates/man.css diff --git a/.Xmodmap b/.Xmodmap index f29126d..6194a56 100644 --- a/.Xmodmap +++ b/.Xmodmap @@ -146,8 +146,8 @@ keycode 162 = XF86TaskPane NoSymbol XF86TaskPane NoSymbol XF86TaskPane XF86TaskP keycode 163 = XF86Mail NoSymbol XF86Mail NoSymbol XF86Mail XF86Mail keycode 164 = XF86Favorites NoSymbol XF86Favorites NoSymbol XF86Favorites XF86Favorites keycode 165 = XF86MyComputer NoSymbol XF86MyComputer NoSymbol XF86MyComputer XF86MyComputer -keycode 166 = Page_Up XF86Back XF86Back NoSymbol XF86Back XF86Back -keycode 167 = Page_Down XF86Forward XF86Forward NoSymbol XF86Forward XF86Forward +keycode 166 = Page_Down XF86Back XF86Back NoSymbol XF86Back XF86Back +keycode 167 = Page_Up XF86Forward XF86Forward NoSymbol XF86Forward XF86Forward keycode 169 = XF86Eject NoSymbol XF86Eject NoSymbol XF86Eject XF86Eject keycode 170 = XF86Eject XF86Eject XF86Eject XF86Eject XF86Eject XF86Eject XF86Eject XF86Eject keycode 171 = XF86AudioNext NoSymbol XF86AudioNext NoSymbol XF86AudioNext XF86AudioNext diff --git a/.vim/templates/man.css b/.vim/templates/man.css new file mode 100644 index 0000000..ce767ca --- /dev/null +++ b/.vim/templates/man.css @@ -0,0 +1,120 @@ +:root { + --ansi0: #161510; + --ansi1: #A32810; + --ansi2: #727A18; + --ansi3: #A37720; + --ansi4: #3D6266; + --ansi5: #7A4955; + --ansi6: #557A55; + --ansi7: #8E8463; + --ansi8: #4C4635; + --ansi9: #CC3214; + --ansi10: #8E991E; + --ansi11: #CC9528; + --ansi12: #4C7B7F; + --ansi13: #995B6B; + --ansi14: #6B996B; + --ansi15: #CCBC8E; + --ansi16: #14130E; + --ansi17: #B7A980; + --ansi18: #CCBC8E; + --ansi19: #A34110; + --ansi20: #72694F; +} +.fg0 { color: var(--ansi0); } +.bg0 { background-color: var(--ansi0); } +.fg1 { color: var(--ansi1); } +.bg1 { background-color: var(--ansi1); } +.fg2 { color: var(--ansi2); } +.bg2 { background-color: var(--ansi2); } +.fg3 { color: var(--ansi3); } +.bg3 { background-color: var(--ansi3); } +.fg4 { color: var(--ansi4); } +.bg4 { background-color: var(--ansi4); } +.fg5 { color: var(--ansi5); } +.bg5 { background-color: var(--ansi5); } +.fg6 { color: var(--ansi6); } +.bg6 { background-color: var(--ansi6); } +.fg7 { color: var(--ansi7); } +.bg7 { background-color: var(--ansi7); } +.fg8 { color: var(--ansi8); } +.bg8 { background-color: var(--ansi8); } +.fg9 { color: var(--ansi9); } +.bg9 { background-color: var(--ansi9); } +.fg10 { color: var(--ansi10); } +.bg10 { background-color: var(--ansi10); } +.fg11 { color: var(--ansi11); } +.bg11 { background-color: var(--ansi11); } +.fg12 { color: var(--ansi12); } +.bg12 { background-color: var(--ansi12); } +.fg13 { color: var(--ansi13); } +.bg13 { background-color: var(--ansi13); } +.fg14 { color: var(--ansi14); } +.bg14 { background-color: var(--ansi14); } +.fg15 { color: var(--ansi15); } +.bg15 { background-color: var(--ansi15); } +.fg16 { color: var(--ansi16); } +.bg16 { background-color: var(--ansi16); } +.fg17 { color: var(--ansi17); } +.bg17 { background-color: var(--ansi17); } +.fg18 { color: var(--ansi18); } +.bg18 { background-color: var(--ansi18); } +.fg19 { color: var(--ansi19); } +.bg19 { background-color: var(--ansi19); } +.fg20 { color: var(--ansi20); } +.bg20 { background-color: var(--ansi20); } + +table.head, table.foot { width: 100%; } +td.head-rtitle, td.foot-os { text-align: right; } +td.head-vol { text-align: center; } +div.Pp { margin: 1ex 0ex; } +div.Nd, div.Bf, div.Op { display: inline; } +span.Pa, span.Ad { font-style: italic; } +span.Ms { font-weight: bold; } +dl.Bl-diag > dt { font-weight: bold; } +code.Nm, code.Fl, code.Cm, code.Ic, code.In, code.Fd, code.Fn, +code.Cd { font-weight: bold; font-family: inherit; } + +table { border-collapse: collapse; } +table.Nm code.Nm { padding-right: 1ch; } +table.foot { margin-top: 1em; } + +html { + line-height: 1.25em; + font-family: monospace; + background-color: var(--ansi16); + color: var(--ansi17); + -moz-tab-size: 4; + tab-size: 4; +} +body { + max-width: 80ch; + margin: 1em auto; + padding: 0 1ch; +} +ul.index { padding: 0; } +ul.index li { + display: inline; + list-style-type: none; +} +a { color: var(--ansi4); } +a:visited { color: var(--ansi5); } +a.permalink, a.tag { + color: var(--ansi3); + text-decoration: none; +} +a.permalink code:target, +h1.Sh:target a.permalink, +h2.Ss:target a.permalink, +a.tag:target { + color: var(--ansi11); + outline: none; +} + +.hilex.Keyword { color: var(--ansi7); } +.hilex.Macro { color: var(--ansi2); } +.hilex.Comment { color: var(--ansi4); } +.hilex.String { color: var(--ansi6); } +.hilex.StringFormat { color: var(--ansi14); } +.hilex.Interpolation { color: var(--ansi1); } + diff --git a/.vim/templates/man.html b/.vim/templates/man.html index 96318d7..518e931 100644 --- a/.vim/templates/man.html +++ b/.vim/templates/man.html @@ -1,124 +1,128 @@ - - + html { + line-height: 1.25em; + font-family: monospace; + background-color: var(--ansi16); + color: var(--ansi17); + -moz-tab-size: 4; + tab-size: 4; + } + body { + max-width: 80ch; + margin: 1em auto; + padding: 0 1ch; + } + ul.index { padding: 0; } + ul.index li { + display: inline; + list-style-type: none; + } + a { color: var(--ansi4); } + a:visited { color: var(--ansi5); } + a.permalink, a.tag { + color: var(--ansi3); + text-decoration: none; + } + a.permalink code:target, + h1.Sh:target a.permalink, + h2.Ss:target a.permalink, + a.tag:target { + color: var(--ansi11); + outline: none; + } + + .hilex.Keyword { color: var(--ansi7); } + .hilex.Macro { color: var(--ansi2); } + .hilex.Comment { color: var(--ansi4); } + .hilex.String { color: var(--ansi6); } + .hilex.StringFormat { color: var(--ansi14); } + .hilex.Interpolation { color: var(--ansi1); } + diff --git a/.vim/vimrc b/.vim/vimrc index 4dcdc71..77e3b5f 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -14,7 +14,7 @@ command Tmh :r ~/.vim/templates/man.html " run groff+refer on file :command Groff !sh -c 'p="%"; refer -PS -e -p ~/Documents/bib ${p::-4}.mom | groff -mom -Tpdf > ${p::-4}.pdf' :command Grofft !sh -c 'p="%"; refer -PS -e -p ~/Documents/bib ${p::-4}.mom | groff -mom -T ascii | sed -b "s/\x1b[^m]*m//g" > ${p::-4}.txt' -:command Man !sh -c 'p="%"; mandoc -T html -O fragment "$p" | cat ~/.vim/templates/man.html - > "$p".html' +:command Man !sh -c 'p="%"; mandoc -T html "$p" | tail -n +17 | cat ~/.vim/templates/man.html - > "$p".html' :command Md !p="%"; cmark --unsafe ${p::-3}.md | h2p - ${p::-3}.pdf