Skip to content

Commit

Permalink
convert: Update conversion of OrganisationRegistrationAgency from source
Browse files Browse the repository at this point in the history
Improve the diff by:
* Indenting the output

Maintain changes made to the list in this repo, by:
* Editing the template in this repo to match changes to the list
* Maintain the CDATA block during the conversion
* Output utf-8 instead of amperand encoding
  • Loading branch information
Bjwebb committed Mar 20, 2024
1 parent af43727 commit 61cb13a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
org_id_xml = etree.parse(join('source', 'org-id-guide.xml'))
codelist_items = org_id_xml.find('codelist-items')

parser = etree.XMLParser(strip_cdata=False)
template = etree.parse(
join('templates', 'OrganisationRegistrationAgency.xml'))
join('templates', 'OrganisationRegistrationAgency.xml'),
parser=parser)
placeholder_codelist_items = template.find('codelist-items')

template.getroot().replace(placeholder_codelist_items, codelist_items)

etree.indent(template, space=' ')

template.write(
join('xml', 'OrganisationRegistrationAgency.xml'),
pretty_print=True)
encoding='utf-8')
5 changes: 4 additions & 1 deletion templates/OrganisationRegistrationAgency.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<codelist name="OrganisationRegistrationAgency" complete="0" xml:lang="en" category-codelist="Country">
<codelist name="OrganisationRegistrationAgency" complete="0" xml:lang="en" category-codelist="Country" embedded="0">
<metadata>
<name>
<narrative>Organisation Registration Agency</narrative>
Expand All @@ -14,6 +14,9 @@
If org-id.guide does not contain an entry for the kind of organisation you need to identify, you can make a request a new list is included in the register following the `guidance <http://docs.org-id.guide/en/latest/contribute/>`__ or by getting in touch with org-id.guide at: [email protected].
]]></narrative>
</description>
<category>
<narrative>Replicated</narrative>
</category>
</metadata>
<codelist-items/>
</codelist>

0 comments on commit 61cb13a

Please sign in to comment.