From 4bf0b21b2e964cab0e8a8b6a4a4d681ddbff0b37 Mon Sep 17 00:00:00 2001 From: dozens Date: Mon, 22 Jan 2024 10:28:25 -0700 Subject: [PATCH] lots of changes ended up making this a lot more complex: - moved the document itself to `src/guide.xml` - added dependency: `xq` converts xml to json - added dependency: mustache converts json to groff - moved helper groff macros to `src/guide.tmac` learned some groff after reading *Unix Text Processing* https://www.oreilly.com/openbook/utp/ - made the `ul` macro a conditional toggle - fixed the formatting issues i had with the section headers and also moved the section numbering to a global number register, and just formatted it as an Alpha character - the numbering issue with the item list was simply that i wasn't escaping the register name enough times --- README.md | 34 +++++++++++++++++++-- guide.ms | 80 ------------------------------------------------- guide.pdf | Bin 13101 -> 12927 bytes guide.txt | 59 ------------------------------------ justfile | 10 +++---- src/guide.tmac | 25 ++++++++++++++++ src/guide.tmpl | 36 ++++++++++++++++++++++ src/guide.xml | 33 ++++++++++++++++++++ 8 files changed, 130 insertions(+), 147 deletions(-) delete mode 100644 guide.ms delete mode 100644 guide.txt create mode 100644 src/guide.tmac create mode 100644 src/guide.tmpl create mode 100644 src/guide.xml diff --git a/README.md b/README.md index 809d4bd..26eb06e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,36 @@ -# Practice Guide +# PRACTICE GUIDE A generic version of the Practice Guide for Computer without the dependency on LaTeX. -You will instead need just groff and m4. +View original here: +https://codeberg.org/oneirophage/practice-guide-for-computer -View original here: +## YOU WILL NEED + +- m4: change MUSIC to COMPUTER. (Note to self: Why not just use sed?) https://www.gnu.org/software/m4/manual/m4.html +- groff: pdf output. https://www.gnu.org/software/groff/manual/groff.html +- mustache: for templating. https://mustache.github.io/ +- xq: a wrapper for jq that adds support for xml. https://kislyuk.github.io/yq/#xml-support + +## YOU WILL FIND HERE + +``` +. +├── README.md +├── guide.pdf +├── justfile +└── src + ├── guide.tmac + ├── guide.tmpl + └── guide.xml + +2 directories, 6 files +``` + +1. README.md: you're reading it! +2. guide.pdf: the output +3. justfile: build command +4. guide.tmac: some groff helper macros +5. guide.tmpl: the mustache template that creates the groff +6. guide.xml: the actual document source diff --git a/guide.ms b/guide.ms deleted file mode 100644 index 5add3f1..0000000 --- a/guide.ms +++ /dev/null @@ -1,80 +0,0 @@ -define(`MUSIC',`COMPUTER')dnl -. -. -. -.de Heading -.sp -.SH -.LG -.B "\\$*" -.sp -.. -. -. -. -.ce 2 -.ps 21 -.B "Practice Guide for MUSIC" -.ps -.sp -Adapted from oneirophage's practice-guide-for-computer\** -.FS -https://codeberg.org/oneirophage/practice-guide-for-computer -.FE -.sp -.LP -.ps 16 -Before starting your daily practice routine, read and seriously consider the following: -. -. -.Heading "A.\h'1m'DAILY AFFIRMATIONS" -.RS -.nr i 0 1 -.IP \n+[i] 2m -How fortunate I am that in this life I am one who has been allowed to create beauty with MUSIC. -.IP \n+[i] 2m -It is my responsibility to create peace, beauty, and love with MUSIC. -.RE -. -. -. -.Heading "B.\h'1m'I WILL BE KIND TO MYSELF" -.RS -.nr i 0 1 -.IP \n+[i] 2m -IT IS ONLY MUSIC -.IP \n+[i] 2m -No matter my level of development in MUSIC, how good or bad I think I am, it is only MUSIC and I am a beautiful person. -.IP \n+[i] 2m -I will not compare myself with my colleagues. If they do MUSIC beautifully, I will enjoy it and be thankful and proud that I live in fellowship with them. -.IP \n+[i] 2m -There will always be someone with more abilities in MUSIC than my own as there will be those with less. -.RE -. -. -. -.Heading "C.\h'1m'REASONS TO DO MUSIC" -.RS -.nr i 0 1 -.IP \n+[i] 2m -To contribute to the world's spiritual growth. -.IP \n+[i] 2m -To contribute to my own self-discovery and spiritual growth. -.IP \n+[i] 2m -To pay homage to all the great practitioners of MUSIC, past and present, who have added beauty to the world. -.RE -. -. -. -.Heading "D.\h'1m'RID YOUR SELF OF THE FOLLOWING REASONS FOR BEING A PRACTITIONER OF MUSIC" -.RS -.nr i 0 1 -.IP \n+[i] 2m -To create self-esteem -.IP \n+[i] 2m -To be "hip" -.IP \n+[i] 2m -To manipulate -.IP \n+[i] 2m -To get rich or famous -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CeX9!`bcnpggo$KqL_-AuTwd=8hQqy?e?)Fhgh`;hmj; zgd0qC5d}_+fK!DdGTxufd`NB5=E8YW3cFDN8Mb~;skHN``AR2vIdV z-Qd9!-YvjXj^LM19H04wOH6d+KZTaNL;w|$73{iaX>04x%kchA8#$AS26dE`@9iLT zndmnR^5!f(m-`%L#rqIeXC;5}>rAGpWPWP&Xya&T&{+4qkB=~M1sYHIt2bpgUzXl> zEp7sHM(s<2zhwRNLD@$3olV{7%=Oy%>P}|EqQ_Tp*FSm_)6N9n&VRuUIcOk`PR^gK zMi-I0?tj!xf{=XGILQ!1D!w8nfvpH#Tgt1~g)HX@J!4xRs_*wKx!cSoppXzp_2am69~i^9C1^ zi+#lmtte{>XS&|^a~)&ZU9Qo@xZLYjn2`G}qb2ft&Gcvd@6-KIS3P|J>5Fn?AR388 z;gDD~4v9)XC6D`iUy~%?ZlH!Y!{{LXQ#$@Sfd2|4${d4D_d?>hD5N=l*ARh5BX%1Q z=4Pn>V^|adx!a31N15$rI1FZY1`>hABYx~D|NSZi5|78Eo1p9fSPTN7r$_w77VsD0 ChMXw? diff --git a/guide.txt b/guide.txt deleted file mode 100644 index b554e9f..0000000 --- a/guide.txt +++ /dev/null @@ -1,59 +0,0 @@ - - - Practice Guide for COMPUTER - - -Before starting your daily practice routine, read and seriously -consider the following: - - -A. DAILY AFFIRMATIONS - - - 1 How fortunate I am that in this life I am one who has been - allowed to create beauty with COMPUTER. - - 2 It is my responsibility to create peace, beauty, and love - with COMPUTER. - - -B. I WILL BE KIND TO MYSELF - - - 1 IT IS ONLY COMPUTER - - 2 No matter my level of development in COMPUTER, how good or - bad I think I am, it is only COMPUTER and I am a beautiful - person. - - 3 I will not compare myself with my colleagues. If they do - COMPUTER beautifully, I will enjoy it and be thankful and - proud that I live in fellowship with them. - - 4 There will always be someone with more abilities in COM- - PUTER than my own as there will be those with less. - - -C. REASONS TO DO COMPUTER - - - 1 To contribute to the world's spiritual growth. - - 2 To contribute to my own self-discovery and spiritual - growth. - - 3 To pay homage to all the great practitioners of COMPUTER, - past and present, who have added beauty to the world. - - -D. RID YOUR SELF OF THE FOLLOWING REASONS FOR BEING A PRACTI- -TIONER OF COMPUTER - - - 1 To create self-esteem - - 2 To be "hip" - - 3 To manipulate - - 4 To get rich or famous diff --git a/justfile b/justfile index b8afb4d..89dcfc2 100644 --- a/justfile +++ b/justfile @@ -1,5 +1,5 @@ -build: - m4 guide.ms | groff -Tpdf -ms > guide.pdf - -watch: - ls guide.ms | entr -r just build +pdf: + m4 -DMUSIC=COMPUTER src/guide.xml \ + | xq . \ + | mustache - src/guide.tmpl \ + | groff -Tpdf -ms > guide.pdf diff --git a/src/guide.tmac b/src/guide.tmac new file mode 100644 index 0000000..51af4e4 --- /dev/null +++ b/src/guide.tmac @@ -0,0 +1,25 @@ +.de Heading +.sp +.SH +.IP \f[B]\s+2\\n+[HX].\s0\f[] 5n +.B +.LG +\\$* +.sp +.. +. +. +.de UL +.ie !"\\$1"" \{\ +. RE\} +.el \{\ +. RS +. nr idx 0 1\} +.. +. +. +.de li +.IP \\n+[idx]. 2m +\\$* +.. + diff --git a/src/guide.tmpl b/src/guide.tmpl new file mode 100644 index 0000000..8764c41 --- /dev/null +++ b/src/guide.tmpl @@ -0,0 +1,36 @@ +{{#doc}} +.nr HY 0 \" Turn off hypenation +.nr HX 0 1 +.af HX A +.so src/guide.tmac +. +. +. +{{#header}} +.\" HEADER +.ce 2 +.ps 21 +.B "{{title}}" +.ps +.sp +.LP +.ps 16 +.vs 16 +{{tagline}} +.\" END HEADER +{{/header}} +. +. +. +{{#main}} +.\" MAIN +{{#section}} +.Heading {{title}} +. UL +{{#item}} +. li {{{.}}} +{{/item}} +. UL OFF +{{/section}} +{{/main}} +{{/doc}} diff --git a/src/guide.xml b/src/guide.xml new file mode 100644 index 0000000..d3580b7 --- /dev/null +++ b/src/guide.xml @@ -0,0 +1,33 @@ + +
+ Practice Guide for MUSIC + Before starting your daily practice routine, read and seriously consider the following: +
+
+
+ DAILY AFFIRMATIONS + How fortunate I am that in this life I am one who has been allowed to create beauty with MUSIC. + It is my responsibility to create peace, beauty, and love with MUSIC. +
+
+ I WILL BE KIND TO MYSELF + IT IS ONLY MUSIC + No matter my level of development in MUSIC, how good or bad I think I am, it is only MUSIC and I am a beautiful person. + I will not compare myself with my colleagues. If they do MUSIC beautifully, I will enjoy it and be thankful and proud that I live in fellowship with them. + There will always be someone with more abilities in MUSIC than my own as there will be those with less. +
+
+ REASONS TO DO MUSIC + To contribute to the world's spiritual growth. + To contribute to my own self-discovery and spiritual growth. + To pay homage to all the great practitioners of MUSIC, past and present, who have added beauty to the world. +
+
+ RID YOUR SELF OF THE FOLLOWING REASONS FOR BEING A PRACTITIONER OF MUSIC + To create self-esteem + To be "hip" + To manipulate + To get rich or famous +
+
+