diff options
| author | randomdan <randomdan@localhost> | 2010-09-15 23:49:20 +0000 | 
|---|---|---|
| committer | randomdan <randomdan@localhost> | 2010-09-15 23:49:20 +0000 | 
| commit | 3bdad320128f432937216225676636b9c5fba977 (patch) | |
| tree | 9142e4e8672bf8532827cacf24d3b00b90315be6 | |
| parent | Fix regexp_replace to match multiple times (diff) | |
| download | gentoobrowse-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.xml | 8 | ||||
| -rw-r--r-- | gentoobrowse/console/bugs.xslt | 7 | 
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="
" encoding="utf-8" fieldSep="|" quoteChar="" +		<project2:prociterate name="bugsourceUnc" newline="
" encoding="utf-8" fieldSep="," quoteChar="""  				path="wget http://bugs.gentoo.org/data/cached/buglist-UNCONFIRMED.htmlgz -qO - | xsltproc console/bugs.xslt -" /> -		<project2:prociterate name="bugsourceAss" newline="
" encoding="utf-8" fieldSep="|" quoteChar="" +		<project2:prociterate name="bugsourceAss" newline="
" encoding="utf-8" fieldSep="," quoteChar="""  				path="wget http://bugs.gentoo.org/data/cached/buglist-ASSIGNED.htmlgz -qO - | xsltproc console/bugs.xslt -" /> -		<project2:prociterate name="bugsourceROp" newline="
" encoding="utf-8" fieldSep="|" quoteChar="" +		<project2:prociterate name="bugsourceROp" newline="
" encoding="utf-8" fieldSep="," quoteChar="""  				path="wget http://bugs.gentoo.org/data/cached/buglist-REOPENED.htmlgz -qO - | xsltproc console/bugs.xslt -" /> -		<project2:prociterate name="bugsourceNew" newline="
" encoding="utf-8" fieldSep="|" quoteChar="" +		<project2:prociterate name="bugsourceNew" newline="
" encoding="utf-8" fieldSep="," quoteChar="""  				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:'),' ')" />,"<xsl:value-of select="str:replace(x:em,'"','""')" />",<xsl:value-of select="substring-before(substring-after(.,'status:'),' ')" />,<xsl:value-of select="substring-after(.,'severity:')" />,  	</xsl:template>  </xsl:stylesheet> | 
