Index: cortav.lua ================================================================== --- cortav.lua +++ cortav.lua @@ -637,11 +637,11 @@ -- sections. to handle this, we provide a "namespace" mechanism, -- where some lua table (really its address in memory) is used -- as a handle for the object and a unique ID is attached to it. -- if the object has an ID of its own, it is guaranteed to be -- unique and returned; otherwise, a generic id of the form --- `x-%u` is generated, where %u is an integer that incrementsfile:///home/lexi/dev/cortav/build/cortav.html +-- `x-%u` is generated, where %u is an integer that increments -- for every new object local ids = {} local canonicalID = {} return function(obj,pfx) pfx = pfx or '' @@ -972,11 +972,19 @@ kind = "paragraph"; spans = ct.parse_span(l, c); } end) -local function insert_section(skind) return function(l,c,j) +local insert_subtitle = blockwrap(function(l,c) + return { + kind = "subtitle"; + spans = ct.parse_span(l:sub(3), c); + } +end) + +local function +insert_section(skind) return function(l,c,j) local depth, id, t = l:match '^([#§^]+)([^%s]*)%s*(.-)$' if id and id ~= "" then if c.doc.sections[id] then c:fail('duplicate section name “%s”', id) end @@ -1175,10 +1183,11 @@ {seq = '¶', fn = insert_paragraph}; {seq = '❡', fn = insert_paragraph}; {seq = '#', fn = insert_section()}; {seq = '§', fn = insert_section()}; {seq = '^', fn = insert_section 'namespace'}; + {seq = '--',fn = insert_subtitle}; {seq = '+', fn = insert_table_row}; {seq = '|', fn = insert_table_row}; {seq = '│', fn = insert_table_row}; {seq = '!', fn = function(l,c,j,d) local last = d[#d] Index: render/html.lua ================================================================== --- render/html.lua +++ render/html.lua @@ -253,10 +253,23 @@ } section { margin: 1.2em 0; } section:first-child { margin-top: 0; } + ]]; + subtitle = [[ + .subtitle { + color: @tone(0.3 20); + font-size: 1.2em; + font-style: italic; + margin-left: 1em; + } + blockquote + .subtitle { + &::before { + content: "— "; + } + } ]]; accent = [[ @media screen { body { background: @bg; color: @fg } a[href] { @@ -870,10 +883,14 @@ end; paragraph = function(b,s) addStyle 'paragraph' return tag('p', nil, sr.htmlSpan(b.spans, b, s), b) end; + subtitle = function(b,s) + addStyle 'subtitle' + return tag('div', {class='subtitle'}, sr.htmlSpan(b.spans, b, s), b) + end; directive = function(b,s) -- deal with renderer directives local _, cmd, args = b.words(2) if cmd == 'page-title' then if not opts.title then doctitle = args end