summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2010-09-15 23:49:20 +0000
committerrandomdan <randomdan@localhost>2010-09-15 23:49:20 +0000
commit3bdad320128f432937216225676636b9c5fba977 (patch)
tree9142e4e8672bf8532827cacf24d3b00b90315be6
parentFix regexp_replace to match multiple times (diff)
downloadgentoobrowse-3bdad320128f432937216225676636b9c5fba977.tar.bz2
gentoobrowse-3bdad320128f432937216225676636b9c5fba977.tar.xz
gentoobrowse-3bdad320128f432937216225676636b9c5fba977.zip
Fix bug import via converting the HTML into a properly quoted CSV
-rw-r--r--gentoobrowse/console/bugimport.xml8
-rw-r--r--gentoobrowse/console/bugs.xslt7
2 files changed, 8 insertions, 7 deletions
diff --git a/gentoobrowse/console/bugimport.xml b/gentoobrowse/console/bugimport.xml
index 4e32e56..6c43f40 100644
--- a/gentoobrowse/console/bugimport.xml
+++ b/gentoobrowse/console/bugimport.xml
@@ -3,13 +3,13 @@
xmlns:project2="http://project2.randomdan.homeip.net">
<xi:include href="../datasources/postgres.xml" />
<project2:sqlmerge name="bugimport" datasource="postgres" targettable="bugs">
- <project2:prociterate name="bugsourceUnc" newline="&#10;" encoding="utf-8" fieldSep="|" quoteChar=""
+ <project2:prociterate name="bugsourceUnc" newline="&#10;" encoding="utf-8" fieldSep="," quoteChar="&quot;"
path="wget http://bugs.gentoo.org/data/cached/buglist-UNCONFIRMED.htmlgz -qO - | xsltproc console/bugs.xslt -" />
- <project2:prociterate name="bugsourceAss" newline="&#10;" encoding="utf-8" fieldSep="|" quoteChar=""
+ <project2:prociterate name="bugsourceAss" newline="&#10;" encoding="utf-8" fieldSep="," quoteChar="&quot;"
path="wget http://bugs.gentoo.org/data/cached/buglist-ASSIGNED.htmlgz -qO - | xsltproc console/bugs.xslt -" />
- <project2:prociterate name="bugsourceROp" newline="&#10;" encoding="utf-8" fieldSep="|" quoteChar=""
+ <project2:prociterate name="bugsourceROp" newline="&#10;" encoding="utf-8" fieldSep="," quoteChar="&quot;"
path="wget http://bugs.gentoo.org/data/cached/buglist-REOPENED.htmlgz -qO - | xsltproc console/bugs.xslt -" />
- <project2:prociterate name="bugsourceNew" newline="&#10;" encoding="utf-8" fieldSep="|" quoteChar=""
+ <project2:prociterate name="bugsourceNew" newline="&#10;" encoding="utf-8" fieldSep="," quoteChar="&quot;"
path="wget http://bugs.gentoo.org/data/cached/buglist-NEW.htmlgz -qO - | xsltproc console/bugs.xslt -" />
<columns>
<column key="true">bugid</column>
diff --git a/gentoobrowse/console/bugs.xslt b/gentoobrowse/console/bugs.xslt
index 66055ce..f492be1 100644
--- a/gentoobrowse/console/bugs.xslt
+++ b/gentoobrowse/console/bugs.xslt
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="http://www.w3.org/1999/xhtml">
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="http://www.w3.org/1999/xhtml"
+ xmlns:str="http://exslt.org/strings" extension-element-prefixes="str">
<xsl:output encoding="utf-8" method="text" media-type="text/csv" indent="no"/>
- <xsl:template match="/x:html">bug_id|summary|status|severity|
+ <xsl:template match="/x:html">bug_id,summary,status,severity,
<xsl:apply-templates select="/x:html/x:body/x:div/x:ul/x:li/x:a" />
</xsl:template>
<xsl:template match="x:li/x:a">
- <xsl:value-of select="substring-before(substring-after(.,'Bug:'),' ')" />|<xsl:value-of select="x:em" />|<xsl:value-of select="substring-before(substring-after(.,'status:'),' ')" />|<xsl:value-of select="substring-after(.,'severity:')" />|
+ <xsl:value-of select="substring-before(substring-after(.,'Bug:'),' ')" />,&quot;<xsl:value-of select="str:replace(x:em,'&quot;','&quot;&quot;')" />&quot;,<xsl:value-of select="substring-before(substring-after(.,'status:'),' ')" />,<xsl:value-of select="substring-after(.,'severity:')" />,
</xsl:template>
</xsl:stylesheet>