summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2009-09-30 17:30:52 +0200
committerSebastian Pipping <sebastian@pipping.org>2009-09-30 17:33:00 +0200
commitf7d068d772aa9961338f78d4b91b4783f43ff40f (patch)
tree274615dd40ddd5f7f32869b808de2d965bc228d3
parentAdd support for <longdescription> as requested (diff)
downloadrepositories-xml-format-f7d068d772aa9961338f78d4b91b4783f43ff40f.tar.gz
repositories-xml-format-f7d068d772aa9961338f78d4b91b4783f43ff40f.tar.bz2
repositories-xml-format-f7d068d772aa9961338f78d4b91b4783f43ff40f.zip
Add language support to <description>
-rw-r--r--merge-gitosis-conf-into-repositories-xml.py3
-rw-r--r--samples/repositories.xml3
-rw-r--r--schema/repositories.dtd7
-rw-r--r--schema/repositories.rng15
-rwxr-xr-xwrite-layman-global-txt.py11
5 files changed, 32 insertions, 7 deletions
diff --git a/merge-gitosis-conf-into-repositories-xml.py b/merge-gitosis-conf-into-repositories-xml.py
index 797cfa9..af11c88 100644
--- a/merge-gitosis-conf-into-repositories-xml.py
+++ b/merge-gitosis-conf-into-repositories-xml.py
@@ -37,6 +37,7 @@ for section_name in gitosis_conf.sections():
print 'Updating %s' % repo_name
repo = overlays_gentoo_org_dict[repo_name]
# Keep due to poor descriptions in gitosis.conf atm
+ # Assume first <description> is english
_description = repo.find('description').text
# Clear
@@ -51,7 +52,7 @@ for section_name in gitosis_conf.sections():
homepage = ET.Element('homepage')
homepage.text = 'http://git.overlays.gentoo.org/gitweb/?p=%s.git;a=summary' % _repo_base
- description = ET.Element('description')
+ description = ET.Element('description', lang='en')
description.text = _description
_owner = gitosis_conf.get(section_name, 'owner')
diff --git a/samples/repositories.xml b/samples/repositories.xml
index f97877d..a45c0b3 100644
--- a/samples/repositories.xml
+++ b/samples/repositories.xml
@@ -3,7 +3,8 @@
name="sping"
quality="experimental"
status="unofficial">
- <description>Gentoo overlay of Sebastian Pipping</description>
+ <description lang="en">Gentoo overlay of Sebastian Pipping</description>
+ <description lang="de">Gentoo-Overlay von Sebastian Pipping</description>
<longdescription lang="en">
Quick-bumps and stuff that I should move to sunrise
</longdescription>
diff --git a/schema/repositories.dtd b/schema/repositories.dtd
index 11a124e..e16564e 100644
--- a/schema/repositories.dtd
+++ b/schema/repositories.dtd
@@ -4,6 +4,8 @@
Modelling by
Robert Buchholz <rbu@gentoo.org>
Sebastian Pipping <sebastian@pipping.org>
+ Mounir Lamouri <volkmar@gentoo.org>
+ Tiziano Müller <dev-zero@gentoo.org>
Copyright 1999-2009 Gentoo Foundation
Distributed under the terms of the GNU General Public License v2 or later
@@ -13,7 +15,7 @@
xmlns CDATA #FIXED ''
version CDATA #FIXED '1.0'>
-<!ELEMENT repo (description,(longdescription)*,(homepage)?,owner,(source)+,(feed)*)>
+<!ELEMENT repo ((description)+,(longdescription)*,(homepage)?,owner,(source)+,(feed)*)>
<!ATTLIST repo
xmlns CDATA #FIXED ''
name CDATA #REQUIRED
@@ -23,7 +25,8 @@
<!ELEMENT description (#PCDATA)>
<!ATTLIST description
- xmlns CDATA #FIXED ''>
+ xmlns CDATA #FIXED ''
+ lang CDATA #IMPLIED>
<!ELEMENT longdescription (#PCDATA)>
<!ATTLIST longdescription
diff --git a/schema/repositories.rng b/schema/repositories.rng
index 5f7efb9..f35b486 100644
--- a/schema/repositories.rng
+++ b/schema/repositories.rng
@@ -5,6 +5,8 @@
Modelling by
Robert Buchholz <rbu@gentoo.org>
Sebastian Pipping <sebastian@pipping.org>
+ Mounir Lamouri <volkmar@gentoo.org>
+ Tiziano Müller <dev-zero@gentoo.org>
Copyright 1999-2009 Gentoo Foundation
Distributed under the terms of the GNU General Public License v2 or later
@@ -44,9 +46,16 @@
</choice>
</attribute>
</optional>
- <element name="description">
- <text/>
- </element>
+ <oneOrMore>
+ <element name="description">
+ <optional>
+ <attribute name="lang">
+ <text/>
+ </attribute>
+ </optional>
+ <text/>
+ </element>
+ </oneOrMore>
<zeroOrMore>
<element name="longdescription">
<optional>
diff --git a/write-layman-global-txt.py b/write-layman-global-txt.py
index 54b0ab3..2b84a3d 100755
--- a/write-layman-global-txt.py
+++ b/write-layman-global-txt.py
@@ -39,6 +39,17 @@ for repo in repositories:
if att_name in repo.attrib:
del repo.attrib[att_name]
+ # Transform 'description' tags
+ descriptions_kept = 0
+ for description in repo.findall('description'):
+ if 'lang' in description.attrib.keys():
+ if description.attrib['lang'] not in ('C', 'en') or \
+ descriptions_kept > 1:
+ repo.remove(description)
+ else:
+ del description.attrib['lang']
+ descriptions_kept = descriptions_kept + 1
+
# Kill unsupported tags
for tag_name in ('feed', 'source', 'longdescription'):
for o in repo.findall(tag_name):