You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically it is an update for the issue 54: an empty string is still considered to be a valid unique id.
As the code has gone from toc.py to, I guess, headerid.py, here is a new patch:
--- headerid.py 2012-05-15 15:36:49.000000000 +1000
+++ headerid.py.new 2012-05-15 16:04:25.000000000 +1000
@@ -97,7 +97,7 @@
def unique(id, ids):
""" Ensure id is unique in set of ids. Append '_1', '_2'... if not """
- while id in ids:
+ while id in ids or not id :
m = IDCOUNT_RE.match(id)
if m:
id = '%s_%d'% (m.group(1), int(m.group(2))+1)
basically anything that will check for a non-empty id value will do, e.g. setting
id = id or '_0'
before the while loop, etc ; I assume that the id in ids check is more likely to be true, thus the suggested version .
Again, the point was that for non-ascii headers slugify() returns a completely empty string ( as one can clearly see from its code ), so it looks as a good idea to turn it to something non-empty ; which function -- "slugify()" or "unique()" -- should perform that check, is of course completely a matter of the author's choice -- but as the "slugify()" function could be currently, AFAIR, provided by the user -- it might be a good idea to perform a non-zero check afterwards, i.e. in "unique()" .
Bottom line: here is a patch for the current version for the issue 54 )
The text was updated successfully, but these errors were encountered:
Basically it is an update for the issue 54: an empty string is still considered to be a valid unique id.
As the code has gone from
toc.py
to, I guess,headerid.py
, here is a new patch:basically anything that will check for a non-empty
id
value will do, e.g. settingbefore the
while
loop, etc ; I assume that theid in ids
check is more likely to be true, thus the suggested version .Again, the point was that for non-ascii headers
slugify()
returns a completely empty string ( as one can clearly see from its code ), so it looks as a good idea to turn it to something non-empty ; which function -- "slugify()" or "unique()" -- should perform that check, is of course completely a matter of the author's choice -- but as the "slugify()" function could be currently, AFAIR, provided by the user -- it might be a good idea to perform a non-zero check afterwards, i.e. in "unique()" .Bottom line: here is a patch for the current version for the issue 54 )
The text was updated successfully, but these errors were encountered: