Desktop: Change 'CSV summary dive details' output from TSV to CSV.

Change the output formato for the Export / 'CSV summary dive details'
from TSV to CSV, to make it consistent with the menu item name, and with
the other 'CSV' export function.
This was changed to TSV by @mturkia in
6c82578540,
but I could not find any discussion as to why.
Also removed replacement of the field separator in any fields, as,
according to the CSV RFC (https://datatracker.ietf.org/doc/html/rfc4180)
this is not required as long as the fields containing separators are
enclosed in quotes, and any quotes within the fields are doubled up.
Tested with a fairly large log file, and importing into Google Sheets is
working fine for the output produced.
Also made capitalisation of the Export menu items consistent.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2023-04-28 13:15:31 +12:00 committed by mturkia
parent cf95c3bd82
commit 1bd7806dcf
3 changed files with 16 additions and 15 deletions

View file

@ -1,3 +1,4 @@
export: change format produced by 'CSV summary dive details' from TSV (tab separated) to CSV
import: add option to synchronise dive computer time when downloading dives
core: fix bug when save sea water salinity given by DC
desktop: add option to force firmware update on OSTC4

View file

@ -267,7 +267,7 @@
<item>
<widget class="QRadioButton" name="exportCSV">
<property name="text">
<string>CSV Dive computer dive profile</string>
<string>CSV dive computer dive profile</string>
</property>
<attribute name="buttonGroup">
<string notr="true">exportGroup</string>
@ -277,7 +277,7 @@
<item>
<widget class="QRadioButton" name="exportProfileData">
<property name="text">
<string>CSV Computed Profile Panel data</string>
<string>CSV computed profile panel data</string>
</property>
<attribute name="buttonGroup">
<string notr="true">exportGroup</string>

View file

@ -6,7 +6,7 @@
<xsl:param name="units" select="units"/>
<xsl:output method="text" encoding="UTF-8"/>
<xsl:variable name="fs"><xsl:text> </xsl:text></xsl:variable>
<xsl:variable name="fs"><xsl:text>,</xsl:text></xsl:variable>
<xsl:variable name="lf"><xsl:text>
</xsl:text></xsl:variable>
@ -398,8 +398,8 @@
<xsl:value-of select="$fs"/>
<xsl:text>&quot;</xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="line" select="substring-before(translate(translate(@tags, $fs, ' '), $lf, ' '), '&quot;')"/>
<xsl:with-param name="remaining" select="substring-after(translate(translate(@tags, $fs, ' '), $lf, ' '), '&quot;')"/>
<xsl:with-param name="line" select="substring-before(translate(@tags, $lf, ' '), '&quot;')"/>
<xsl:with-param name="remaining" select="substring-after(translate(@tags, $lf, ' '), '&quot;')"/>
<xsl:with-param name="all" select="@tags"/>
</xsl:call-template>
<xsl:text>&quot;</xsl:text>
@ -509,9 +509,9 @@
<xsl:value-of select="$fs"/>
<xsl:text>&quot;</xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="line" select="substring-before(translate(translate(., $fs, ' '), $lf, ' '), '&quot;')"/>
<xsl:with-param name="remaining" select="substring-after(translate(translate(., $fs, ' '), $lf, ' '), '&quot;')"/>
<xsl:with-param name="all" select="translate(., $fs, ' ')"/>
<xsl:with-param name="line" select="substring-before(translate(., $lf, ' '), '&quot;')"/>
<xsl:with-param name="remaining" select="substring-after(translate(., $lf, ' '), '&quot;')"/>
<xsl:with-param name="all" select="."/>
</xsl:call-template>
<xsl:text>&quot;</xsl:text>
</xsl:template>
@ -519,8 +519,8 @@
<xsl:value-of select="$fs"/>
<xsl:text>&quot;</xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="line" select="substring-before(translate(translate(., $fs, ' '), $lf, ' '), '&quot;')"/>
<xsl:with-param name="remaining" select="substring-after(translate(translate(., $fs, ' '), $lf, ' '), '&quot;')"/>
<xsl:with-param name="line" select="substring-before(translate(., $lf, ' '), '&quot;')"/>
<xsl:with-param name="remaining" select="substring-after(translate(., $lf, ' '), '&quot;')"/>
<xsl:with-param name="all" select="."/>
</xsl:call-template>
<xsl:text>&quot;</xsl:text>
@ -529,8 +529,8 @@
<xsl:value-of select="$fs"/>
<xsl:text>&quot;</xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="line" select="substring-before(translate(translate(., $fs, ' '), $lf, ' '), '&quot;')"/>
<xsl:with-param name="remaining" select="substring-after(translate(translate(., $fs, ' '), $lf, ' '), '&quot;')"/>
<xsl:with-param name="line" select="substring-before(translate(., $lf, ' '), '&quot;')"/>
<xsl:with-param name="remaining" select="substring-after(translate(., $lf, ' '), '&quot;')"/>
<xsl:with-param name="all" select="."/>
</xsl:call-template>
<xsl:text>&quot;</xsl:text>
@ -539,9 +539,9 @@
<xsl:value-of select="$fs"/>
<xsl:text>&quot;</xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="line" select="substring-before(translate(translate(., $fs, ' '), $lf, '\n'), '&quot;')"/>
<xsl:with-param name="remaining" select="substring-after(translate(translate(., $fs, ' '), $lf, '\n'), '&quot;')"/>
<xsl:with-param name="all" select="translate(translate(., $fs, ' '), $lf, '\n')"/>
<xsl:with-param name="line" select="substring-before(translate(., $lf, '\n'), '&quot;')"/>
<xsl:with-param name="remaining" select="substring-after(translate(., $lf, '\n'), '&quot;')"/>
<xsl:with-param name="all" select="translate(., $lf, '\n')"/>
</xsl:call-template>
<xsl:text>&quot;</xsl:text>
</xsl:template>