Skip to content

Commit 707d21c

Browse files
author
james-ball-qualcomm
authored
Merge pull request #123 from riscv/122-add-path-to-isa-manual-files
122 add path to URL of stds doc to norm-rule JSON output
2 parents 098f02b + d8bcb70 commit 707d21c

File tree

11 files changed

+350
-247
lines changed

11 files changed

+350
-247
lines changed

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ NORM_TAG_FILE_ARGS := $(foreach relative_pname,$(BUILT_NORM_TAGS_MAIN),-t /$(rel
7676
GOOD_NORM_RULE_DEF_ARGS := $(foreach relative_pname,$(GOOD_NORM_RULE_DEF_FILES),-d $(relative_pname))
7777
BAD_NORM_RULE_DEF_ARGS := $(foreach relative_pname,$(BAD_NORM_RULE_DEF_FILES),-d $(relative_pname))
7878

79-
# Provide mapping from an standard's norm tags JSON file to its corresponding HTML file. Used to create links into standard's HTML files.
80-
NORM_RULE_DOC2HTML_ARGS := $(foreach doc_name,$(DOCS),-tag2html /$(BUILD_DIR)/$(doc_name)$(DOC_NORM_TAG_SUFFIX) $(doc_name).html)
79+
# Provide mapping from a stds doc norm tags JSON file to a URL that one can link to. Used to create links into stds doc.
80+
NORM_RULE_DOC2URL_ARGS := $(foreach doc_name,$(DOCS),-tag2url /$(BUILD_DIR)/$(doc_name)$(DOC_NORM_TAG_SUFFIX) $(doc_name).html)
8181

8282
# Docker stuff
8383
DOCKER_BIN ?= docker
@@ -212,29 +212,29 @@ $(BUILT_NORM_RULES_JSON): $(BUILT_NORM_TAGS_MAIN) $(GOOD_NORM_RULE_DEF_FILES)
212212
$(WORKDIR_SETUP)
213213
cp -f $(BUILT_NORM_TAGS_MAIN) $@.workdir
214214
mkdir -p $@.workdir/build
215-
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_NORM_RULE_RUBY) -j $(NORM_TAG_FILE_ARGS) $(GOOD_NORM_RULE_DEF_ARGS) $@ $(DOCKER_QUOTE)
215+
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_NORM_RULE_RUBY) -j $(NORM_TAG_FILE_ARGS) $(GOOD_NORM_RULE_DEF_ARGS) $(NORM_RULE_DOC2URL_ARGS) $@ $(DOCKER_QUOTE)
216216
$(WORKDIR_TEARDOWN)
217217

218218
# Build normative rules with XLSX output format
219219
$(BUILT_NORM_RULES_XLSX): $(BUILT_NORM_TAGS_MAIN) $(GOOD_NORM_RULE_DEF_FILES)
220220
$(WORKDIR_SETUP)
221221
cp -f $(BUILT_NORM_TAGS_MAIN) $@.workdir
222222
mkdir -p $@.workdir/build
223-
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_NORM_RULE_RUBY) -x $(NORM_TAG_FILE_ARGS) $(GOOD_NORM_RULE_DEF_ARGS) $@ $(DOCKER_QUOTE)
223+
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_NORM_RULE_RUBY) -x $(NORM_TAG_FILE_ARGS) $(GOOD_NORM_RULE_DEF_ARGS) $(NORM_RULE_DOC2URL_ARGS) $@ $(DOCKER_QUOTE)
224224
$(WORKDIR_TEARDOWN)
225225

226226
$(BUILT_NORM_RULES_ADOC): $(BUILT_NORM_TAGS_MAIN) $(GOOD_NORM_RULE_DEF_FILES)
227227
$(WORKDIR_SETUP)
228228
cp -f $(BUILT_NORM_TAGS_MAIN) $@.workdir
229229
mkdir -p $@.workdir/build
230-
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_NORM_RULE_RUBY) -a $(NORM_TAG_FILE_ARGS) $(GOOD_NORM_RULE_DEF_ARGS) $(NORM_RULE_DOC2HTML_ARGS) $@ $(DOCKER_QUOTE)
230+
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_NORM_RULE_RUBY) -a $(NORM_TAG_FILE_ARGS) $(GOOD_NORM_RULE_DEF_ARGS) $(NORM_RULE_DOC2URL_ARGS) $@ $(DOCKER_QUOTE)
231231
$(WORKDIR_TEARDOWN)
232232

