HaXtatic Docs

hax.miniTag

Outputs  <somehtmltag ..>tag's inner-markup content</somehtmltag>.

In a nutshell

  1. Declaration of an |X|hax.miniTag:myTag:somehtmltag: .. directive in a *.haxproj file,
    • further configuring: attr
  2. Usage anywhere: {X|myTag: tag's inner-markup content |}

Stage:

Early — this X-renderer does not require a page context for rendering: therefore many hax.miniTag-invoking X-tags encountered during pre-templating (at start-up time) may be eagerly processed immediately in-place (for overall-reduced per-page processing loads).

Purpose

Some markup contents require repetetive use of quickly-becoming-too-verbose "mostly just inner text" tags such as (often in raw-HTML contents) <blockquote>, <code>, or <p class="my-para-highlighted my-smallerfont my-roundborder"> etc.

Setting up hax.miniTag X-tags for such instances alleviates this easily, and lets the author turn repetetive-hence-too-verbose occurrences of, for example:

  • <blockquote>content</blockquote>
    → into {X|bq:content|}
  • <code>content</code>
    → into {X|c:content|}
  • <p class="my-para-highlighted my-smallerfont my-roundborder">content</p>
    → into {X|phsr:content|}
  • et cetera..

Declaration / Configuration

To demonstrate valid *.haxproj directives to declare the above 3 example X-tags:

|X|hax.miniTag:bq:blockquote

|X|hax.miniTag:c:
    code: attr = []

|X|hax.miniTag:phsr: p:attr
    = [ ("class" , "my-para-highlighted my-smallerfont"),
        ("class" , "my-roundborder") ]

To elaborate, for example the last one of the above, as all |X| directives declaring X-tags do:

  • begins with |X| followed by the X-renderer identifier (here hax.miniTag)
  • followed by  : colon and the desired X-tag name to be used to invoke it (here ),
  • followed by  : colon and now hax.miniTag-specific configuration:
  • The name of the output markup-language tag that this X-tag should wrap its content in (here blockquote),
  • followed by a  : colon if an optional syntax-sensitive properties block follows, comprised (if present at all) of all the following properties in this very order:
    1. attr = [ .. ] — a List of all the tag attributes (each denoted in a ("name","value") pair) to always append to the markup-language tag output by all instances of this X-tag
      • The special attribute value placeholder  {:c:} will replicate the X-tag content inside this attribute (not specially escaped: if this is needed, wrap inside a page-delayed X-tag invoking hax.xmlEscape as usual)

Invocation / Parameters

No special tag parameters, no special content treatment: the entire X-tag content (ie. following the tag name such as above phsr and then  : colon, as in {X|phsr:content|}) is output as-is, inside the output markup tag configured for the X-tag (ie. as above, <p class="my-para-highlighted my-smallerfont my-roundborder">content</p>).

Caution: if no such X-tag content is present, nothing is rendered out at all, not even the intended (would-be empty) output markup tag. This is by design and more often than not desirable, especially in certain scenarios of somewhat-dynamic tag contents.