Skip to content

Commit

Permalink
Fixes a bug where the index is case sensitive. Fixes #680. Commit rea…
Browse files Browse the repository at this point in the history
…dy for merge.

 - Legacy-Id: 4077
  • Loading branch information
kesara committed Nov 29, 2021
1 parent 7e68cfa commit a894852
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 34 deletions.
2 changes: 1 addition & 1 deletion tests/valid/docfile.py36.html
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ <h3 id="name-iref">
<p id="section-2.31-3">
Index entries generally refer to the exact place where the &lt;iref&gt; element occurred. An exception is the occurrence as a child element of &lt;section&gt;, in which case the whole section is considered to be relevant for that index entry. In some formats, index entries of this type might be displayed as ranges.<a href="#section-2.31-3" class="pilcrow"></a></p>
<p id="section-2.31-4">
When the prep tool is creating index content, it collects the items in a case-sensitive fashion for both the item and subitem level.<a href="#section-2.31-4" class="pilcrow"></a></p>
When the prep tool is creating index content, it collects the items in a case-insensitive fashion for both the item and subitem level.<a href="#section-2.31-4" class="pilcrow"></a></p>
<p id="section-2.31-5">This element can be a child element of &lt;<a href="#element-annotation" class="xref">annotation</a>&gt;, &lt;<a href="#element-aside" class="xref">aside</a>&gt;, &lt;<a href="#element-blockquote" class="xref">blockquote</a>&gt;, &lt;<a href="#element-dd" class="xref">dd</a>&gt;, &lt;<a href="#element-dt" class="xref">dt</a>&gt;, &lt;<a href="#element-em" class="xref">em</a>&gt;, &lt;<a href="#element-figure" class="xref">figure</a>&gt;, &lt;<a href="#element-li" class="xref">li</a>&gt;, &lt;<a href="#element-name" class="xref">name</a>&gt;, &lt;<a href="#element-section" class="xref">section</a>&gt;, &lt;<a href="#element-strong" class="xref">strong</a>&gt;, &lt;<a href="#element-sub" class="xref">sub</a>&gt;, &lt;<a href="#element-sup" class="xref">sup</a>&gt;, &lt;<a href="#element-t" class="xref">t</a>&gt;, &lt;<a href="#element-table" class="xref">table</a>&gt;, &lt;<a href="#element-td" class="xref">td</a>&gt;, &lt;<a href="#element-th" class="xref">th</a>&gt;, &lt;<a href="#element-tt" class="xref">tt</a>&gt;, .<a href="#section-2.31-5" class="pilcrow"></a></p>
<span class="break"></span><dl class="dlParallel" id="section-2.31-6">
<dt id="section-2.31-6.1">Content schema:</dt>
Expand Down
2 changes: 1 addition & 1 deletion tests/valid/docfile.py37.html
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ <h3 id="name-iref">
<p id="section-2.31-3">
Index entries generally refer to the exact place where the &lt;iref&gt; element occurred. An exception is the occurrence as a child element of &lt;section&gt;, in which case the whole section is considered to be relevant for that index entry. In some formats, index entries of this type might be displayed as ranges.<a href="#section-2.31-3" class="pilcrow"></a></p>
<p id="section-2.31-4">
When the prep tool is creating index content, it collects the items in a case-sensitive fashion for both the item and subitem level.<a href="#section-2.31-4" class="pilcrow"></a></p>
When the prep tool is creating index content, it collects the items in a case-insensitive fashion for both the item and subitem level.<a href="#section-2.31-4" class="pilcrow"></a></p>
<p id="section-2.31-5">This element can be a child element of &lt;<a href="#element-annotation" class="xref">annotation</a>&gt;, &lt;<a href="#element-aside" class="xref">aside</a>&gt;, &lt;<a href="#element-blockquote" class="xref">blockquote</a>&gt;, &lt;<a href="#element-dd" class="xref">dd</a>&gt;, &lt;<a href="#element-dt" class="xref">dt</a>&gt;, &lt;<a href="#element-em" class="xref">em</a>&gt;, &lt;<a href="#element-figure" class="xref">figure</a>&gt;, &lt;<a href="#element-li" class="xref">li</a>&gt;, &lt;<a href="#element-name" class="xref">name</a>&gt;, &lt;<a href="#element-section" class="xref">section</a>&gt;, &lt;<a href="#element-strong" class="xref">strong</a>&gt;, &lt;<a href="#element-sub" class="xref">sub</a>&gt;, &lt;<a href="#element-sup" class="xref">sup</a>&gt;, &lt;<a href="#element-t" class="xref">t</a>&gt;, &lt;<a href="#element-table" class="xref">table</a>&gt;, &lt;<a href="#element-td" class="xref">td</a>&gt;, &lt;<a href="#element-th" class="xref">th</a>&gt;, &lt;<a href="#element-tt" class="xref">tt</a>&gt;, .<a href="#section-2.31-5" class="pilcrow"></a></p>
<span class="break"></span><dl class="dlParallel" id="section-2.31-6">
<dt id="section-2.31-6.1">Content schema:</dt>
Expand Down
2 changes: 1 addition & 1 deletion tests/valid/docfile.py38.html
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ <h3 id="name-iref">
<p id="section-2.31-3">
Index entries generally refer to the exact place where the &lt;iref&gt; element occurred. An exception is the occurrence as a child element of &lt;section&gt;, in which case the whole section is considered to be relevant for that index entry. In some formats, index entries of this type might be displayed as ranges.<a href="#section-2.31-3" class="pilcrow"></a></p>
<p id="section-2.31-4">
When the prep tool is creating index content, it collects the items in a case-sensitive fashion for both the item and subitem level.<a href="#section-2.31-4" class="pilcrow"></a></p>
When the prep tool is creating index content, it collects the items in a case-insensitive fashion for both the item and subitem level.<a href="#section-2.31-4" class="pilcrow"></a></p>
<p id="section-2.31-5">This element can be a child element of &lt;<a href="#element-annotation" class="xref">annotation</a>&gt;, &lt;<a href="#element-aside" class="xref">aside</a>&gt;, &lt;<a href="#element-blockquote" class="xref">blockquote</a>&gt;, &lt;<a href="#element-dd" class="xref">dd</a>&gt;, &lt;<a href="#element-dt" class="xref">dt</a>&gt;, &lt;<a href="#element-em" class="xref">em</a>&gt;, &lt;<a href="#element-figure" class="xref">figure</a>&gt;, &lt;<a href="#element-li" class="xref">li</a>&gt;, &lt;<a href="#element-name" class="xref">name</a>&gt;, &lt;<a href="#element-section" class="xref">section</a>&gt;, &lt;<a href="#element-strong" class="xref">strong</a>&gt;, &lt;<a href="#element-sub" class="xref">sub</a>&gt;, &lt;<a href="#element-sup" class="xref">sup</a>&gt;, &lt;<a href="#element-t" class="xref">t</a>&gt;, &lt;<a href="#element-table" class="xref">table</a>&gt;, &lt;<a href="#element-td" class="xref">td</a>&gt;, &lt;<a href="#element-th" class="xref">th</a>&gt;, &lt;<a href="#element-tt" class="xref">tt</a>&gt;, .<a href="#section-2.31-5" class="pilcrow"></a></p>
<span class="break"></span><dl class="dlParallel" id="section-2.31-6">
<dt id="section-2.31-6.1">Content schema:</dt>
Expand Down
12 changes: 6 additions & 6 deletions tests/valid/indexes.pages.text
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@


