Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add ID to an element? #154

Open
xfq opened this issue Dec 7, 2019 · 11 comments
Open

How to add ID to an element? #154

xfq opened this issue Dec 7, 2019 · 11 comments
Labels
jlreq-doc:enhancement [JLReq-doc] possible enhancement items on 2nd edition jlreq-doc:future [JLReq-doc] Discussion items to be considered for future version(s) of JLreq document

Comments

@xfq
Copy link
Member

xfq commented Dec 7, 2019

We should probably mention how to add ID to an element in EDITING.md.

For example, if I want to add a new li after id250, what id should I use? There is already an id251 so I shouldn't use it.

/cc @r12a

@himorin
Copy link
Contributor

himorin commented Dec 8, 2019

In my understanding, these ids were assigned by old document generation tool based on xml/sgml used during 1st ed to 2nd ed period, and not fully used (just kept as is) for now.
So, I'd propose just not to assign these ids to new element(s).

@xfq
Copy link
Member Author

xfq commented Dec 8, 2019

Related: #7

@himorin
Copy link
Contributor

himorin commented Dec 9, 2019

(I think I might miss something on respec behavior, while checking various outputs.)
Let me check what we can get, and say something, but mixing automatic assignment (e.g. section, div with special class, by respec) and manual assignment like nX or figX-X by old JLReq compilation tools seems to be harmful for me.

@himorin himorin added jlreq-doc:editorial [JLReq-doc] editorial fixes on JLReq note jlreq-doc:future [JLReq-doc] Discussion items to be considered for future version(s) of JLreq document labels Dec 11, 2019
@r12a
Copy link
Contributor

r12a commented Dec 17, 2019

Here are various thoughts:

  1. let's not change any of the ids currently in the source text, otherwise links will break
  2. we shouldn't rely on any ids produced by respec, since these will change and links will break. We should try to add ids to the source text wherever they are useful for linking.
  3. i proposed a method for adding new ids at Links to each requirement #7 (comment) which i think we should adopt. Basically use the format id="f20191217000" where the first set of digits represents the date per UTC, and the last 3 digits are unique within a day, and are reset to 000 each UTC day. If we are in agreement to adopt that policy, i agree with Fuqiao that we should document it in EDITING.md.
  4. it would be useful if the reader was able to see the ids more easily. I wonder whether we can apply some javascript to display § in the margin, like respec does for headings.

@xfq
Copy link
Member Author

xfq commented Dec 17, 2019

it would be useful if the reader was able to see the ids more easily. I wonder whether we can apply some javascript to display § in the margin, like respec does for headings.

I made a simple demo that might be an inspiration for this feature: https://xfq.github.io/testing/jlreq-li-self-links/#id248

Relevant JavaScript code: https://github.com/xfq/testing/blob/eba3b823556d88ec2ed025a5e819cd5ea669df82/jlreq-li-self-links/script.js#L144-L152

@himorin
Copy link
Contributor

himorin commented Dec 26, 2019

Sorry that I've commented (in the past) with wrong understanding, that the last script block L24579-L24600 is active and some parts are assigned by that...
I agree with points 1 and 2 by Richard, but not sure point 3 could work well by means of uniqueness, like two editors start working on separate PR from the same day. It may require some additional work, but how about to use github issue/PR ID for the first set?

@himorin
Copy link
Contributor

himorin commented Dec 26, 2019

I made a simple demo that might be an inspiration for this feature: https://xfq.github.io/testing/jlreq-li-self-links/#id248

Relevant JavaScript code: https://github.com/xfq/testing/blob/eba3b823556d88ec2ed025a5e819cd5ea669df82/jlreq-li-self-links/script.js#L144-L152

Note, this demo also works with postProcess in respec:
https://himorin.github.io/w3c-memo/tools/samples/respec-basic.html

@xfq
Copy link
Member Author

xfq commented Dec 26, 2019

I agree with points 1 and 2 by Richard, but not sure point 3 could work well by means of uniqueness, like two editors start working on separate PR from the same day. It may require some additional work, but how about to use github issue/PR ID for the first set?

I agree that this is an issue, but this method might not work if:

  1. the commit does not have an associated issue/PR, or
  2. we decide to move from GitHub to another code hosting platform in the future (so the issue number might conflict).

We can solve #1 by requiring every commit (or every commit that adds a new ID) to have an issue/PR associated with it, but I'm not sure how to solve #2.

@himorin
Copy link
Contributor

himorin commented Feb 3, 2020

Running codes on console over current HEAD of jlreq (at github.io) over 'selection li' and 'selection div.note', nothing was listed. So I believe there is no unassigned item made by recent changes.

list_li = document.querySelectorAll('section li');
j = 0; list_li.forEach(function(elem) {if (! elem.id) {console.log(elem); j++}});console.log(j);

So, let me mark this as future, but not a blocker for planned release by #141.

@himorin
Copy link
Contributor

himorin commented Jul 9, 2020

Note: we need to modify EDITING.md also when we settle this in future.

@kidayasuo kidayasuo added jlreq-doc:enhancement [JLReq-doc] possible enhancement items on 2nd edition and removed jlreq-doc:editorial [JLReq-doc] editorial fixes on JLReq note labels Feb 6, 2024
@kidayasuo
Copy link
Contributor

kidayasuo commented Feb 6, 2024

Removed label jlreq-doc:editorial. Added jlreq-doc:enhancement. Will evaluate for jlreq-d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jlreq-doc:enhancement [JLReq-doc] possible enhancement items on 2nd edition jlreq-doc:future [JLReq-doc] Discussion items to be considered for future version(s) of JLreq document
Projects
None yet
Development

No branches or pull requests

4 participants