Skip to content

Commit

Permalink
fix: Make long sourcecode sections breakable (#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
kesara authored May 2, 2022
1 parent 0884e8d commit 9e12093
Show file tree
Hide file tree
Showing 20 changed files with 1,687 additions and 29 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pyfiles = $(wildcard xml2rfc/*.py) $(wildcard xml2rfc/writers/*.py)
tests: minify tests-no-network cachetest

# Tests that can run without network access
tests-no-network: test flaketest drafttest rfctest utf8test v3featuretest elementstest indextest bomtest wiptest mantest
tests-no-network: test flaketest drafttest rfctest utf8test v3featuretest elementstest indextest sourcecodetest bomtest wiptest mantest

# Clear the cache
.PHONY: clear-cache
Expand Down Expand Up @@ -255,6 +255,8 @@ elementstest: install tests/out/elements.prepped.xml.test tests/out/elements.tex

indextest: install tests/out/indexes.prepped.xml.test tests/out/indexes.text.test tests/out/indexes.pages.text.test tests/out/indexes.v3.$(py).html.test

sourcecodetest: install tests/out/sourcecode.prepped.xml.test tests/out/sourcecode.text.test tests/out/sourcecode.pages.text.test tests/out/sourcecode.v3.$(py).html.test

bomtest: tests/out/elements.bom.text.test

wiptest: tests/out/elements.wip.text.test
Expand Down
146 changes: 146 additions & 0 deletions tests/input/sourcecode.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version='1.0'?>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc-ext include-references-in-index="yes" ?>
<?rfc-ext paragraph-links='yes'?>
<rfc sortRefs="true" category="exp" submissionType="independent" ipr="trust200902" docName="sourcecode-00">
<?v3xml2rfc silence="Unused reference: There seems to be no reference to .*" ?>
<?v3xml2rfc silence="The 'docName' attribute of the .rfc/. element should have a revision number" ?>
<?v3xml2rfc silence='Did not find a recognized country entry' ?>
<?v3xml2rfc silence="Postal address" ?>
<?v3xml2rfc silence="Recognized postal address elements" ?>
<?v3xml2rfc silence="The document date (.*) is more than 3 days away from today's date" ?>
<?v3xml2rfc silence="Found SVG with width or height specified" ?>
<front>
<title>xml2rfc sourcecode tests</title>
<author fullname="Human Person" initials="H" surname="Person" role="editor">
<address>
<postal>
<postalLine>line 1</postalLine>
<postalLine>line 2</postalLine>
<postalLine>line 3</postalLine>
</postal>
</address>
</author>
</front>
<middle>
<section>
<name>Less than 50 lines</name>
<sourcecode name="49lines.py">print("01")
print("02")
print("03")
print("04")
print("05")
print("06")
print("07")
print("08")
print("09")
print("10")
print("11")
print("12")
print("13")
print("14")
print("15")
print("16")
print("17")
print("18")
print("19")
print("20")
print("21")
print("22")
print("23")
print("24")
print("25")
print("26")
print("27")
print("28")
print("29")
print("30")
print("31")
print("32")
print("33")
print("34")
print("35")
print("36")
print("37")
print("38")
print("39")
print("40")
print("41")
print("42")
print("43")
print("44")
print("45")
print("46")
print("47")
print("48")
print("49")
</sourcecode>
<sourcecode name="50lines.py">print("01")
print("02")
print("03")
print("04")
print("05")
print("06")
print("07")
print("08")
print("09")
print("10")
print("11")
print("12")
print("13")
print("14")
print("15")
print("16")
print("17")
print("18")
print("19")
print("20")
print("21")
print("22")
print("23")
print("24")
print("25")
print("26")
print("27")
print("28")
print("29")
print("30")
print("31")
print("32")
print("33")
print("34")
print("35")
print("36")
print("37")
print("38")
print("39")
print("40")
print("41")
print("42")
print("43")
print("44")
print("45")
print("46")
print("47")
print("48")
print("49")
print("50")
</sourcecode>
</section>
</middle>
<back>
<references>
<name>References</name>
<reference anchor="ref0">
<front>
<title>Reference</title>
<author fullname="Reference Q. Author"/>
</front>
<annotation>
<iref item="annotation"/>
This is a reference not in a reference group.
</annotation>
</reference>
</references>
</back>
</rfc>
2 changes: 1 addition & 1 deletion tests/valid/docfile.py36.html
Original file line number Diff line number Diff line change
Expand Up @@ -4311,7 +4311,7 @@ <h2 id="name-relax-ng-schema">
<a href="#appendix-A" class="section-number selfRef">Appendix A. </a><a href="#name-relax-ng-schema" class="section-name selfRef">RELAX NG Schema</a>
</h2>
<div id="appendix-A-1">
<pre class="lang-relax-ng-compact sourcecode">&lt;CODE BEGINS&gt; file "v3.rnc"
<pre class="breakable lang-relax-ng-compact sourcecode">&lt;CODE BEGINS&gt; file "v3.rnc"


namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
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 @@ -4311,7 +4311,7 @@ <h2 id="name-relax-ng-schema">
<a href="#appendix-A" class="section-number selfRef">Appendix A. </a><a href="#name-relax-ng-schema" class="section-name selfRef">RELAX NG Schema</a>
</h2>
<div id="appendix-A-1">
<pre class="lang-relax-ng-compact sourcecode">&lt;CODE BEGINS&gt; file "v3.rnc"
<pre class="breakable lang-relax-ng-compact sourcecode">&lt;CODE BEGINS&gt; file "v3.rnc"


namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
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 @@ -4311,7 +4311,7 @@ <h2 id="name-relax-ng-schema">
<a href="#appendix-A" class="section-number selfRef">Appendix A. </a><a href="#name-relax-ng-schema" class="section-name selfRef">RELAX NG Schema</a>
</h2>
<div id="appendix-A-1">
<pre class="lang-relax-ng-compact sourcecode">&lt;CODE BEGINS&gt; file "v3.rnc"
<pre class="breakable lang-relax-ng-compact sourcecode">&lt;CODE BEGINS&gt; file "v3.rnc"


namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
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 April 26, 2022
Internet-Draft April 27, 2022
Intended status: Experimental
Expires: October 28, 2022
Expires: October 29, 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 October 28, 2022.
This Internet-Draft will expire on October 29, 2022.

Copyright Notice

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



Person Expires October 28, 2022 [Page 1]
Person Expires October 29, 2022 [Page 1]

Internet-Draft xml2rfc index tests April 2022

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



Person Expires October 28, 2022 [Page 2]
Person Expires October 29, 2022 [Page 2]

Internet-Draft xml2rfc index tests April 2022

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



Person Expires October 28, 2022 [Page 3]
Person Expires October 29, 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="2022-04-26T03:47:36" 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="2022-04-27T02:26:36" scripts="Common,Latin" sortRefs="true" submissionType="independent" symRefs="true" tocDepth="3" tocInclude="true">
<!-- xml2rfc v2v3 conversion 3.12.4 -->


Expand All @@ -20,7 +20,7 @@
</postal>
</address>
</author>
<date day="26" month="04" year="2022"/>
<date day="27" month="04" year="2022"/>
<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 28 October 2022.
This Internet-Draft will expire on 29 October 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 April 26, 2022
Internet-Draft April 27, 2022
Intended status: Experimental
Expires: October 28, 2022
Expires: October 29, 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 October 28, 2022.
This Internet-Draft will expire on October 29, 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 October 28, 2022</td>
<td class="center">Expires October 29, 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="2022-04-26" class="published">April 26, 2022</time>
<time datetime="2022-04-27" class="published">April 27, 2022</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-10-28">October 28, 2022</time></dd>
<dd class="expires"><time datetime="2022-10-29">October 29, 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 October 28, 2022.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
This Internet-Draft will expire on October 29, 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 October 28, 2022</td>
<td class="center">Expires October 29, 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="2022-04-26" class="published">April 26, 2022</time>
<time datetime="2022-04-27" class="published">April 27, 2022</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-10-28">October 28, 2022</time></dd>
<dd class="expires"><time datetime="2022-10-29">October 29, 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 October 28, 2022.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
This Internet-Draft will expire on October 29, 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 October 28, 2022</td>
<td class="center">Expires October 29, 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="2022-04-26" class="published">April 26, 2022</time>
<time datetime="2022-04-27" class="published">April 27, 2022</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-10-28">October 28, 2022</time></dd>
<dd class="expires"><time datetime="2022-10-29">October 29, 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 October 28, 2022.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
This Internet-Draft will expire on October 29, 2022.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
</section>
</div>
<div id="copyright">
Expand Down
2 changes: 1 addition & 1 deletion tests/valid/manpage.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
xml2rfc(1) xml2rfc(1)
26 April 2022
27 April 2022


Xml2rfc Vocabulary Version 3 Schema
Expand Down
Loading

0 comments on commit 9e12093

Please sign in to comment.