A file of attributes to allow named references to be used, based on W3C HTML5.2 named character references.
Asciidoctor supports HTML named character references, as well as decimal and hex.
asciidoctor-pdf
does not (besides lt
, gt
, amp
, quot
, and apos
), for good reasons, from a parser perspective.
The recommended workaround is to define attributes in your header for symbols you use a lot.
This is a file which can be include::
d in your header block which establishes many references for you.
There are lots of names, and they are generic by design.
In order to distinguish character references from your other attributes, -
is appended to the end.
Named character references are case-sensitive, but AsciiDoc attributes are not.
Therefore, blocks of capitals in names are surrounded with _
.
For convenience, cases where capitalisation exists but is not required for uniqueness (i.e. the lower-case version is not also a name), the lower-case version with no underscores is also included.
:_A_acute-: &193;
:aacute-: &225;
// ...
:boxvr-: &9500;
:boxv_R_-: &9566;
:box_V_r-: &9567;
:box_VR_-: &9568;
// ...
:capitaldifferentiald-: &8517;
:_C_apital_D_ifferential_D_-: &8517;
// ...
= A test file
:author: clbarnes
:doctype: article
:reproducible:
:source-highlighter: coderay
include::character_refs.adoc[]
.Here are some test characters:
* {dagger-} // (1)
* {aacute-}
* {_A_acute-} // (2)
* {_a_acute-} (should look the same as above) // (3)
* {\_C_apital_D_ifferential_D_-} // (4)
* {capitaldifferentiald-} (should look the same as above) // (5)
-
Note the trailing
-
-
Capitals are surrounded by underscores
-
But letters are actually case insensitive
-
If an attribute starts and ends with a capitals, and therefore underscores, the first must be escaped
-
Lower-case for convenience