Macros and makefile: small fixes.

This commit is contained in:
Karchnu 2022-01-19 19:09:59 +01:00
parent 527c3f98d5
commit 90ab23350c
2 changed files with 25 additions and 58 deletions

View File

@ -8,8 +8,6 @@ ALLSRC = $(shell find . -name "*.ms")
SOELIM_OPTS ?= SOELIM_OPTS ?=
SOELIM = soelim $(SOELIM_OPTS) SOELIM = soelim $(SOELIM_OPTS)
SPECHAR = ./bin/utf8-to-ms.sh
PRECONV_OPTS ?= -e utf-8 PRECONV_OPTS ?= -e utf-8
PRECONV = preconv $(PRECONV_OPTS) PRECONV = preconv $(PRECONV_OPTS)
@ -21,7 +19,7 @@ EQN = eqn $(EQN_OPTS)
# GH_OUTRO: ------------ after ---- ------ ---- -------- -- ---------------- # GH_OUTRO: ------------ after ---- ------ ---- -------- -- ----------------
# GH_INTRO/GH_OUTRO: values are separated by ';' # GH_INTRO/GH_OUTRO: values are separated by ';'
# #
GH_INTRO := .b1;.nr DI 0;.DS I;.fam FiraCode GH_INTRO := .b1;.nr DI 0;.DS I;.fam C
GH_OUTRO := .fam;.DE;.b2 GH_OUTRO := .fam;.DE;.b2
# #
export GH_INTRO export GH_INTRO
@ -64,9 +62,7 @@ GROFF_OPTS ?= -ms -t -Tpdf -U -mspdf -mpdfmark -M ./bin -P -e
GROFF = groff $(GROFF_OPTS) GROFF = groff $(GROFF_OPTS)
$(SRC).pdf: $(SRC).pdf:
cat $(SRC).ms |\ $(SOELIM) < $(SRC).ms |\
$(SOELIM) |\
$(SPECHAR) |\
$(PRECONV) |\ $(PRECONV) |\
$(EQN) |\ $(EQN) |\
$(GHIGHLIGHT) |\ $(GHIGHLIGHT) |\

View File

