When there is no ascii character in string, make_id()
returns empty string.
This scheme makes nodes with no ascii character remain anonymous, although they need to have id (like headings).
### Patch description
In make_id()
, after drop every non-ascii characters in id
, check whether id
is empty string or not.
If id is empty string (case when there id no ascii character in id
), let name be hex value of it's own, replace 0x
with u
(since first character must be [a-z]
.
(ex. ø
(0x00f8) to u00f8
, øø
(0x00f8 0x00f8) to u00f8u00f8
)
Otherwise (case when at least on ascii character exists in id
), i didn't modify anything.
Thank you for the patch.
In nodes.document.set_id(), there is a provision for the case of an empty return value of
make_id(), so compulsory ids are never empty.
What is your use case (minimal example)? Maybe there is an alternative solution or a workaround.
Superseded by https://sourceforge.net/p/docutils/feature-requests/66/