Hwaro::Content::Processors::FenceOptions
Parses the Zola/Pandoc-ish {linenos=true, hl_lines="2-4 7", linenostart=5, hide_lines="1 9-12"} fence-info suffix that can
follow a fenced code block's language token.
Grammar: an info string is LANG, LANG {OPTS}, LANG{OPTS}, or
{OPTS}. It only ACTIVATES the options path when the stripped info
ends with }, contains a {, the substring from the first { to
the end is exactly {...} (no nested/unbalanced braces), and
tokenizing the inside yields at least one recognized, validly-valued
key. Anything else (no braces, unterminated {, unparsable tokens,
or only unknown/invalid keys) falls back to the legacy behavior:
the whole info string is treated as a plain language token, exactly
as it was before fence options existed.
Constants
key=value / key="quoted value" pairs, comma/whitespace
separated. \G anchors each successive match to the end of the
previous one (via the pos argument to match), so any leftover
text that isn't whitespace/commas between valid pairs shows up as
unconsumed residue — the caller uses that to invalidate the whole
block rather than silently ignoring garbage.
Instance methods
Returns {lang, opts}. lang is the language token to use for
highlighting (the text before the first {, or the whole info
string when no options block is present/active — "as today").
opts is nil whenever the options block isn't present or
doesn't parse — callers then fall back to legacy behavior keyed
only on lang.