@ -30,6 +30,7 @@ accumulate
.defcolor specialcolor_module rgb 0.1 0.5 0.2 .defcolor specialcolor_module rgb 0.1 0.5 0.2
.defcolor specialcolor_function rgb 0.4 0.4 0.7 .defcolor specialcolor_function rgb 0.4 0.4 0.7
.defcolor specialcolor_question rgb 0.0 0.0 0.7 .defcolor specialcolor_question rgb 0.0 0.0 0.7
.defcolor specialcolor_operator rgb 0.3 0.8 0.3
.defcolor specialcolor_shine rgb 0.3 0.3 0.7 .defcolor specialcolor_shine rgb 0.3 0.3 0.7
. .
. \" SIZES . \" SIZES
@ -37,6 +38,7 @@ accumulate
.nr specialsize_constructor 8 .nr specialsize_constructor 8
.nr specialsize_module 8 .nr specialsize_module 8
.nr specialsize_function 8 .nr specialsize_function 8
.nr specialsize_operator 9
.nr specialsize_question 10 \" Current point size, no change. .nr specialsize_question 10 \" Current point size, no change.
.nr specialsize_shine 11 .nr specialsize_shine 11
. .
@ -44,7 +46,8 @@ accumulate
.ds specialfont_type CW .ds specialfont_type CW
.ds specialfont_constructor CW .ds specialfont_constructor CW
.ds specialfont_module CW .ds specialfont_module CW
.ds specialfont_function I .ds specialfont_function CW
.ds specialfont_operator CW
.ds specialfont_question I .ds specialfont_question I
.ds specialfont_shine B .ds specialfont_shine B
. .
@ -116,11 +119,10 @@ accumulate
.\" L = draw the line .\" L = draw the line
\r\ \r\
\Z'\D't 1p''\ \Z'\D't 1p''\
\L'|\\nCu' \" draw line (\r moves upward, \L draw the line, ...) \L'|\\nCu' \" draw line
.sp '|\\nDu' \" return to the second marker .gcolor black \" remove previous color
.gcolor \" remove previous color .sp -2 \" get two lines back
.sp -3 \" get three lines back \Z'\D't 1'' \" get the previous drawing thickness back
\Z'\D't'' \" get the previous drawing thickness back
.KE \" end of the keep .KE \" end of the keep
.. ..
. .
@ -186,19 +188,18 @@ accumulate
. .
.de SPECIAL_WORDS .de SPECIAL_WORDS
.nr current_size \\n[.s] \" Current point size. .nr current_size \\n[.s] \" Current point size.
.gcolor specialcolor_\\*[truc] .gcolor specialcolor_\\*[semantictoken]
. .
.if !((\\n[current_size] == \\n[specialsize_\\*[truc]]) \ .if !((\\n[current_size] == \\n[specialsize_\\*[semantictoken]]) \
.ps \\n[specialsize_\\*[truc]] .ps \\n[specialsize_\\*[semantictoken]]
. .
.ie '\\$2'' \{\ .ie '\\$2'' \{\
\f[\\*[specialfont_\\*[truc]]]\\$1\f[] \f[\\*[specialfont_\\*[semantictoken]]]\\$1\f[]
. ps \\n[current_size] . ps \\n[current_size]
. gcolor black \" FIXME: should be the previous color . gcolor black \" FIXME: should be the previous color
.ev
\} \}
.el \{\ .el \{\
\f[\\*[specialfont_\\*[truc]]]\\$1\f[]\c \f[\\*[specialfont_\\*[semantictoken]]]\\$1\f[]\c
. ps \\n[current_size] . ps \\n[current_size]
. gcolor black \" FIXME: should be the previous color . gcolor black \" FIXME: should be the previous color
\\$2 \\$2
@ -222,36 +223,35 @@ accumulate
.I "\\$1" "\\$2" .I "\\$1" "\\$2"
.. ..
.de FUNCTION .de FUNCTION
.gcolor color_function .ds semantictoken function
\f[CW]\\$1\f[]\c .SPECIAL_WORDS "\\$1" "\\$2"
.gcolor
\\$2
.. ..
.de TYPE .de TYPE
.ds truc type .ds semantictoken type
.SPECIAL_WORDS "\\$1" "\\$2" .SPECIAL_WORDS "\\$1" "\\$2"
.. ..
.de TYPECLASS .de TYPECLASS
.I "\\$1" "\\$2" .I "\\$1" "\\$2"
.. ..
.de OPERATOR .de OPERATOR
\f[CW]\\$1\f[]\\$2 .ds semantictoken operator
.SPECIAL_WORDS "\\$1" "\\$2"
.. ..
.de QUESTION .de QUESTION
.ds truc question .ds semantictoken question
.SPECIAL_WORDS "\\$1" "\\$2" .SPECIAL_WORDS "\\$1" "\\$2"
\h'5p' \h'5p'
.. ..
.de CONSTRUCTOR .de CONSTRUCTOR
.ds truc constructor .ds semantictoken constructor
.SPECIAL_WORDS "\\$1" "\\$2" .SPECIAL_WORDS "\\$1" "\\$2"
.. ..
.de MODULE .de MODULE
.ds truc module .ds semantictoken module
.SPECIAL_WORDS "\\$1" "\\$2" .SPECIAL_WORDS "\\$1" "\\$2"
.. ..
.de SHINE .de SHINE
.ds truc shine .ds semantictoken shine
.SPECIAL_WORDS "\\$1" "\\$2" .SPECIAL_WORDS "\\$1" "\\$2"
.. ..
.de MODULEX .de MODULEX
@ -397,32 +397,3 @@ Compilé pour la dernière fois le
.de VOCABULARY2 .de VOCABULARY2
.KE .KE
.. ..
.\".nr G 0 1 \" numéro des notes
.\".de NOTE1
.\".\" macro NOTE1 commence les notes
.\"(\\n+G)
.\". ev 1 \" ouvre un environnement dédié aux notes
.\". br \" casse le flux
.\". da print \" divertit le flux vers print
.\". sp \" espace
.\"\\nx)
.\"..
.\".de NOTE2
.\".\" macro NOTE2 ferme les notes
.\". br \" casse le flux
.\". di \" ferme la diversion
.\". ev \" sort de l'environnement
.\"..
.\".de end
.\".\" macro appellée à la fin du document
.\". br
.\". ev 1 \" en retourne dans l'environnement des notes
.\". print \" execute le contenu de la diversion
.\". br
.\". ev
.\". pl \\n(nlu \" ajuste la taille de la page au nombre de lignes
.\"..
.\".\" définit la macro .end comme macro de fin de document:
.\".\" .em end