RunestoneInteractive / thinkcspy

How to Think Like a Computer Scientist, Interactive Edition
https://runestone.academy/ns/books/published/thinkcspy/index.html
Other
108 stars 191 forks source link

Unique ID issues #247

Open knakaj opened 2 years ago

knakaj commented 2 years ago

What Course are you in thinkcspy

Describe the bug When running pretext build web, a lot of @xml:id values in different sections are not unique.

Screen Shot 2022-07-08 at 3 16 18 PM
bnmnetp commented 2 years ago

Yes, it looks like many of them are id1. Further it looks like whatever is generating these ids is creating them without knowing about any of the other files. within a file it looks like we have id1, id2, id3 etc but we may have multiple id1s in several files.

I have an idea...

In the fixIds.py script we can

  1. Create a counter variable at the top of the inner loop. (so we are essentially counting files)
  2. then we can look for xml:id="id1" , xml:id="id2", etc, etc, in each file and make them look like: f"xml:id="{counter}_id1"

that should make them all unique. We should not worry about this too much as I don't think any of these are actually referenced. But it will clear out all of the error messages about duplicate ids