Menu

#143 Use hex as id when there is no ascii character (make_id() in nodes.py)

None
closed-out-of-date
nobody
None
5
2021-04-07
2018-08-18
Sanggu Han
No

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.

1 Attachments

Discussion

  • Günter Milde

    Günter Milde - 2018-11-21

    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.

     
  • Günter Milde

    Günter Milde - 2019-02-12
    • status: open --> pending-remind
     
  • Günter Milde

    Günter Milde - 2021-04-07
    • status: pending-remind --> closed-out-of-date
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.