Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling Special Chars via Attributes Substitutions #4

Open
2 of 3 tasks
tajmone opened this issue Sep 11, 2020 · 0 comments
Open
2 of 3 tasks

Handling Special Chars via Attributes Substitutions #4

tajmone opened this issue Sep 11, 2020 · 0 comments
Labels
⭐ attributes Topic: AsciiDoc attributes

Comments

@tajmone
Copy link
Collaborator

tajmone commented Sep 11, 2020

  • Create the gitbuch_custom-attributes.adoc file for defining custom attributes for special characters substitutions (and any other substitution that might be useful)
    • Include it in the main gitbuch.asciidoc source.
  • When the draft translation is completed, work out which special chars need to be substituted with custom attributes and update this tasks list.

The AsciiDoc source docs contain many special characters that need to be represented either via a predefined attribute for character replacements or an SVG/HTML entity character reference.

When a native textual symbol replacement is not available, we should always use a predefined attribute for character replacements, if available (and not too verbose), failing that we should use custom-defined attributes (with intuitive IDs) that will be translated to the character's HTML numerical entity representation.

There are various issues at stake here:

  1. cross-format support — named HTML entities should be avoided in favor of their numerical representation, because they are not supported by all backends (e.g. PDF). From the Asciidoctor Manual (emphasis added):

    [3] Asciidoctor allows you to use any of the named character references (aka named entities) defined in HTML (e.g., € resolves to €). However, using named character references can cause problems when generating non-HTML output such as PDF because the lookup table needed to resolve these names may not be defined. Our recommendation is avoid using named character references—​with the exception of those defined in XML (i.e., lt, gt, amp, quot and apos). Instead, use numeric character references (e.g., €).

  2. human readability — HTML entities (especially in their numerical format) don't provide a good reading experience for the maintainers — e.g. – for en-dash (), whereas a custom attribute like {en-dash} looks better.

  3. editors/IDEs highlighting — due to the complex nature of the AsciiDoc syntax, the presence of special chars which are also formatting tokens (e.g. *, _, ^, etc.) will break syntax coloring (for the whole document) in many editors when these occur as mere characters. Custom attributes will effectively prevent this, simplifying the editing work.

Of course, the downside of using custom-defined attributes for substitutions is that inside source or verbatim blocks it becomes necessary to enable attributes substitutions (via [subs=]).

References

@tajmone tajmone added the ⭐ attributes Topic: AsciiDoc attributes label Sep 11, 2020
tajmone added a commit that referenced this issue Sep 11, 2020
Create the `gitbuch_custom-attributes.adoc` file for defining custom
attributes for special chars substitutions, `include::` it in the main
`gitbuch.asciidoc` source. (See #4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ attributes Topic: AsciiDoc attributes
Projects
None yet
Development

No branches or pull requests

1 participant