Skip to content

Commit

Permalink
topgit.html: generate using a consistent style
Browse files Browse the repository at this point in the history
Eviscerate the guts of the generated topgit.html content and
transplant it into something that produces a more pleasing result.

The resulting final topgit.html documention file should now
always be essentially the same no matter where it's generated.

It is also now color-agnostic and can therefore be viewed in
"dark" mode if desired.

Signed-off-by: Kyle J. McKay <[email protected]>
  • Loading branch information
mackyle committed Sep 2, 2021
1 parent 8188287 commit 47acf95
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 5 deletions.
21 changes: 17 additions & 4 deletions Makefile.mak
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,26 @@ html: topgit.html $(html_out)
tg-tg.txt: README_DOCS.rst create-html-usage.pl $(commands_in)
$(QHELPTG)perl ./create-html-usage.pl --text < README_DOCS.rst > $@

topgit.html: README_DOCS.rst create-html-usage.pl $(commands_in)
TOPGIT_HTML_SRCS = \
README_DOCS.rst \
rsrc/stub1.bin \
rsrc/stub2.bin \
Makefile.mt
#TOPGIT_HTML_SRCS

topgit.html: $(TOPGIT_HTML_SRCS) Makefile.mak create-html-usage.pl $(commands_in)
$(Q)command -v "$${RST2HTML:-rst2html}" >/dev/null || \
{ echo "need $${RST2HTML:-rst2html} to make $@" >&2; exit 1; }
$(QPOUND)echo "# \$${RST2HTML:-rst2html} is \"$${RST2HTML:-rst2html}\""
$(QHTMLTOPGIT)perl ./create-html-usage.pl < README_DOCS.rst | "$${RST2HTML:-rst2html}" - $@.tmp && \
LC_ALL=C sed -e 's/&nbsp;/\&#160;/g' -e 's/<th class=/<th align="left" class=/g' <$@.tmp >$@ && \
rm -f $@.tmp
$(QHTMLTOPGIT)perl ./create-html-usage.pl < README_DOCS.rst | \
"$${RST2HTML:-rst2html}" --stylesheet-path=Makefile.mt - $@.tmp && \
{ cat rsrc/stub1.bin && \
LC_ALL=C sed -e 's/&nbsp;/\&#160;/g' -e 's/<th class=/<th align="left" class=/g' \
-e 's/ -- / \&#x2013; /g' -e 's/&amp;#160;/\&#160;/g' \
-e 's/<ol class="lowerroman/<ol type="i" class="lowerroman/g' \
-e 's/<ol class="loweralpha/<ol type="a" class="loweralpha/g' <$@.tmp | \
LC_ALL=C awk '/^<body/{p=1;next}/^<\/body/{p=0;next}p{print}' && \
cat rsrc/stub2.bin; } >$@ && rm -f $@.tmp

$(html_out): create-html.sh
$(QHTML)CMD="$@" && CMD="$${CMD#tg-}" && CMD="$${CMD%.html}" && \
Expand Down
2 changes: 1 addition & 1 deletion create-html-usage.pl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ sub maybe_uc
} else {
printf "%s", join("",map({"$tab| ".'``'.$_.'``'."\n"} @usage));
@options and printf "$tab|\n$tab| ".'``Options:``'."\n%s",
join("",map({"$tab| ".'``'.$_.'``'."\n"} @options));
join("",map({"$tab| ".'``&#160;&#160;'.$_.'``'."\n"} @options));
}
$_ = "";
}
Expand Down
2 changes: 2 additions & 0 deletions rsrc/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/stub1.bin -text
/stub2.bin -text
151 changes: 151 additions & 0 deletions rsrc/stub1.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TopGit &#x2013; A different patch queue manager</title>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
/* <![CDATA[
*
* Style sheet for TopGit topgit.html documentation
* Copyright (C) 2021 Kyle J. McKay
* All rights reserved
* License GPL2
*
*/

body {
font-family: Times, serif;
font-size: medium;
font-weight: normal;
}
h1, h2, h3, th.field-name, a.reference.internal {
font-family: Helvetica, sans-serif;
font-weight: normal;
}
h1 {
font-size: large;
margin-top: 1.25em;
margin-bottom: 0.75em;
}
h1.title {
font-size: xx-large;
text-align: center;
margin-top: 1em;
margin-bottom: 1em;
}
h2 {
font-size: medium;
margin-top: 1em;
margin-bottom: 1em;
font-variant: small-caps;
}
div#usage h2 {
margin-top: 1.25em;
margin-bottom: 0.75em;
font-variant: normal;
font-weight: bold;
}
div#usage blockquote {
margin-top: 0;
margin-bottom: 0;
}
h3 {
font-size: medium;
margin-top: 1em;
margin-bottom: 1em;
}
div {
margin: 0;
}
pre, tt {
font-family: Menlo, Consolas, Courier, monospace;
font-size: smaller;
font-weight: normal;
}
pre {
margin: 0 3ex;
border: thin dotted;
padding: 0.5em 1ex;
}
tt {
white-space: nowrap;
padding: 0 0.5ex;
}
div.line-block {
margin-bottom: 1em;
}
div.line-block > div.line-block {
margin-left: 2ex;
}
div.line {
padding-left: 4ex;
text-indent: -4ex;
}
div.line tt {
white-space: pre-wrap;
}
p {
text-align: justify;
margin-top: 0.5em;
margin-bottom: 0.5em;
}
div#usage p, div#merge-strategies ol * {
text-align: left;
}
dl, ol {
margin-top: 1em;
}
li > dl, dt, div#conventions li {
margin-top: 0.5em;
}
dd > p {
margin: 0;
}
th, td {
vertical-align: top;
}
td.option-group {
padding-right: 1ex;
}
td.option-group span.option {
white-space: nowrap;
}
tr.field {
line-height: 1.0;
}
th.field-name {
padding-right: 2ex;
}
th.field-name,
th.field-name + td {
padding-top: 0.33333em;
}
tbody > tr:first-child > th.field-name,
tbody > tr:first-child > th.field-name + td {
padding-top: 0;
}
th[colspan="2"].field-name {
vertical-align: bottom;
padding-bottom: 0;
}
tr.field > td:first-child, tr.field > td:first-child + td {
padding-top: 0;
}
th.field-name > tt, dt > tt {
padding-right: 0;
}
ol.loweralpha {
list-style-type: lower-alpha;
}
ol.lowerroman {
list-style-type: lower-roman;
}

/*
* ]]>
*/
</style>
</head>
<body style="text-align:center">
<div style="display:inline-block;text-align:left;max-width:44pc">
3 changes: 3 additions & 0 deletions rsrc/stub2.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
</div>
</body>
</html>

0 comments on commit 47acf95

Please sign in to comment.