233233
$(BUILT_NORM_RULES_HTML): $(BUILT_MAIN_TEST_HTML) $(GOOD_NORM_RULE_DEF_FILES)
234234
$(WORKDIR_SETUP)
235235
cp -f $(BUILT_NORM_TAGS_MAIN) $@.workdir
236236
mkdir -p $@.workdir/build
237-
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_NORM_RULE_RUBY) -h $(NORM_TAG_FILE_ARGS) $(GOOD_NORM_RULE_DEF_ARGS) $(NORM_RULE_DOC2HTML_ARGS) $@ $(DOCKER_QUOTE)
237+
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_NORM_RULE_RUBY) -h $(NORM_TAG_FILE_ARGS) $(GOOD_NORM_RULE_DEF_ARGS) $(NORM_RULE_DOC2URL_ARGS) $@ $(DOCKER_QUOTE)
238238
$(WORKDIR_TEARDOWN)
239239

240240
# This is the HTML file that represents the standards doc. THe norm rule HTML links into this HTML.
@@ -250,7 +250,7 @@ $(BUILT_NORM_RULES_TAGS_NO_RULES): $(BUILT_NORM_TAGS_MAIN) $(BAD_NORM_RULE_DEF_F
250250
$(WORKDIR_SETUP)
251251
cp -f $(BUILT_NORM_TAGS_MAIN) $@.workdir
252252
mkdir -p $@.workdir/build
253-
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_NORM_RULE_RUBY) $(NORM_TAG_FILE_ARGS) $(BAD_NORM_RULE_DEF_ARGS) $(BUILD_DIR)/bogus || touch $(BUILT_NORM_RULES_TAGS_NO_RULES) $(DOCKER_QUOTE)
253+
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_NORM_RULE_RUBY) $(NORM_TAG_FILE_ARGS) $(BAD_NORM_RULE_DEF_ARGS) $(NORM_RULE_DOC2URL_ARGS) $(BUILD_DIR)/bogus || touch $(BUILT_NORM_RULES_TAGS_NO_RULES) $(DOCKER_QUOTE)
254254
$(WORKDIR_TEARDOWN)
255255

256256
# Update docker image to latest

normative-rules.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ AsciiDoc provides facilities to create invisible anchors associated with an enti
3838

3939
AsciiDoc supports several styles of anchors:
4040
* _inline anchor_ such as:<br>
41-
`We must [#goal]#free the world#.`
41+
`We must [#goal]#free the world#.`<br>
42+
OR<br>
43+
`This text [#fix]+contains a # symbox+ so use plus to mark beginning & end of anchored text`
44+
4245
* _paragraph anchor_ such as:
4346

4447
> `[[foo]]`<br>
@@ -102,6 +105,7 @@ If you'd like to see detailed AsciiDoc examples of tagging cases, see https://gi
102105
2. Tagging part of a paragraph, table cells, unordered list items (AKA bullet list), or ordered list items (AKA numbered list)
103106

