Skip to content

Commit

Permalink
IEEE sponsor: #150
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Feb 26, 2024
1 parent 77cef4b commit 4121e63
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
27 changes: 16 additions & 11 deletions lib/isodoc/ieee/presentation_bibdata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,30 @@ def sponsored_attrib(bibdata)
end

def sponsors_extract(bibdata)
bibdata.xpath(ns("./contributor[role/@type = 'enabler']/organization"))
.each_with_object([]) do |o, m|
ret = sponsor_extract(o).reverse
if ret.size > 1 && ["IEEE", "Institute of Electrical and Electronic Engineers"].include?(ret[-1])
ret.pop
ret[-1] = "IEEE #{ret[-1]}"
end
m << ret
o = bibdata.xpath(ns("./contributor[role/@type = 'enabler']/organization"))
sponsor_extract(o).map do |x|
if x.size > 1 && ["IEEE",
"Institute of Electrical and Electronic Engineers"]
.include?(x[-1])
x.pop
x[-1] = "IEEE #{x[-1]}"
end
x
end
end

def sponsor_name(sponsor)
sponsor.map { |x| "<strong>#{x}</strong>" }.join("<br/>of the<br/>")
end

def sponsor_extract(org)
org.nil? and return []
[org.at(ns("./name")).children.to_xml] +
sponsor_extract(org.at(ns("./subdivision")))
org.empty? and return [[]]
org.each_with_object([]) do |o, m|
head = o.at(ns("./name")).children.to_xml
sponsor_extract(o.xpath(ns("./subdivision"))).each do |tail|
m << tail.dup.push(head)
end
end
end
end
end
Expand Down
9 changes: 8 additions & 1 deletion spec/isodoc/metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@
<name>Standards Committee</name>
</subdivision>
</subdivision>
<subdivision>
<name>Power &amp; Energy Society</name>
<subdivision>
<name>Power Committee</name>
</subdivision>
</subdivision>
</organization>
</contributor>
<contributor>
Expand Down Expand Up @@ -343,7 +349,8 @@
presxml = <<~OUTPUT
<ext><doctype>recommended-practice</doctype><subdoctype>amendment</subdoctype><trial-use>true</trial-use><editorialgroup><society>Society</society><balloting-group type="entity">BG</balloting-group><working-group>WG</working-group><committee>Tech Committee</committee></editorialgroup><structuredidentifier><docnumber>1000</docnumber><agency>IEEE</agency><class>recommended-practice</class><edition>2</edition><version>0.3.4</version><amendment>A1</amendment><corrigendum>C1</corrigendum><year>2000</year></structuredidentifier><program>HIJ</program>
<developed-attribution>Developed by the<br/><strong>Tech Committee</strong><br/>of the<br/>IEEE <strong>Society</strong></developed-attribution>
<sponsored-attribution>Sponsored by the<br/><strong>Standards Committee</strong><br/>of the<br/><strong>IEEE Communications Society</strong><br/>and the<br/><strong>Standards Committee</strong><br/>of the<br/><strong>Communications Society</strong><br/>of the<br/><strong>Inetrnational Standardization Organization</strong></sponsored-attribution></ext>
<sponsored-attribution>Sponsored by the<br/><strong>Standards Committee</strong><br/>of the<br/><strong>IEEE Communications Society</strong><br/>and the<br/><strong>Power Committee</strong><br/>of the<br/><strong>IEEE Power &amp; Energy Society</strong><br/>and the<br/><strong>Standards Committee</strong><br/>of the<br/><strong>Communications Society</strong><br/>of the<br/><strong>Inetrnational Standardization Organization</strong></sponsored-attribution>
</ext>
OUTPUT
xml = IsoDoc::IEEE::PresentationXMLConvert
.new(presxml_options)
Expand Down

0 comments on commit 4121e63

Please sign in to comment.