From 90ab23350c037e9b3e8455d1664babff74e8aad4 Mon Sep 17 00:00:00 2001 From: Karchnu Date: Wed, 19 Jan 2022 19:09:59 +0100 Subject: [PATCH] Macros and makefile: small fixes. --- Makefile.in | 8 ++---- macros.ms | 75 ++++++++++++++++------------------------------------- 2 files changed, 25 insertions(+), 58 deletions(-) diff --git a/Makefile.in b/Makefile.in index 854f7aa..c98c445 100644 --- a/Makefile.in +++ b/Makefile.in @@ -8,8 +8,6 @@ ALLSRC = $(shell find . -name "*.ms") SOELIM_OPTS ?= SOELIM = soelim $(SOELIM_OPTS) -SPECHAR = ./bin/utf8-to-ms.sh - PRECONV_OPTS ?= -e utf-8 PRECONV = preconv $(PRECONV_OPTS) @@ -21,7 +19,7 @@ EQN = eqn $(EQN_OPTS) # GH_OUTRO: ------------ after ---- ------ ---- -------- -- ---------------- # 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 # export GH_INTRO @@ -64,9 +62,7 @@ GROFF_OPTS ?= -ms -t -Tpdf -U -mspdf -mpdfmark -M ./bin -P -e GROFF = groff $(GROFF_OPTS) $(SRC).pdf: - cat $(SRC).ms |\ - $(SOELIM) |\ - $(SPECHAR) |\ + $(SOELIM) < $(SRC).ms |\ $(PRECONV) |\ $(EQN) |\ $(GHIGHLIGHT) |\ diff --git a/macros.ms b/macros.ms index 5f482c5..71021ad 100644 --- a/macros.ms +++ b/macros.ms @@ -30,6 +30,7 @@ accumulate .defcolor specialcolor_module rgb 0.1 0.5 0.2 .defcolor specialcolor_function rgb 0.4 0.4 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 . . \" SIZES @@ -37,6 +38,7 @@ accumulate .nr specialsize_constructor 8 .nr specialsize_module 8 .nr specialsize_function 8 +.nr specialsize_operator 9 .nr specialsize_question 10 \" Current point size, no change. .nr specialsize_shine 11 . @@ -44,7 +46,8 @@ accumulate .ds specialfont_type CW .ds specialfont_constructor CW .ds specialfont_module CW -.ds specialfont_function I +.ds specialfont_function CW +.ds specialfont_operator CW .ds specialfont_question I .ds specialfont_shine B . @@ -116,12 +119,11 @@ accumulate .\" L = draw the line \r\ \Z'\D't 1p''\ -\L'|\\nCu' \" draw line (\r moves upward, \L draw the line, ...) -.sp '|\\nDu' \" return to the second marker -.gcolor \" remove previous color -.sp -3 \" get three lines back -\Z'\D't'' \" get the previous drawing thickness back -.KE \" end of the keep +\L'|\\nCu' \" draw line +.gcolor black \" remove previous color +.sp -2 \" get two lines back +\Z'\D't 1'' \" get the previous drawing thickness back +.KE \" end of the keep .. . .de NAMECITATION @@ -186,19 +188,18 @@ accumulate . .de SPECIAL_WORDS .nr current_size \\n[.s] \" Current point size. -.gcolor specialcolor_\\*[truc] +.gcolor specialcolor_\\*[semantictoken] . -.if !((\\n[current_size] == \\n[specialsize_\\*[truc]]) \ -.ps \\n[specialsize_\\*[truc]] +.if !((\\n[current_size] == \\n[specialsize_\\*[semantictoken]]) \ +.ps \\n[specialsize_\\*[semantictoken]] . .ie '\\$2'' \{\ -\f[\\*[specialfont_\\*[truc]]]\\$1\f[] +\f[\\*[specialfont_\\*[semantictoken]]]\\$1\f[] . ps \\n[current_size] . gcolor black \" FIXME: should be the previous color -.ev \} .el \{\ -\f[\\*[specialfont_\\*[truc]]]\\$1\f[]\c +\f[\\*[specialfont_\\*[semantictoken]]]\\$1\f[]\c . ps \\n[current_size] . gcolor black \" FIXME: should be the previous color \\$2 @@ -222,36 +223,35 @@ accumulate .I "\\$1" "\\$2" .. .de FUNCTION -.gcolor color_function -\f[CW]\\$1\f[]\c -.gcolor -\\$2 +.ds semantictoken function +.SPECIAL_WORDS "\\$1" "\\$2" .. .de TYPE -.ds truc type +.ds semantictoken type .SPECIAL_WORDS "\\$1" "\\$2" .. .de TYPECLASS .I "\\$1" "\\$2" .. .de OPERATOR -\f[CW]\\$1\f[]\\$2 +.ds semantictoken operator +.SPECIAL_WORDS "\\$1" "\\$2" .. .de QUESTION -.ds truc question +.ds semantictoken question .SPECIAL_WORDS "\\$1" "\\$2" \h'5p' .. .de CONSTRUCTOR -.ds truc constructor +.ds semantictoken constructor .SPECIAL_WORDS "\\$1" "\\$2" .. .de MODULE -.ds truc module +.ds semantictoken module .SPECIAL_WORDS "\\$1" "\\$2" .. .de SHINE -.ds truc shine +.ds semantictoken shine .SPECIAL_WORDS "\\$1" "\\$2" .. .de MODULEX @@ -397,32 +397,3 @@ Compilé pour la dernière fois le .de VOCABULARY2 .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