about summary refs log tree commit diff stats
path: root/readme.st
diff options
context:
space:
mode:
authorCase Duckworth2024-02-06 00:11:59 -0600
committerCase Duckworth2024-02-06 00:11:59 -0600
commitb1b0b5f2b000d20f9bc6fa32a734a6e8fb52eb9b (patch)
treefc18b136592217b33d805027524195b894d8561a /readme.st
parentAdd license, makefile, etc (diff)
downloadsubtext-b1b0b5f2b000d20f9bc6fa32a734a6e8fb52eb9b.tar.gz
subtext-b1b0b5f2b000d20f9bc6fa32a734a6e8fb52eb9b.zip
Change readme.md to readme.st that build to readme.html
Diffstat (limited to 'readme.st')
-rw-r--r--readme.st104
1 files changed, 104 insertions, 0 deletions
diff --git a/readme.st b/readme.st new file mode 100644 index 0000000..1344818 --- /dev/null +++ b/readme.st
@@ -0,0 +1,104 @@
1% SUBTEXT by C. Duckworth <acdw@acdw.net>
2% This file generates README.md when you run `make readme'.
3
4.h1 Subtext, a layered document preperation system
5
6This repo contains the source of my groff-aesthetic document preparator
7.code subtext .
8It's unique in that it's an
9.code awk(1p)
10script that compiles a source file to a
11shell script that you can pipe to
12.code sh(1p) .
13
14Doing things in this multi-layered way allows me to
15..ul
16.li Build a rich writing environment using only off-the-shelf POSIX tools
17.li Use the same input to generate multiple outputs
18.li A cool third thing
19..
20so I can truly write-once, run anywhere
21(or whatever the kids are saying these days).
22Plus, it looks kinda like
23.code roff(1)
24without having to remember all the arcane two-letter requests and macros.
25
26.h2 Quickstart
27
28An easy and quick way to start with $$(code subtext) is to build this README:
29..code
30make readme
31..
32Of course, I'd recommend reading readme.st in this repo
33to get a feel for the syntax as well.
34I've tried to use all the ways to inject control codes to illustrate it.
35
36However, this
37.em quick start
38is not really a good explanation of what's going on.
39For that, keep reading.
40
41.h2 The layers of subtext, the subtextual layers
42
43% I keep writing "subtext", so I'm going to define it here
44#subtext(){ code subtext; }
45
46There are three main layers of $$(subtext): the
47.b awk
48layer,
49.b shell
50layer,
51and, for lack of something better to call it, the
52.b text
53layer.
54These layers don't really reflect the order of expansions,
55but rather how I think they feel to the user
56and how they're reflected in syntax.
57.subtext
58is inherently a line-based markup language,
59and each of these layers has its own line marker.
60
61.h3 Awk layer: $$(code %)
62
63The first thing that happens to any $$(subtext) source file is a pass through
64.code subtext.awk .
65While this awk script passes most things through to the next layers,
66there are two special directives at this layer you can use:
67
68..dl
69.dt $$(code %)
70..dd << /dd
71Comment the current line.
72.code %
73only works at the start of a line for comments.
74/dd
75.
76.dt $$(code %so FILE)
77..dd << /dd
78Insert FILE verbatim at the line where this directive appears.
79FILE is searched in $$(code $ST_SOPATH),
80which by default is the current directory.
81/dd
82..
83
84I went ahead and reserved $$(code %)-lines for future directives
85that need to be done at awk-time.
86
87% NB: The octothorpe on the line below this comment must be escaped or quoted.
88% I'm thinking about escaping #'s as well .. but I think doing that would
89% take extra code I'm not sure I want to bother with, namely working with
90% a character's context. I like the idea that subtext.awk is a pretty-dumb
91% filter, and making it parse shell syntax does not seem like a good time.
92.h3 Shell layer: $$(code \#)
93
94.i todo
95
96.h3 Text layer: $$(code .)
97
98.i todo
99
100.h2 Contributing
101
102Send me an email or whatever :)
103This project is licensed under the BSD-3 license.
104See COPYING for details. \ No newline at end of file