Network Working Group H. Person, Ed.
Internet-Draft November 22, 2021
Internet-Draft November 29, 2021
Intended status: Experimental
Expires: May 26, 2022
Expires: June 2, 2022


xml2rfc index tests
Expand All @@ -26,7 +26,7 @@ Status of This Memo
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."

This Internet-Draft will expire on May 26, 2022.
This Internet-Draft will expire on June 2, 2022.

Copyright Notice

Expand All @@ -53,7 +53,7 @@ Table of Contents



Person Expires May 26, 2022 [Page 1]
Person Expires June 2, 2022 [Page 1]

Internet-Draft xml2rfc index tests November 2021

Expand Down Expand Up @@ -109,7 +109,7 @@ Index



Person Expires May 26, 2022 [Page 2]
Person Expires June 2, 2022 [Page 2]

Internet-Draft xml2rfc index tests November 2021

Expand Down Expand Up @@ -165,4 +165,4 @@ Author's Address



Person Expires May 26, 2022 [Page 3]
Person Expires June 2, 2022 [Page 3]
6 changes: 3 additions & 3 deletions tests/valid/indexes.prepped.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="exp" docName="indexes-00" indexInclude="true" ipr="trust200902" prepTime="2021-11-22T04:49:42" scripts="Common,Latin" sortRefs="true" submissionType="independent" symRefs="true" tocDepth="3" tocInclude="true">
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="exp" docName="indexes-00" indexInclude="true" ipr="trust200902" prepTime="2021-11-29T05:12:15" scripts="Common,Latin" sortRefs="true" submissionType="independent" symRefs="true" tocDepth="3" tocInclude="true">
<!-- xml2rfc v2v3 conversion 3.11.1 -->


