Skip to content

Commit

Permalink
OMP 3.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
withanage committed Jul 19, 2019
1 parent 7a84aa4 commit 87f392b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugins/import/omp/omp.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,10 @@ def inject_chapter_metadata(self, bits_xml, chapter, chapter_settings, submissio
# TODO How to distinguish other types?
book_part_xml.set('book-part-type', 'chapter')
book_part_meta_xml = book_part_xml.xpath('book-part-meta')[0]
book_part_meta_xml.xpath('title-group/title')[0].text = chapter_settings.getLocalizedValue(
'title', submission.locale)
book_part_meta_xml.xpath('title-group/title')[0].text = chapter_settings.getLocalizedValue('title', submission.locale)
book_part_meta_xml.xpath('title-group/subtitle')[0].text = chapter_settings.getLocalizedValue('subtitle', submission.locale)
book_part_meta_xml.xpath('pub-date/day')[0].text = chapter_settings.getLocalizedValue('datePublished', submission.locale)
book_part_meta_xml.xpath('abstract')[0].text = chapter_settings.getLocalizedValue('abstract', submission.locale)
contrib_group_xml = book_part_meta_xml.xpath('contrib-group')[0]
for contrib in self.dal.getAuthorsByChapter(chapter.chapter_id):
contrib_group_xml.append(self.build_contrib_xml(contrib, contrib_group_xml, submission.locale))
Expand All @@ -509,6 +511,8 @@ def inject_chapter_metadata(self, bits_xml, chapter, chapter_settings, submissio
custom_meta_xml = etree.SubElement(custom_meta_group_xml, 'custom-meta', {'specific-use': meta_name})
etree.SubElement(custom_meta_xml, 'meta-name').text = meta_name
etree.SubElement(custom_meta_xml, 'meta-value').text = meta_value
a1 = etree.tostring(bits_xml)

return bits_xml

def read_chapter_metadata(self, metadata_file_path):
Expand Down
7 changes: 7 additions & 0 deletions plugins/import/omp/templates/sample-chapter.bits2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
<book-part-meta>
<title-group>
<title>Remerciments</title>
<subtitle>Remerciments</subtitle>
</title-group>
<abstract></abstract>
<pub-date date-type="pub" iso-8601-date="">
<day></day>
<month></month>
<year></year>
</pub-date>
<contrib-group>
</contrib-group>
<custom-meta-group>
Expand Down

0 comments on commit 87f392b

Please sign in to comment.