104107
> Syntax: `[#<anchor-name>]# ... #`<br>
108+
> Alternate: `[#<anchor-name>]+ ... +` if tagged text contains a # symbol.<br>
105109
>
106110
> Example:
107111
>> `Here is an example of [#norm:foo]#anchoring part# of a paragraph

schemas/norm-rules-schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,20 @@
5858
"tag_filename": {
5959
"type": "string",
6060
"description": "Tag file that maps tag names to tag text"
61+
},
62+
"stds_doc_url": {
63+
"type": "string",
64+
"description": "URL to standards doc associated with tag_filename"
6165
}
6266
},
6367
"required": ["name"]
6468
}
6569
}
6670
},
6771
"required": ["name", "def_filename"],
72+
"dependencies": {
73+
"tag_filename": ["stds_doc_url"]
74+
},
6875
"additionalProperties": false
6976
}
7077
}

tests/norm-rule/expected/test-norm-rules.adoc

Lines changed: 60 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,64 @@
22

33
== my-chapter_name
44

5-
[cols="20%,20%,60%"]
5+
[cols="20%,60%,20%"]
66
|===
7-
| Rule Name | Text Source | Normative Text
7+
| Rule Name | Rule Description | Description Location
88

99
.4+| inline
10-
| Summary | A few words
11-
| Kind | extension
12-
[Zicsr, ABC]
13-
a| link:test.html#norm:inline[norm:inline] | inside inline
10+
| A few words | Rule Summary
11+
| extension | Rule Kind
12+
| [Zicsr, ABC] | Rule Instances
13+
| inside inline a| link:test.html#norm:inline[norm:inline]
1414

1515
.1+| no_tag
16-
| Summary | Normative rule without tag/tags
16+
| Normative rule without tag/tags | Rule Summary
17+
18+
.1+| inline-with-hash
19+
| includes a hash # symbol. a| link:test.html#norm:inline-with-hash[norm:inline-with-hash]
1720

1821
.2+| paragraph-with-a-really-wide-rule-name
19-
| Description | Here's a description.
22+
| Here's a description.
2023
It's got 2 lines.
21-
a| link:test.html#norm:paragraph:no-inline-anchors[norm:paragraph:no-inline-anchors] | Paragraph without inline anchors
24+
| Rule Description
25+
| Paragraph without inline anchors a| link:test.html#norm:paragraph:no-inline-anchors[norm:paragraph:no-inline-anchors]
2226

2327
.1+| inline-anchors-in-paragraph-entire
24-
a| link:test.html#norm:paragraph:inline-anchors:entire[norm:paragraph:inline-anchors:entire] | Paragraph with inline anchor and something.
28+
| Paragraph with inline anchor and something. a| link:test.html#norm:paragraph:inline-anchors:entire[norm:paragraph:inline-anchors:entire]
2529

2630
.1+| inline-anchors-in-paragraph-inline-anchor
27-
a| link:test.html#norm:paragraph:inline-anchors:inline-anchor[norm:paragraph:inline-anchors:inline-anchor] | inline anchor
31+
| inline anchor a| link:test.html#norm:paragraph:inline-anchors:inline-anchor[norm:paragraph:inline-anchors:inline-anchor]
2832

2933
.1+| formulae
30-
a| link:test.html#norm:formulae[norm:formulae] | This paragraph looks like a formulae to Excel because it has this &lt; sign in it. Make sure this gets written as a string, not a formulae in the XLSX or else it will create an error in Excel.
34+
| This paragraph looks like a formulae to Excel because it has this &lt; sign in it. Make sure this gets written as a string, not a formulae in the XLSX or else it will create an error in Excel. a| link:test.html#norm:formulae[norm:formulae]
3135

3236
.1+| rule_with_newlines
33-
a| link:test.html#norm:paragraph:tag_with_newlines[norm:paragraph:tag_with_newlines] | Here&#8217;s the first line. Here&#8217;s the second line.
37+
| Here&#8217;s the first line. Here&#8217;s the second line. a| link:test.html#norm:paragraph:tag_with_newlines[norm:paragraph:tag_with_newlines]
3438

3539
.1+| double_tags
36-
a| link:test.html#norm:def[norm:def] | This paragraph has two tags but we only ever get a tag for norm:def.
40+
| This paragraph has two tags but we only ever get a tag for norm:def. a| link:test.html#norm:def[norm:def]
3741

3842
.1+| table1
39-
a| link:test.html#norm:table:anchors-in-cells:entire-table[norm:table:anchors-in-cells:entire-table] | ===
43+
| ===
4044
WITH anchor
4145
WITHOUT anchor
42-
===
46+
=== a| link:test.html#norm:table:anchors-in-cells:entire-table[norm:table:anchors-in-cells:entire-table]
4347

4448
.1+| table2
45-
a| link:test.html#norm:table:no-anchors-in-cells:entire-table[norm:table:no-anchors-in-cells:entire-table] | Header 1|Header 2
49+
| Header 1|Header 2
4650
===
4751
Cell in column 1, row 1|Cell in column 2, row 1
4852
Cell in column 1, row 2|Cell in column 2, row 2
49-
===
53+
=== a| link:test.html#norm:table:no-anchors-in-cells:entire-table[norm:table:no-anchors-in-cells:entire-table]
5054

5155
.1+| table3
52-
a| link:test.html#norm:table:anchors-in-cells:entire-table-tagged:cell[norm:table:anchors-in-cells:entire-table-tagged:cell] | WITH anchor
56+
| WITH anchor a| link:test.html#norm:table:anchors-in-cells:entire-table-tagged:cell[norm:table:anchors-in-cells:entire-table-tagged:cell]
5357

5458
.1+| table4
55-
a| link:test.html#norm:table:anchors-in-cells:entire-table-not-tagged:cell[norm:table:anchors-in-cells:entire-table-not-tagged:cell] | ABC DEF
59+
| ABC DEF a| link:test.html#norm:table:anchors-in-cells:entire-table-not-tagged:cell[norm:table:anchors-in-cells:entire-table-not-tagged:cell]
5660

5761
.1+| table5
58-
a| link:test.html#norm:table:many-rows[norm:table:many-rows] | Name|Color
62+
| Name|Color
5963
===
6064
Roses|Red
6165
Violets|Blue
@@ -68,95 +72,95 @@ Name6|Color6
6872
Name7|Color8
6973
Name9|Color9
7074
Name10|Color10
71-
...
75+
... a| link:test.html#norm:table:many-rows[norm:table:many-rows]
7276

7377
.1+| unordered1
74-
a| link:test.html#norm:unordered-list:no-anchors-in-items:entire-list[norm:unordered-list:no-anchors-in-items:entire-list] | Item A
78+
| Item A
7579
Item B
76-
Item C
80+
Item C a| link:test.html#norm:unordered-list:no-anchors-in-items:entire-list[norm:unordered-list:no-anchors-in-items:entire-list]
7781

7882
.1+| unordered2
79-
a| link:test.html#norm:unordered-list:anchors-in-items:entire-list[norm:unordered-list:anchors-in-items:entire-list] | Item 1
83+
| Item 1
8084
Item 2
81-
Item 3
85+
Item 3 a| link:test.html#norm:unordered-list:anchors-in-items:entire-list[norm:unordered-list:anchors-in-items:entire-list]
8286

8387
.1+| unordered3
84-
a| link:test.html#norm:unordered-list:anchors-in-items:item1[norm:unordered-list:anchors-in-items:item1] | Item 1
88+
| Item 1 a| link:test.html#norm:unordered-list:anchors-in-items:item1[norm:unordered-list:anchors-in-items:item1]
8589

8690
.1+| unordered4
87-
a| link:test.html#norm:unordered-list:anchors-in-items:item2[norm:unordered-list:anchors-in-items:item2] | Item 2
91+
| Item 2 a| link:test.html#norm:unordered-list:anchors-in-items:item2[norm:unordered-list:anchors-in-items:item2]
8892

8993
.1+| unordered5
90-
a| link:test.html#norm:unordered-list:multiple-levels[norm:unordered-list:multiple-levels] | Zca and not F
94+
| Zca and not F
9195
Zca, Zcf and F (but not D) is specified (RV32 only)
9296
Zca, Zcf and Zcd if D is specified (RV32 only)
9397

9498
this configuration excludes Zcmp, Zcmt
9599
Zca, Zcd if D is specified (RV64 only)
96100

97-
this configuration excludes Zcmp, Zcmt
101+
this configuration excludes Zcmp, Zcmt a| link:test.html#norm:unordered-list:multiple-levels[norm:unordered-list:multiple-levels]
98102

99103
.1+| ordered1
100-
a| link:test.html#norm:ordered-list:no-anchors-in-items:entire-list[norm:ordered-list:no-anchors-in-items:entire-list] | Item A
104+
| Item A
101105
Item B
102-
Item C
106+
Item C a| link:test.html#norm:ordered-list:no-anchors-in-items:entire-list[norm:ordered-list:no-anchors-in-items:entire-list]
103107

104108
.1+| ordered2
105-
a| link:test.html#norm:ordered-list:anchors-in-items:entire-list[norm:ordered-list:anchors-in-items:entire-list] | Item 1
109+
| Item 1
106110
Item 2
107-
Item 3
111+
Item 3 a| link:test.html#norm:ordered-list:anchors-in-items:entire-list[norm:ordered-list:anchors-in-items:entire-list]
108112

109113
.1+| ordered3
110-
a| link:test.html#norm:ordered-list:anchors-in-items:item1[norm:ordered-list:anchors-in-items:item1] | Item 1
114+
| Item 1 a| link:test.html#norm:ordered-list:anchors-in-items:item1[norm:ordered-list:anchors-in-items:item1]
111115

112116
.1+| ordered4
113-
a| link:test.html#norm:ordered-list:anchors-in-items:item2[norm:ordered-list:anchors-in-items:item2] | Item 2
117+
| Item 2 a| link:test.html#norm:ordered-list:anchors-in-items:item2[norm:ordered-list:anchors-in-items:item2]
114118

115119
.1+| desc1
116-
a| link:test.html#norm:description-list:no-anchors-in-items:entire-list[norm:description-list:no-anchors-in-items:entire-list] | Description-A
120+
| Description-A
117121
Item A
118122
Description-B
119123
Item B
120124
Description-C
121-
Item C
125+
Item C a| link:test.html#norm:description-list:no-anchors-in-items:entire-list[norm:description-list:no-anchors-in-items:entire-list]
122126

123127
.1+| desc2
124-
a| link:test.html#norm:description-list:anchors-in-items:entire-list[norm:description-list:anchors-in-items:entire-list] | Description-1
128+
| Description-1 a| link:test.html#norm:description-list:anchors-in-items:entire-list[norm:description-list:anchors-in-items:entire-list]
125129

126130
.2+| desc3
127-
a| link:test.html#norm:description-list:anchors-in-items:item1[norm:description-list:anchors-in-items:item1] | Item 1
128-
a| link:test.html#norm:description-list:anchors-in-items:item3[norm:description-list:anchors-in-items:item3] | Item 3
131+
| Item 1 a| link:test.html#norm:description-list:anchors-in-items:item1[norm:description-list:anchors-in-items:item1]
132+
| Item 3 a| link:test.html#norm:description-list:anchors-in-items:item3[norm:description-list:anchors-in-items:item3]
129133

130134
.2+| desc4
131-
a| link:test.html#norm:description-list:anchors-in-items:item1[norm:description-list:anchors-in-items:item1] | Item 1
132-
a| link:test.html#norm:description-list:anchors-in-items:item3[norm:description-list:anchors-in-items:item3] | Item 3
135+
| Item 1 a| link:test.html#norm:description-list:anchors-in-items:item1[norm:description-list:anchors-in-items:item1]
136+
| Item 3 a| link:test.html#norm:description-list:anchors-in-items:item3[norm:description-list:anchors-in-items:item3]
133137

134138
.1+| admon1
135-
a| link:test.html#norm:admonition:single-paragraph-note[norm:admonition:single-paragraph-note] | Single paragraph note
136-
that spans lines.
139+
| Single paragraph note
140+
that spans lines. a| link:test.html#norm:admonition:single-paragraph-note[norm:admonition:single-paragraph-note]
137141

138142
.1+| admon2
139-
a| link:test.html#norm:admonition:no-anchors-in-notes:entire-note[norm:admonition:no-anchors-in-notes:entire-note] | Paragraph A
143+
| Paragraph A
140144

141145
Paragraph B
142146

143-
Paragraph C
147+
Paragraph C a| link:test.html#norm:admonition:no-anchors-in-notes:entire-note[norm:admonition:no-anchors-in-notes:entire-note]
144148

145149
.1+| admon3
146-
a| link:test.html#norm:admonition:anchors-in-notes:entire-note[norm:admonition:anchors-in-notes:entire-note] | Paragraph 1
150+
| Paragraph 1
147151

148152
Paragraph 2
149153

150-
Paragraph 3
154+
Paragraph 3 a| link:test.html#norm:admonition:anchors-in-notes:entire-note[norm:admonition:anchors-in-notes:entire-note]
151155

152156
.2+| admon4
153-
a| link:test.html#norm:admonition:only-anchors-in-notes:note1[norm:admonition:only-anchors-in-notes:note1] | Paragraph X
154-
a| link:test.html#norm:admonition:only-anchors-in-notes:note3[norm:admonition:only-anchors-in-notes:note3] | Paragraph Z
157+
| Paragraph X a| link:test.html#norm:admonition:only-anchors-in-notes:note1[norm:admonition:only-anchors-in-notes:note1]
158+
| Paragraph Z a| link:test.html#norm:admonition:only-anchors-in-notes:note3[norm:admonition:only-anchors-in-notes:note3]
155159

156160
.5+| admon5
157-
| Description | One line description
158-
| Kind | parameter
159-
[MY_PARAMETER]
160-
a| link:test.html#norm:admonition:anchors-in-notes:note1[norm:admonition:anchors-in-notes:note1] | Paragraph 1
161-
a| link:test.html#norm:admonition:anchors-in-notes:note3[norm:admonition:anchors-in-notes:note3] | Paragraph 3
161+
| One line description | Rule Description
162+
| parameter | Rule Kind
163+
| [MY_PARAMETER] | Rule Instances
164+
| Paragraph 1 a| link:test.html#norm:admonition:anchors-in-notes:note1[norm:admonition:anchors-in-notes:note1]
165+
| Paragraph 3 a| link:test.html#norm:admonition:anchors-in-notes:note3[norm:admonition:anchors-in-notes:note3]
162166
|===

0 commit comments

Comments
 (0)