-
Notifications
You must be signed in to change notification settings - Fork 4
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
xref of bookmarks: https://github.com/metanorma/metanorma-bipm/issues/67 #236
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,5 +136,19 @@ def list_item_anchor_names(list, list_anchor, depth, prev_label, refer_list) | |
end | ||
end | ||
end | ||
|
||
def bookmark_anchor_names(sections) | ||
sections.each do |s| | ||
notes = s.xpath(ns(".//bookmark")) - s.xpath(ns(".//clause//bookmark")) - | ||
s.xpath(ns(".//appendix//bookmark")) | ||
notes.each do |n| | ||
next if n["id"].nil? || n["id"].empty? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add empty line after guard clause. |
||
@anchors[n["id"]] = { | ||
type: "bookmark", label: nil, value: nil, | ||
xref: @anchors[s["id"]][:xref] } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Closing hash brace must be on the line after the last hash element when opening brace is on a separate line from the first hash element. |
||
end | ||
bookmark_anchor_names(s.xpath(ns(CHILD_SECTIONS))) | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2547,6 +2547,151 @@ | |
OUTPUT | ||
end | ||
|
||
it "cross-references bookmarks" do | ||
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use 2 (not 4) spaces for indentation. |
||
<iso-standard xmlns="http://riboseinc.com/isoxml"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use 2 spaces for indentation in a heredoc. |
||
<preface> | ||
<foreword> | ||
<p> | ||
<xref target="N1"/> | ||
<xref target="N2"/> | ||
<xref target="N"/> | ||
<xref target="note1"/> | ||
<xref target="note2"/> | ||
<xref target="AN"/> | ||
<xref target="Anote1"/> | ||
<xref target="Anote2"/> | ||
</p> | ||
</foreword> | ||
<introduction id="intro"> | ||
<p id="N01"> | ||
<bookmark id="N1"/> | ||
</p> | ||
<clause id="xyz"><title>Preparatory</title> | ||
<p id="N02" type="arabic"> | ||
<bookmark id="N2"/> | ||
</p> | ||
</clause> | ||
</introduction> | ||
</preface> | ||
<sections> | ||
<clause id="scope" type="scope"><title>Scope</title> | ||
<p id="N0" type="roman"> | ||
<bookmark id="N"/> | ||
</p> | ||
</clause> | ||
<terms id="terms"/> | ||
<clause id="widgets"><title>Widgets</title> | ||
<clause id="widgets1"> | ||
<p id="note1l" type="alphabet"> | ||
<bookmark id="note1"/> | ||
</p> | ||
<p id="note2l" type="roman_upper"> | ||
<bookmark id="note2"/> | ||
</p> | ||
</clause> | ||
</clause> | ||
</sections> | ||
<annex id="annex1"> | ||
<clause id="annex1a"> | ||
<p id="ANl" type="alphabet_upper"> | ||
<bookmark id="AN"/> | ||
</p> | ||
</clause> | ||
<clause id="annex1b"> | ||
<p id="Anote1l" type="roman" start="4"> | ||
<bookmark id="Anote1"/> | ||
</p> | ||
<p id="Anote2l"> | ||
<bookmark id="Anote2"/> | ||
</p> | ||
</clause> | ||
</annex> | ||
</iso-standard> | ||
INPUT | ||
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use 2 spaces for indentation in a heredoc. |
||
<preface> | ||
<foreword> | ||
<p> | ||
<xref target='N1'>Introduction</xref> | ||
<xref target='N2'>Preparatory</xref> | ||
<xref target='N'>Clause 1</xref> | ||
<xref target='note1'>Clause 3.1</xref> | ||
<xref target='note2'>Clause 3.1</xref> | ||
<xref target='AN'>Annex A.1</xref> | ||
<xref target='Anote1'>Annex A.2</xref> | ||
<xref target='Anote2'>Annex A.2</xref> | ||
</p> | ||
</foreword> | ||
<introduction id='intro'> | ||
<p id='N01'> | ||
<bookmark id='N1'/> | ||
</p> | ||
<clause id='xyz'> | ||
<title depth='2'>Preparatory</title> | ||
<p id='N02' type='arabic'> | ||
<bookmark id='N2'/> | ||
</p> | ||
</clause> | ||
</introduction> | ||
</preface> | ||
<sections> | ||
<clause id='scope' type='scope'> | ||
<title depth='1'> | ||
1. | ||
<tab/> | ||
Scope | ||
</title> | ||
<p id='N0' type='roman'> | ||
<bookmark id='N'/> | ||
</p> | ||
</clause> | ||
<terms id='terms'> | ||
<title>2.</title> | ||
</terms> | ||
<clause id='widgets'> | ||
<title depth='1'> | ||
3. | ||
<tab/> | ||
Widgets | ||
</title> | ||
<clause id='widgets1'> | ||
<title>3.1.</title> | ||
<p id='note1l' type='alphabet'> | ||
<bookmark id='note1'/> | ||
</p> | ||
<p id='note2l' type='roman_upper'> | ||
<bookmark id='note2'/> | ||
</p> | ||
</clause> | ||
</clause> | ||
</sections> | ||
<annex id='annex1'> | ||
<title> | ||
<strong>Annex A</strong> | ||
<br/> | ||
(informative) | ||
</title> | ||
<clause id='annex1a'> | ||
<title>A.1.</title> | ||
<p id='ANl' type='alphabet_upper'> | ||
<bookmark id='AN'/> | ||
</p> | ||
</clause> | ||
<clause id='annex1b'> | ||
<title>A.2.</title> | ||
<p id='Anote1l' type='roman' start='4'> | ||
<bookmark id='Anote1'/> | ||
</p> | ||
<p id='Anote2l'> | ||
<bookmark id='Anote2'/> | ||
</p> | ||
</clause> | ||
</annex> | ||
</iso-standard> | ||
OUTPUT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OUTPUT is not aligned with expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", << |
||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. end at 2693, 0 is not aligned with it "cross-references bookmarks" do at 2550, 2. |
||
|
||
it "realises subsequences" do | ||
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") | ||
<iso-standard xmlns="http://riboseinc.com/isoxml"> | ||
|
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.
Assignment Branch Condition size for bookmark_anchor_names is too high. [21.19/15]
Method has too many lines. [11/10]