Package: pkg-php-tools
Version: 1.28
Severity: wishlist
Tags: patch

The package.xml file from php-services-weather contains:

 <summary>This class acts as an interface to various online 
weather-services.</summary>
 <description>Services_Weather searches for given locations and retrieves 
current
        weather data and, dependent on the used service, also forecasts. Up to
        now, GlobalWeather from CapeScience, Weather XML from EJSE (US only),
[…]

pkg-php-tools currently translates

Description: ${phppear:summary}
 ${phppear:description}

as:

Description: This class acts as an interface to various online weather-services
 Services_Weather searches for given locations and retrieves current
         weather data and, dependent on the used service, also forecasts. Up to
         now, GlobalWeather from CapeScience, Weather XML from EJSE (US only),
[…]

After applying the proposed patch, the long description looks more
conventional:

Description: This class acts as an interface to various online weather-services
 Services_Weather searches for given locations and retrieves current
 weather data and, dependent on the used service, also forecasts. Up to
 now, GlobalWeather from CapeScience, Weather XML from EJSE (US only),
[…]

Regards

David
From 231e74fcf43d871a689df1b109c9e04a18f18ac8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Pr=C3=A9vot?= <taf...@debian.org>
Date: Sat, 21 Mar 2015 14:56:43 -0400
Subject: [PATCH] Drop excessive spaces from substvar

---
 share/php/pkgtools/base/utils.php | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/share/php/pkgtools/base/utils.php b/share/php/pkgtools/base/utils.php
index acc35ef..0d77ae2 100644
--- a/share/php/pkgtools/base/utils.php
+++ b/share/php/pkgtools/base/utils.php
@@ -44,8 +44,9 @@ class Utils {
 
     /**
      * Format string to substvar format:
+     * - Replace tabs and drop excessive spaces
+     * - Drop starting spaces
      * - Indent bullets
-     * - Replace tabs
      * - Wrap to 80 chars
      * - Convert new lines to ${Newline}
      * - Split paragraphs
@@ -53,10 +54,12 @@ class Utils {
      * @param bool $force If true, reload even if already loaded
      */
     static public function substvar($input) {
+        // Replace tabs and drop excessive spaces
+        $tmp = preg_replace('/\h+/', ' ', $input);
+        // Drop starting spaces
+        $tmp = preg_replace('/^ /m', '', $tmp);
         // Indent bullets
-        $tmp = preg_replace('/^\*/', ' *', $input);
-        // Replace tabs
-        $tmp = preg_replace('/\t+/', ' ', $tmp);
+        $tmp = preg_replace('/^\*/', ' *', $tmp);
         // Wrap to 80 chars
         $tmp = wordwrap($tmp, 78);
         // Convert new lines to ${Newline}
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

Reply via email to