blundellc at gmail.com
2008-Sep-12 20:10 UTC
[Rd] write.dcf does not quote as Debian would like it to (PR#12816)
Full_Name: charles blundell Version: 2.7.0 OS: Debian GNU/Linux Submission from: (NULL) (217.37.73.202) The Debian Policy Manual says concerning lines in a Description field: * Those containing a space, a full stop and some more characters. These are for future expansion. Do not use them. (section 5.6.13, http://www.debian.org/doc/debian-policy/ch-controlfields.html) But for example:> write.dcf(list(Description = 'there was a fat goat .haha'),indent=1,width=10)Description: there was a fat goat .haha A simple quoting scheme is to add a space in front of such full stops: --- src/library/base/R/dcf.R.orig 2008-09-12 20:42:37.000000000 +0100 +++ src/library/base/R/dcf.R 2008-09-12 20:54:16.000000000 +0100 @@ -133,7 +133,7 @@ ## * We have to handle multiple fields per record. escape_paragraphs <- function(s) - gsub("\n[[:space:]]*\n", "\n .\n ", s) + gsub("\n \\.([^\n])","\n .\\1", gsub("\n[[:space:]]*\n", "\n .\n ", s)) if(!is.data.frame(x)) x <- as.data.frame(x, stringsAsFactors = FALSE) As so:> write.dcf(list(Description = 'there was a fat goat .haha'),indent=1,width=10)Description: there was a fat goat .haha Doing this makes life easier for cran2deb as we can generate valid Debian control files using write.dcf.
maechler at stat.math.ethz.ch
2008-Sep-13 13:25 UTC
[Rd] write.dcf does not quote as Debian would like it to (PR#12816)
>>>>> "chb" == blundellc <blundellc at gmail.com> >>>>> on Fri, 12 Sep 2008 22:10:14 +0200 (CEST) writes:chb> Full_Name: charles blundell chb> Version: 2.7.0 chb> OS: Debian GNU/Linux chb> Submission from: (NULL) (217.37.73.202) chb> The Debian Policy Manual says concerning lines in a chb> Description field: * Those containing a space, a full chb> stop and some more characters. These are for future chb> expansion. Do not use them. (section 5.6.13, chb> http://www.debian.org/doc/debian-policy/ch-controlfields.html) chb> But for example: >> write.dcf(list(Description = 'there was a fat goat .haha'),indent=1,width=10) chb> Description: chb> there chb> was a chb> fat goat chb> .haha chb> A simple quoting scheme is to add a space in front of such full stops: chb> --- src/library/base/R/dcf.R.orig 2008-09-12 20:42:37.000000000 +0100 chb> +++ src/library/base/R/dcf.R 2008-09-12 20:54:16.000000000 +0100 chb> @@ -133,7 +133,7 @@ chb> ## * We have to handle multiple fields per record. chb> escape_paragraphs <- function(s) chb> - gsub("\n[[:space:]]*\n", "\n .\n ", s) chb> + gsub("\n \\.([^\n])","\n .\\1", gsub("\n[[:space:]]*\n", "\n .\n ", chb> s)) chb> if(!is.data.frame(x)) chb> x <- as.data.frame(x, stringsAsFactors = FALSE) chb> As so: >> write.dcf(list(Description = 'there was a fat goat .haha'),indent=1,width=10) chb> Description: chb> there chb> was a chb> fat goat chb> .haha chb> Doing this makes life easier for cran2deb as we can chb> generate valid Debian control files using write.dcf. That sounds a good enough reason to make the change, notably since I cannot see a case (in other uses of write.dcf()) where this would be undesirable. I'm going to test this quickly and will most probably add it to R-devel (R.2.8.0 to be). Martin Maechler, ETH Zurich