View Single Post
Old 07-02-2014, 10:37 AM   #856
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,961
Karma: 6361444
Join Date: Nov 2009
Device: many
Hi tkeo,

Quote:
Originally Posted by tkeo View Post
Hi Kevin,
I have books in which idrefs have meaningful names, for example: p-cover, p-titlepage, p-caution, p-copyright.
Indeed they do not improve functionality, but is it not enough for reason to keep them?

Thanks,
I found a public wifi site and saw your post.

They need not be meaningful and most are not. That said, as a compromise, how about the following:

1. since their idrefs must be unique for them simply add a very short prefix to theirs such as "x_" or some other short prefix (this is guaranteed to keep theirs unique). This will also guarantee that their idrefs do not overlap with our itemXXXXX idrefs.

2. Remove all of the "set" code and unique id code and simply replace it all with something similar to the following pseudo code.

Code:
idref_to_use = "item%05s" % refnum
if their_old_idref[refnum]:
    idref_to_use = "x_" + their_old_idref[refnum]
Or something similar to that in meaning.

This guarantees uniqueness, allows you to see the meaningful names but is so simple no block of uniqueness code is needed making the code as simple as possible.

How does that sound?

KevinH

Last edited by KevinH; 07-02-2014 at 10:43 AM.
KevinH is offline   Reply With Quote