Skip to content
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

preserve Semantic XML in bibitem: https://github.com/metanorma/isodoc… #624

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

opoudjis
Copy link
Contributor

/issues/610

Metanorma PR checklist

@opoudjis opoudjis self-assigned this Feb 19, 2025
@@ -600,15 +648,15 @@
</itu-standard>
INPUT
presxml = <<~OUTPUT
<itu-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
<itu-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in a heredoc.

out.previous = ret
end

def title_footnotes(isoxml)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.

out.previous = ret
end

def middle_title_recommendation(isoxml, out)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.
Assignment Branch Condition size for middle_title_recommendation is too high. [<11, 16, 5> 20.05/15]
Method has too many lines. [11/10]

middle_title_resolution_subtitle(isoxml, out)
end

def middle_title_resolution_subtitle(isoxml, out)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.

end
end

def middle_title_resolution(isoxml, out)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.

end

# KILL
def renumber_footnotesx(isoxml)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.


def annex1_resolution(elem)
elem.elements.first.previous = annex1_supertitle(elem)
# TODO: do not alter title, alter semx/@element = title
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation detected (column 9 instead of 8).

end
end

def annex1_resolution(elem)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.

!%w(sections bibliography).include?(elem.parent.name)
end

def annex1(elem)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.

#"<span element='fmt-element-name'>#{@i18n.get['section'].upcase}</span> #{autonum(elem['id'], lbl)}</p>"
end

def clause1_super?(elem)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.

"<p keep-with-next='true' class='supertitle'>" \
"#{labelled_autonum(@i18n.get['section'].upcase, elem["id"], lbl)}</p>"
#"<span element='fmt-element-name'>#{@i18n.get['section'].upcase}</span> #{autonum(elem['id'], lbl)}</p>"
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end at 16, 6 is not aligned with def at 4, 12.

elem.previous =
"<p keep-with-next='true' class='supertitle'>" \
"#{labelled_autonum(@i18n.get['section'].upcase, elem["id"], lbl)}</p>"
#"<span element='fmt-element-name'>#{@i18n.get['section'].upcase}</span> #{autonum(elem['id'], lbl)}</p>"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation detected (column 10 instead of 8).
Missing space after #.
Line is too long. [115/80]

lbl.blank? || elem["unnumbered"] and return
elem.previous =
"<p keep-with-next='true' class='supertitle'>" \
"#{labelled_autonum(@i18n.get['section'].upcase, elem["id"], lbl)}</p>"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings inside interpolations.
Line is too long. [81/80]

module Itu
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
def clause1(elem)
clause1_super?(elem) and return super
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 (not -4) spaces for indentation.

module IsoDoc
module Itu
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
def clause1(elem)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 (not 8) spaces for indentation.

"<sup>#{fn_label(fnote)}" \
"<span class='fmt-label-delim'>)</span></sup>"
end
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end at 119, 6 is not aligned with def at 111, 7.

.gsub(%r{^.*<body}m, "<body")
.gsub(%r{</body>.*}m, "</body>")
.gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
.to be_equivalent_to Xml::C14n.format(word)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 (not 1) spaces for indenting an expression spanning multiple lines.

expect(Xml::C14n.format(strip_guid(IsoDoc::Itu::HtmlConvert.new({})
.convert("test", pres_output, true))))
.to be_equivalent_to Xml::C14n.format(html)
expect(Xml::C14n.format(strip_guid(IsoDoc::Itu::WordConvert.new({})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.

expect(Xml::C14n.format(IsoDoc::Itu::WordConvert.new({})

word = <<~OUTPUT
<body lang="EN-US" link="blue" vlink="#954F72">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in a heredoc.

</iso-standard>
OUTPUT
html = <<~OUTPUT
<html lang="en">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in a heredoc.

</tfoot>
</table>
OUTPUT
.to be_equivalent_to Xml::C14n.format(output)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 (not 0) spaces for indenting an expression spanning multiple lines.

</tfoot>
</table>
OUTPUT
expect(Xml::C14n.format(html
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.

</tr>
</tfoot>
</table>
OUTPUT
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OUTPUT is not aligned with output = <<~OUTPUT.


FileUtils.rm_f "test.doc"
IsoDoc::Itu::WordConvert.new({}).convert("test", pres_output, false)
expect(File.exist?("test.doc")).to be true
html = File.read("test.doc", encoding: "UTF-8")
expect(Xml::C14n.format(html
output = <<~OUTPUT
<table class="MsoISOTable" style="mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;" title="tool tip" summary="long desc">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in a heredoc.

<a href="#fnref:5">↩</a>
</aside>
</main>
OUTPUT
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OUTPUT is not aligned with output = <<~OUTPUT.

@@ -575,188 +698,180 @@
IsoDoc::Itu::HtmlConvert.new({}).convert("test", pres_output, false)
expect(File.exist?("test.html")).to be true
html = File.read("test.html", encoding: "UTF-8")
output = <<~OUTPUT
<main xmlns:epub="epub" class="main-section">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in a heredoc.

@@ -468,7 +474,7 @@
</itu-standard>
INPUT
presxml = <<~PRESXML
<itu-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
<itu-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in a heredoc.

<p class="TableFootnote"><a name="_8a4ff03f-e7a6-4430-939d-1b7b0ffa60e9" id="_8a4ff03f-e7a6-4430-939d-1b7b0ffa60e9"></a><span><span class="TableFootnoteRef"><a name="_5c4d4e85-b6b0-4f34-b1ed-57d28c4e88d4a)" id="_5c4d4e85-b6b0-4f34-b1ed-57d28c4e88d4a)"></a>a)</span><span style="mso-tab-count:1">&#xA0; </span></span>To access the Recommendation, type the URL <a href="http://handle.itu.int/" class="url">http://handle.itu.int/</a> in the address field of your web browser, followed by the Recommendation?~@~Ys unique ID. For example, <a href="http://handle.itu.int/11.1002/1000/11830-en" class="url">http://handle.itu.int/11.1002/1000/11830-en</a></p>
</div></div></td></tr></tfoot></table>
</div></div>
<div>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in a heredoc.

opoudjis and others added 5 commits February 28, 2025 20:48
…ing or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
<p>Normal footnote</p>
</aside>
</div>
<body xmlns:epub="epub" lang="EN-US" link="blue" vlink="#954F72">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in a heredoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant