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

Hide references with hidden bibitems even if they also have a title: … #562

Merged
merged 3 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/isodoc/presentation_function/math.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def twitter_cldr_localiser

def parse_localize_number
@localizenumber or return {}
m = %r{(?<group>[^#])?(?<groupdigits>#+0)(?<decimal>.)(?<fractdigits>#+)(?<fractgroup>[^#])?}
m = %r{(?<grp>[^#])?(?<grpdig>#+0)(?<decpt>.)(?<frdig>#+)(?<frgrp>[^#])?}
.match(@localizenumber) or return {}
ret = { decimal: m[:decimal], group_digits: m[:groupdigits].size,
fraction_group_digits: m[:fractdigits].size,
group: m[:group] || "",
fraction_group: m[:fractgroup] || "" }.compact
ret = { decimal: m[:decpt], group_digits: m[:grpdig].size,
fraction_group_digits: m[:frdig].size,
group: m[:grp] || "",
fraction_group: m[:frgrp] || "" }.compact
%i(group fraction_group).each { |x| ret[x] == " " and ret[x] = "\u00A0" }
ret
end
Expand Down
4 changes: 3 additions & 1 deletion lib/isodoc/presentation_function/refs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def move_norm_ref_to_sections(docxml)
def hidden_items(docxml)
docxml.xpath(ns("//references[bibitem/@hidden = 'true']")).each do |x|
x.at(ns("./bibitem[not(@hidden = 'true')]")) and next
x.elements.map(&:name).any? { |n| n != "bibitem" } and next
x.elements.map(&:name).any? do |n|
!%w(title bibitem).include?(n)
Copy link

Choose a reason for hiding this comment

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

Avoid immutable Array literals in loops. It is better to extract it into a local variable or a constant.

end and next
x["hidden"] = "true"
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/isodoc/ref_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@
<iso-standard xmlns='http://riboseinc.com/isoxml'>
<bibliography>
<references>
<title>Title</title>
<bibitem hidden="true"/>
<bibitem hidden="true"/>
<bibitem hidden="true"/>
Expand All @@ -533,6 +534,7 @@
<preface> <clause type="toc" id="_" displayorder="1"> <title depth="1">Table of contents</title> </clause> </preface>
<bibliography>
<references hidden='true'>
<title depth="1">Title</title>
<bibitem hidden='true'/>
<bibitem hidden='true'/>
<bibitem hidden='true'/>
Expand Down
Loading