Expand All @@ -20,7 +20,7 @@
</postal>
</address>
</author>
<date day="22" month="11" year="2021"/>
<date day="29" month="11" year="2021"/>
<boilerplate>
<section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
<name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
Expand All @@ -41,7 +41,7 @@
material or to cite them other than as "work in progress."
</t>
<t indent="0" pn="section-boilerplate.1-4">
This Internet-Draft will expire on 26 May 2022.
This Internet-Draft will expire on 2 June 2022.
</t>
</section>
<section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
Expand Down
6 changes: 3 additions & 3 deletions tests/valid/indexes.text
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@


Network Working Group H. Person, Ed.
Internet-Draft November 22, 2021
Internet-Draft November 29, 2021
Intended status: Experimental
Expires: May 26, 2022
Expires: June 2, 2022


xml2rfc index tests
Expand All @@ -26,7 +26,7 @@ Status of This Memo
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."

This Internet-Draft will expire on May 26, 2022.
This Internet-Draft will expire on June 2, 2022.

Copyright Notice

Expand Down
8 changes: 4 additions & 4 deletions tests/valid/indexes.v3.py36.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</tr></thead>
<tfoot><tr>
<td class="left">Person</td>
<td class="center">Expires May 26, 2022</td>
<td class="center">Expires June 2, 2022</td>
<td class="right">[Page]</td>
</tr></tfoot>
</table>
Expand All @@ -36,12 +36,12 @@
<dd class="internet-draft">indexes-00</dd>
<dt class="label-published">Published:</dt>
<dd class="published">
<time datetime="2021-11-22" class="published">November 22, 2021</time>
<time datetime="2021-11-29" class="published">November 29, 2021</time>
</dd>
<dt class="label-intended-status">Intended Status:</dt>
<dd class="intended-status">Experimental</dd>
<dt class="label-expires">Expires:</dt>
<dd class="expires"><time datetime="2022-05-26">May 26, 2022</time></dd>
<dd class="expires"><time datetime="2022-06-02">June 2, 2022</time></dd>
<dt class="label-authors">Author:</dt>
<dd class="authors">
<div class="author">
Expand Down Expand Up @@ -71,7 +71,7 @@ <h2 id="name-status-of-this-memo">
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."<a href="#section-boilerplate.1-3" class="pilcrow"></a></p>
<p id="section-boilerplate.1-4">
This Internet-Draft will expire on May 26, 2022.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
This Internet-Draft will expire on June 2, 2022.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
</section>
</div>
<div id="copyright">
Expand Down
8 changes: 4 additions & 4 deletions tests/valid/indexes.v3.py37.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</tr></thead>
<tfoot><tr>
<td class="left">Person</td>
<td class="center">Expires May 26, 2022</td>
<td class="center">Expires June 2, 2022</td>
<td class="right">[Page]</td>
</tr></tfoot>
</table>
Expand All @@ -36,12 +36,12 @@
<dd class="internet-draft">indexes-00</dd>
<dt class="label-published">Published:</dt>
<dd class="published">
<time datetime="2021-11-22" class="published">November 22, 2021</time>
<time datetime="2021-11-29" class="published">November 29, 2021</time>
</dd>
<dt class="label-intended-status">Intended Status:</dt>
<dd class="intended-status">Experimental</dd>
<dt class="label-expires">Expires:</dt>
<dd class="expires"><time datetime="2022-05-26">May 26, 2022</time></dd>
<dd class="expires"><time datetime="2022-06-02">June 2, 2022</time></dd>
<dt class="label-authors">Author:</dt>
<dd class="authors">
<div class="author">
Expand Down Expand Up @@ -71,7 +71,7 @@ <h2 id="name-status-of-this-memo">
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."<a href="#section-boilerplate.1-3" class="pilcrow"></a></p>
<p id="section-boilerplate.1-4">
This Internet-Draft will expire on May 26, 2022.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
This Internet-Draft will expire on June 2, 2022.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
</section>
</div>
<div id="copyright">
Expand Down
8 changes: 4 additions & 4 deletions tests/valid/indexes.v3.py38.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</tr></thead>
<tfoot><tr>
<td class="left">Person</td>
<td class="center">Expires May 26, 2022</td>
<td class="center">Expires June 2, 2022</td>
<td class="right">[Page]</td>
</tr></tfoot>
</table>
Expand All @@ -36,12 +36,12 @@
<dd class="internet-draft">indexes-00</dd>
<dt class="label-published">Published:</dt>
<dd class="published">
<time datetime="2021-11-22" class="published">November 22, 2021</time>
<time datetime="2021-11-29" class="published">November 29, 2021</time>
</dd>
<dt class="label-intended-status">Intended Status:</dt>
<dd class="intended-status">Experimental</dd>
<dt class="label-expires">Expires:</dt>
<dd class="expires"><time datetime="2022-05-26">May 26, 2022</time></dd>
<dd class="expires"><time datetime="2022-06-02">June 2, 2022</time></dd>
<dt class="label-authors">Author:</dt>
<dd class="authors">
<div class="author">
Expand Down Expand Up @@ -71,7 +71,7 @@ <h2 id="name-status-of-this-memo">
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."<a href="#section-boilerplate.1-3" class="pilcrow"></a></p>
<p id="section-boilerplate.1-4">
This Internet-Draft will expire on May 26, 2022.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
This Internet-Draft will expire on June 2, 2022.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
</section>
</div>
<div id="copyright">
Expand Down
4 changes: 2 additions & 2 deletions tests/valid/manpage.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
xml2rfc(1) xml2rfc(1)
22 November 2021
29 November 2021


