@@ -100,24 +100,24 @@ ** [`~~~ title ~~~] ** [`~~~ title \[language\] ~~~] ** [`~~~ \[language\] title ~~~] ** [`~~~ title \[language\] #id ~~~] -*[*definition] ([^def-ex tab]): a line [^def-tab-enc beginning with a tab] is a multipurpose metadata syntax. the tab may be followed by an identifier, a colon, and a value string, in which case it opens a new definition; alternatively, a second tab character turns the line into a [*definition continuation], adding the remaining characters as a new line to the definition value on the previous line. when a new definition is opened on a line immediately following certain kinds of objects, such as resource, it attaches key-value metadata to that object. when a definition is not preceded by such an object, an independent [*reference] is created instad. -** a [*reference] is a general mechanism for out-of-line metadata, and references are used in many different ways -- e.g. to specify link destinations, footnote contents, abbreviations, or macros. to ensure that a definition is interpreted as a reference, rather than as metadata for an object, precede it with a blank line. +*[*definition] ([^def-ex tab]): a line [^def-tab-enc beginning with a tab] is a multipurpose metadata syntax. the tab may be followed by an identifier, a colon, and a value string, in which case it opens a new definition; alternatively, a second tab character turns the line into a [*definition continuation], adding the remaining characters as a new line to the definition value on the previous line. when a new definition is opened on a line immediately following certain kinds of objects, such as resources, embeds, or multiline macro expansions, it attaches key-value metadata to that object. when a definition is not preceded by such an object, an independent [*reference] is created instad. +** a [*reference] is a general mechanism for out-of-line metadata, and references are used in many different ways -- e.g. to specify link destinations, footnote contents, abbreviations, or macro bodies. to ensure that a definition is interpreted as a reference, rather than as metadata for an object, precede it with a blank line. def-tab-enc: in encodings without tab characters, a definition is opened by a line beginning with two blanks, and continued by a line beginning with four blanks. def-ex: [*open a new reference]: [`[!\\t][$key]: [$value]] [*continue a reference]: [`[!\\t\\t][$value]] * [*quotation] ([`<]): a line of the form [`<[$name]> [$quote]] denotes an utterance by [$name]. * [*blockquote] ([`>]): alternate blockquote syntax. can be nested by repeating the [`>] character. * [*subtitle/caption] ([`\--]): attaches a subtitle to the previous header, or caption to the previous object -* [*embed] ([`&]): embeds a referenced object. can be used to show images or repeat previously defined objects like lists or tables, optionally with a caption. -** [`$[$macro] [$arg1]|[$arg2]|[$argn]…] invokes a block-level macro with the supplied arguments -*** [`$mymacro arg 1|arg 2|arg 3] +* [*embed] ([`&]): embeds a referenced object. can be used to show images or repeat previously defined objects like lists or tables, optionally with a caption. an embed line can be followed immediately by a sequence of [*definitions] in the same way that resource definitions can, to override resource properties on a per-instance basis. note that only presentation-related properties like [$desc] can be meaningful overridden, as embed does not trigger a re-render of the parse tree; if you want to override e.g. context variables, use a multiline macro invocation instead. ** [`&[$image]] embeds an image or other block-level object. [!image] can be a reference with a url or file path, or it can be an embed section (e.g. for SVG files) ***[`&myimg All that remained of the unfortunate blood magic pageant contestants and audience (police photo)] ** [`&-[$ident] [$styled-text]] embeds a closed disclosure element containing the text of the named object (a nonprinting section or cortav resource should usually be used to store the content; it can also name an image or video, of course). in interactive outputs, this will display as a block which can be clicked on to view the full contents of the referenced object [$ident]; if [$styled-text] is present, it overrides the title of the section you are embedding (if any). in static outputs, the disclosure object will display as an enclosed box with [$styled-text] as the title text *** [`&-ex-a Prosecution Exhibit A (GRAPHIC CONTENT)] ** [`&+[$section] [$styled-text]] is like the above, but the disclosure element is open by default +* [`$[$macro] [$arg1]|[$arg2]|[$argn]…] invokes a block-level macro with the supplied arguments, and can be followed by a property override definition list the same way embed and resource lines can. note that while both [`$[$id]] and [`&[$id]] can be used to instantiate resources of type [`text/x.cortav], there is a critical difference: [`$[$id]] renders out the sub-document separately each time it is named, allowing for parameter expansion and for context variables to be overridden for each invocation. by contrast, [`&[$id]] can only insert copies of the same render; no parameters can be passed and context variables will be expanded to their value at the time the resource was defined. +** [`$mymacro arg 1|arg 2|arg 3] * [*horizontal rule] ([`\---]): inserts a horizontal rule or other context break; does not end the section. must be followed by newline. underlines can also be used in place of dashes ([`___], [`-_-], [`__-__-__] etc), as can horizontal unicode box drawing characters ([`─ ━ ┈] etc). * [*page break] ([`\^^]): for formats that support pagination, like EPUB or HTML (when printed), indicates that the rest of the current page should be blank. for formats that do not, extra margins will be inserted. does not create a new section * [*page rule] ([`\^-^]): inserts a page break for formats that support them, and a horizontal rule for formats that do not. does not create a new section. comprised of any number of horizontal rule characters surrounded by a pair of carets (e.g. [`^-^] [`^_^] [`^----^] [`^__--^] [`^┈┈┈┈┈^]) * [*table cells] ([`+ |]): see [>ex.tab table examples]. @@ -371,9 +371,9 @@ *** [`font/*] can be used with the HTML backend to reference a web font *** [`font/woff2] can be used with the HTML backend to reference a web font *** [`text/plain] (will be inserted as a preformatted text block) *** [`text/css] (can be used when producing HTML files to link in an extra stylesheet, either by embedding it or referencing it from the header) -*** [`text/x.cortav] (will be parsed and inserted as a formatted text block; context variables can be passed to the file by setting [`ctx.[$var]] parameters on the resource, e.g. [`ctx.recipient-name: Mr. Winthrop]) +*** [`text/x.cortav] (will be parsed and inserted as a formatted text block; context variables can be passed to the file by setting [`.[$var]] properties on the resource, e.g. [`.recipient-name: Mr. Winthrop]) *** [`application/x-troff] can be used to supply sections of text written in raw [`groff] syntax. these are ignored by other renderers. *** [`text/html] can be used to supply sections of text written in raw HTML. these are ignored by non-HTML outputs. *** any MIME-type that matches the type of file being generated by the renderer can be used to include a block of data that will be passed directly to the renderer. ** URI types: additional URI types can be added by extensions or different implementations, but every compliant implementation must support these URIs. @@ -610,8 +610,58 @@ ~~~ macros #mac [cortav] ~~~ the ranuir word {gloss cor|writing}… gloss: [*[#1]] “[#2]” + +$def sur|n|socialism +$def par|n|speech + def: * [*[#1]] [!([#2])] + ** [#3] + +%% equivalent to + +@def { + * [*[#1]] [!([#2])] + ** [#3] +} +$def sur|n|socialism +$def par|n|speech + +%% we could even do the same thing abusing context variables + +@def { + * [*[#word]] [!([#pos])] + ** [#meaning] +} + +$def + .word: sur + .pos: n + .meaning: socialism +$def + .word: par + .pos: n + .meaning: speech + +%% context variables are useful because they inherit from the enclosing context +%% thus, we can exploit resource syntax to create templates with default values + +@agent { + + CODENAME :| [#1] + + CIVILIAN IDENTITY :| [#civil] + + RULES of ENGAGEMENT :| [#roe] + + DANGER LEVEL :| [#danger] +} + .civil: (unknown) + .roe: Monitor; do not engage + .danger: (unknown) + +$agent ZUCCHINI PARABLE + .civil: Zephram "Rolodex" Goldberg + .danger: Category Scarlet +$agent RHADAMANTH EXQUISITE + .roe: Eliminate with extreme prejudice; CBRN deployment authorized + .danger: [*Unquantifiable] ~~~ ~~~ tables #tab [cortav] ~~~ here is a glossary table.