bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

allow hyphen etc unescaped in filenames/links


From: Per Bothner
Subject: allow hyphen etc unescaped in filenames/links
Date: Fri, 7 Aug 2020 13:25:02 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

The DomTerm/Kawa manuals contain hyphens in node names and anchors.
The existing (docbook-based) process preserves these hyphens in filenames and 
links.
This means that migrating to --html output with texinfo-js will break existing 
links.

Breaking existing links is bad enough, but the html link names are really ugly,
and (compatibility aside) I really don't want such links in my web-site.

I would like a configuration option to allow at least '-' and '_'
(hyphen and underscore) to be used without escaping.

Perhaps:
  -c ALLOW_UNESCAPED_IN_LINKS='_-'

The characters in the strings would be used as-is.

A more general facility allows mapping, with a list of pairs:

  -c MAP_CHARACTERS_IN_LINKS='_ _ - - ! _EX_ ? _QU_'

This would take an even number of space-separated strings,
where the first string in each pair is a single character to be mapped,
and the second string in each pair is the replacement.
(To allow re-mapping space, the first string can be a space.)

(The DocBook stylesheets allow customizing each generated name,
but that is more heavy-duty than what I'd want to deal with.)

It seems like either of these would be relatively easy to implement in the
_unicode_to_protected function  (Is there any other code that would need to be 
changed?)

If we want to guard against accidental name clashes, we can maintain a pair of 
hash tables to
map strings to translated string and a reverse table.
_unicode_to_transliterate would look up the name in the forwards table.
If found it would return the result.

If not found, it does the specified mapping.  It looks up the result in the
backwards table.  If there is an existing entry, it generates MANGLED_NAME_N
for increasing values of N until there is no entry.  Optionally, it
may report a warning.  When a unique name is found, it is entered in both the
forwards and backwards tables.

This is issue is the main showstopper before I can switch the DomTerm
manual/web-side to use --html rather than --docbook.  (Though it may make sense
to wait until after or just before a new texinfo release.)
--
        --Per Bothner
per@bothner.com   http://per.bothner.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]