Xml2rfc Vocabulary Version 3 Schema
Expand Down Expand Up @@ -898,7 +898,7 @@ Table of Contents
this type might be displayed as ranges.

When the prep tool is creating index content, it collects the items
in a case-sensitive fashion for both the item and subitem level.
in a case-insensitive fashion for both the item and subitem level.

This element can be a child element of <annotation>, <aside>,
<blockquote>, <dd>, <dt>, <em>, <figure>, <li>, <name>, <section>,
Expand Down
5 changes: 1 addition & 4 deletions xml2rfc/templates/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ iref:
this type might be displayed as ranges.

- When the prep tool is creating index content, it collects the items
in a case-sensitive fashion for both the item and subitem level.
in a case-insensitive fashion for both the item and subitem level.

iref[item]:

Expand Down Expand Up @@ -2133,6 +2133,3 @@ Configuration:
- The complete long option names must be used in configuration files;
abbreviations will not be recognised (in contrast with how abbreviations
are handled during command-line option processing).



2 changes: 1 addition & 1 deletion xml2rfc/writers/preptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,7 @@ def letter_li(letter, letter_entries):
dl = self.element('dl', spacing='compact')
li2.append(dl)
# sort entries - py36 does not guarantee order and later versions use LIFO order
for item in sorted(binned_entries):
for item in sorted(binned_entries, key=str.casefold):
regular_entries = []
sub_entries = []
for i in binned_entries[item]:
Expand Down

0 comments on commit a894852

Please sign in to comment.