-
Notifications
You must be signed in to change notification settings - Fork 722
Add basic support for tagging text in the spec #1769
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
base: main
Are you sure you want to change the base?
Conversation
df82d4a
to
9beeadb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this tags.rb work for all adoc anchor types:
- This is before the parameter definition. [#param-foo-1]#Here's a parameter defined using inline anchors.# This is after the parameter definition.
- [#param-foo-2]
Here's a parameter defined in its own block using the # ID syntax. - [[param-foo-3]]
Here's a parameter defined using an anchor.
This adds three things: 1. Custom CSS to add a subtle dotted underline on hover to any element with an ID starting with `manual__`. 2. An example tag `manual__x0_is_zero`, tagging the text that specifies that x0 is hardwired to 0. 3. A way of extracting the text of the tags into JSON. This just adds a single tag as an exmaple, but the intention is that such tags would be added throughout the spec, allowing coverage, test plans, tests, documentation, etc. to all link to specific parts of the spec.
This came up again in the Sail meeting. Can we get some progress towards merging this? Or at least a decision like "if this has tags for a significant part of the base chapters etc. then it can be merged"?
Yeah I believe so, or we can make it work if it doesn't. |
Last week without remembering this PR, I created a Ruby script to extract all normative rule anchors and their associated text from the ISA manuals into a YAML file. It does this by using a CSS selector to find anchors in the ISA manual HTML files. I see Tim has instead created a new adoc backend in docs-resources/converters/tags.rb to do something similar but into JSON. Let me take a look at this approach. My Ruby script relies on my naming convention which is documented in a UDB file at the moment. This is just a temporary home and so I've copied the documentation below. You'll see my naming convention is that anything anchor that starts with "norm:" is used by ISA manual normative rules that we are creating in the CSC (and will review with TSC). I have another Ruby script that performs an intelligent compare between the normative rule anchors in a workspace and a reference. I'd integrate both of these Ruby scripts into the ISA manual Makefile and then we could have github actions that complain if you try to remove or edit the text in a normative rule anchor. Others potentially interested in this PR:
|
At first blush, Tim's approach of using a new adoc backend looks better than my approach of parsing the HTML. I tried using the Ruby adoc API load_file() function but discovered the inline anchors aren't expanded until a backend so switched to the HTML approach. Tim, does your adoc backend approach handle all the cases listed in my naming scheme? That would be paragraph anchors, inline anchors, anchors to table cells, and anchors to text inside admonitions? Also, I'll need the section number that the anchor is located in. I don't currently support that yet in my anchor extraction Ruby script but was about to add it. Tim, can you support that with your adoc backend? |
Yeah I also started by parsing the docbook XML output, but decided it would be better to do it properly via an Asciidoctor backend. It's definitely better.
Yes these all work, though note that for table cells this doesn't quite work:
This actually tags an empty paragraph at the start of the cell for some reason. However using I pushed a commit that demonstrates all of these things.
Yeah I was also thinking this would be really useful. My plan was to add a section hierarchy to the JSON listing all the tags in each section like this:
This allows you to present the tags more nicely, and obviates some of the reasons for putting a ton of grouping metadata in the tags. I don't think people are going to want to use this if they have to write tags like Does that |
I've confirmed that inline anchors in table cells work fine. Then you get a span containing the cell contents instead of no contents which seems better. Don't know why I thought inline anchors didn't work well in table cells. |
I think I'll setup a meeting to discuss this live. |
This adds three things:
manual__
.manual__x0_is_zero
, tagging the text that specifies that x0 is hardwired to 0.This just adds a single tag as an example, but the intention is that such tags would be added throughout the spec, allowing coverage, test plans, tests, documentation, etc. to all link to specific parts of the spec.
See #1397