Hello community,

here is the log from the commit of package yast2-ncurses-pkg for 
openSUSE:Factory checked in at 2012-03-02 13:50:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-ncurses-pkg (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-ncurses-pkg.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-ncurses-pkg", Maintainer is "g...@suse.com"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-ncurses-pkg/yast2-ncurses-pkg.changes      
2012-01-19 09:45:16.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-ncurses-pkg.new/yast2-ncurses-pkg.changes 
2012-03-02 13:50:42.000000000 +0100
@@ -1,0 +2,6 @@
+Thu Mar  1 14:34:21 CET 2012 - g...@suse.de
+
+- Better formatting of package and patch descriptions
+- 2.22.1
+
+-------------------------------------------------------------------

Old:
----
  yast2-ncurses-pkg-2.22.0.tar.bz2

New:
----
  yast2-ncurses-pkg-2.22.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-ncurses-pkg.spec ++++++
--- /var/tmp/diff_new_pack.QQtlSJ/_old  2012-03-02 13:50:43.000000000 +0100
+++ /var/tmp/diff_new_pack.QQtlSJ/_new  2012-03-02 13:50:43.000000000 +0100
@@ -18,7 +18,7 @@
 
 
 Name:           yast2-ncurses-pkg
-Version:        2.22.0
+Version:        2.22.1
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-ncurses-pkg-2.22.0.tar.bz2 -> yast2-ncurses-pkg-2.22.1.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ncurses-pkg-2.22.0/VERSION 
new/yast2-ncurses-pkg-2.22.1/VERSION
--- old/yast2-ncurses-pkg-2.22.0/VERSION        2012-01-17 13:55:23.000000000 
+0100
+++ new/yast2-ncurses-pkg-2.22.1/VERSION        2012-03-01 14:34:03.000000000 
+0100
@@ -1 +1 @@
-2.22.0
+2.22.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ncurses-pkg-2.22.0/configure 
new/yast2-ncurses-pkg-2.22.1/configure
--- old/yast2-ncurses-pkg-2.22.0/configure      2012-01-17 13:57:52.000000000 
+0100
+++ new/yast2-ncurses-pkg-2.22.1/configure      2012-03-01 14:36:23.000000000 
+0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for yast2-ncurses-pkg 2.22.0.
+# Generated by GNU Autoconf 2.68 for yast2-ncurses-pkg 2.22.1.
 #
 # Report bugs to <http://bugs.opensuse.org/>.
 #
@@ -709,8 +709,8 @@
 # Identity of this package.
 PACKAGE_NAME='yast2-ncurses-pkg'
 PACKAGE_TARNAME='yast2-ncurses-pkg'
-PACKAGE_VERSION='2.22.0'
-PACKAGE_STRING='yast2-ncurses-pkg 2.22.0'
+PACKAGE_VERSION='2.22.1'
+PACKAGE_STRING='yast2-ncurses-pkg 2.22.1'
 PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
 PACKAGE_URL=''
 
@@ -1492,7 +1492,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures yast2-ncurses-pkg 2.22.0 to adapt to many kinds of 
systems.
+\`configure' configures yast2-ncurses-pkg 2.22.1 to adapt to many kinds of 
systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1564,7 +1564,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of yast2-ncurses-pkg 2.22.0:";;
+     short | recursive ) echo "Configuration of yast2-ncurses-pkg 2.22.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1680,7 +1680,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-yast2-ncurses-pkg configure 2.22.0
+yast2-ncurses-pkg configure 2.22.1
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2224,7 +2224,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by yast2-ncurses-pkg $as_me 2.22.0, which was
+It was created by yast2-ncurses-pkg $as_me 2.22.1, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -3154,7 +3154,7 @@
 
 # Define the identity of the package.
  PACKAGE='yast2-ncurses-pkg'
- VERSION='2.22.0'
+ VERSION='2.22.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3276,7 +3276,7 @@
 
 
 
-VERSION="2.22.0"
+VERSION="2.22.1"
 RPMNAME="yast2-ncurses-pkg"
 MAINTAINER="Gabriele Mohr <g...@suse.de>"
 
@@ -16076,7 +16076,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by yast2-ncurses-pkg $as_me 2.22.0, which was
+This file was extended by yast2-ncurses-pkg $as_me 2.22.1, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16142,7 +16142,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-yast2-ncurses-pkg config.status 2.22.0
+yast2-ncurses-pkg config.status 2.22.1
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ncurses-pkg-2.22.0/configure.in 
new/yast2-ncurses-pkg-2.22.1/configure.in
--- old/yast2-ncurses-pkg-2.22.0/configure.in   2012-01-17 13:57:45.000000000 
+0100
+++ new/yast2-ncurses-pkg-2.22.1/configure.in   2012-03-01 14:36:14.000000000 
+0100
@@ -3,7 +3,7 @@
 dnl -- This file is generated by y2autoconf 2.21.2 - DO NOT EDIT! --
 dnl    (edit configure.in.in instead)
 
-AC_INIT(yast2-ncurses-pkg, 2.22.0, http://bugs.opensuse.org/, 
yast2-ncurses-pkg)
+AC_INIT(yast2-ncurses-pkg, 2.22.1, http://bugs.opensuse.org/, 
yast2-ncurses-pkg)
 dnl Check for presence of file 'RPMNAME'
 AC_CONFIG_SRCDIR([RPMNAME])
 
@@ -18,7 +18,7 @@
 AM_INIT_AUTOMAKE(tar-ustar -Wno-portability)
 
 dnl Important YaST2 variables
-VERSION="2.22.0"
+VERSION="2.22.1"
 RPMNAME="yast2-ncurses-pkg"
 MAINTAINER="Gabriele Mohr <g...@suse.de>"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ncurses-pkg-2.22.0/src/NCPackageSelector.cc 
new/yast2-ncurses-pkg-2.22.1/src/NCPackageSelector.cc
--- old/yast2-ncurses-pkg-2.22.0/src/NCPackageSelector.cc       2012-01-17 
13:29:58.000000000 +0100
+++ new/yast2-ncurses-pkg-2.22.1/src/NCPackageSelector.cc       2012-02-22 
14:10:13.000000000 +0100
@@ -1326,9 +1326,6 @@
 //
 // createLicenseText
 // 
-
-#define DOCTYPETAG "<!-- DT:Rich -->"  // Special doctype for preformatted HTML
-
 bool NCPackageSelector::showLicensePopup( string pkgName, string license )
 {
     string html_text = "";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ncurses-pkg-2.22.0/src/NCPackageSelector.h 
new/yast2-ncurses-pkg-2.22.1/src/NCPackageSelector.h
--- old/yast2-ncurses-pkg-2.22.0/src/NCPackageSelector.h        2012-01-17 
13:25:46.000000000 +0100
+++ new/yast2-ncurses-pkg-2.22.1/src/NCPackageSelector.h        2012-02-28 
14:59:33.000000000 +0100
@@ -102,6 +102,8 @@
     return ( toupper( c1 ) == toupper( c2 ) );
 }
 
+#define DOCTYPETAG "<!-- DT:Rich -->"  // Special doctype for preformatted HTML
+
 ///////////////////////////////////////////////////////////////////
 //
 //     CLASS NAME : NCPackageSelector
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ncurses-pkg-2.22.0/src/NCPkgFilterRPMGroups.cc 
new/yast2-ncurses-pkg-2.22.1/src/NCPkgFilterRPMGroups.cc
--- old/yast2-ncurses-pkg-2.22.0/src/NCPkgFilterRPMGroups.cc    2012-01-17 
13:30:52.000000000 +0100
+++ new/yast2-ncurses-pkg-2.22.1/src/NCPkgFilterRPMGroups.cc    2012-02-22 
10:22:05.000000000 +0100
@@ -217,7 +217,7 @@
     // is the requested rpm group a prefix of this package's group?
     if ( pkg->group ().find (group_str) == 0 )
     {
-        yuiError() << slb->name() << endl;
+        yuiDebug() << slb->name() << endl;
        packageList->createListEntry( pkg, slb );
 
        return true;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ncurses-pkg-2.22.0/src/NCPkgPackageDetails.cc 
new/yast2-ncurses-pkg-2.22.1/src/NCPkgPackageDetails.cc
--- old/yast2-ncurses-pkg-2.22.0/src/NCPkgPackageDetails.cc     2012-01-17 
13:31:48.000000000 +0100
+++ new/yast2-ncurses-pkg-2.22.1/src/NCPkgPackageDetails.cc     2012-03-01 
14:32:42.000000000 +0100
@@ -43,6 +43,8 @@
 #include "NCPkgPackageDetails.h"
 #include "NCPackageSelector.h"
 
+#include <boost/algorithm/string.hpp>
+
 using namespace zypp;
 
 /*
@@ -108,7 +110,11 @@
 
 string NCPkgPackageDetails::commonHeader( ZyppObj pkgPtr )
 {
-   string text;
+   string text = "";
+
+   if ( !pkgPtr )
+       return text;
+   
    text += "<h3>" + pkgPtr->name() + " - ";
    text += pkgPtr->summary() + "</h3>";
 
@@ -119,11 +125,14 @@
 {
    string text = "";
 
+   if ( !pkgPtr )
+       return;
+   
    //text += commonHeader( pkgPtr );
    text += pkgPtr->description();
 
    // show the description
-   setValue( text );
+   setValue( createHtmlText(text) );
 }
 
 void NCPkgPackageDetails::technicalData( ZyppObj pkgPtr, ZyppSel slbPtr )
@@ -132,10 +141,10 @@
     string version = "";
     string text = "";
 
+    if ( !pkgPtr || !slbPtr )
+        return;
+    
     text += commonHeader( pkgPtr );
-    //text += " - ";
-
-    //text += pkgPtr->summary();
 
     if ( slbPtr->hasBothObjects () )
     {
@@ -199,10 +208,13 @@
        text += package->sourcePkgEdition().asString();
        text += "<br>";
 
-       //authors, in one line
-        text += NCPkgStrings::Authors();
         list<string> authors = package->authors(); // zypp::Package
-        text += createText( authors, true );
+        if ( !authors.empty() )
+        {
+            text += NCPkgStrings::Authors();  
+            //authors, in one line
+            text += createText( authors, true );
+        }
 
     }
 
@@ -264,6 +276,94 @@
 
 }
 
+string NCPkgPackageDetails::createHtmlText( string value )
+{
+    yuiDebug() << "Description: " << value << endl;
+
+    // check RichText tag
+    if ( value.find( string(DOCTYPETAG) ) != string::npos )
+    {
+       return value;   // input is rich text
+    }
+    // escape html
+    boost::replace_all( value, "&", "&amp;" );
+    boost::replace_all( value, "<", "&lt;" );
+    boost::replace_all( value, ">", "&gt;" );
+    
+    NCstring input( value );
+    NCtext descr( input );
+    NCtext html_descr( NCstring("<p>") );
+    string description = "";
+    bool ul_begin = false;
+    bool ul_found = false;
+    list<NCstring>::const_iterator line;
+
+    for ( line = descr.Text().begin(); line != descr.Text().end(); ++line )
+    {
+        NCstring curr_line( *line );
+
+        if ( curr_line.Str().empty() )
+        {
+            if ( ul_found )     // empty line after list
+            {
+                html_descr.append( NCstring("</li></ul><p>") );
+                ul_found = false;
+                ul_begin = false;
+            }
+            else
+            {
+                html_descr.append( NCstring("</p><p>") );
+            }
+        }
+        else if ( curr_line.Str().substr(0,2) == "- "
+                  || curr_line.Str().substr(0,2) == "* ")         // list item 
found
+        {
+            ul_found = true;
+            if ( !ul_begin )
+            {
+                html_descr.append( NCstring("</p><ul><li>") );
+                ul_begin = true;
+            }
+            else
+            {
+                html_descr.append( NCstring("</li><li>") );  
+            }
+            html_descr.append( NCstring(curr_line.Str().substr(2)) );
+        }
+        else if ( curr_line.Str().substr(0,2) == "  " )      // white spaces 
at begin
+        {
+            // just append the line (is added to list item or to paragraph)
+            html_descr.append( NCstring( curr_line.Str() ) );  
+        }
+        else
+        {
+            if ( ul_found )     // first line after list 
+            {
+                html_descr.append( NCstring("</li></ul><p>") );
+                ul_found = false;
+                ul_begin = false;
+            }
+            html_descr.append( NCstring(" " + curr_line.Str()) );
+        }
+    }
+
+    if ( ul_found )
+        html_descr.append( NCstring("</li></ul>") );
+    else
+        html_descr.append( NCstring("</p>") );
+
+    // create description
+    for ( line = html_descr.Text().begin(); line != html_descr.Text().end(); 
++line )
+    {
+        NCstring curr_line( *line );
+        description += curr_line.Str();
+    }
+    // reduce number of empty lines       
+    boost::replace_all( description, "</p><p></p>", "</p>" );
+    
+    return description;
+}
+
 bool NCPkgPackageDetails::patchDescription( ZyppObj objPtr, ZyppSel selectable 
)
 {
     ZyppPatch patchPtr = tryCastToZyppPatch( objPtr );
@@ -301,9 +401,7 @@
     // get and format the patch description
     string value = patchPtr->description();
 
-    descr += "<p>";
-    descr += value;
-    descr += "</p>";
+    descr += createHtmlText( value );
 
     descr +=  _("References:<br>");
     for ( Patch::ReferenceIterator rit = patchPtr->referencesBegin();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ncurses-pkg-2.22.0/src/NCPkgPackageDetails.h 
new/yast2-ncurses-pkg-2.22.1/src/NCPkgPackageDetails.h
--- old/yast2-ncurses-pkg-2.22.0/src/NCPkgPackageDetails.h      2012-01-17 
13:28:01.000000000 +0100
+++ new/yast2-ncurses-pkg-2.22.1/src/NCPkgPackageDetails.h      2012-02-29 
10:45:48.000000000 +0100
@@ -61,6 +61,8 @@
 
     string createText( list <string> info, bool oneline );
 
+    string createHtmlText( string description );
+    
     string createRelLine( const zypp::Capabilities & info );
 
     string commonHeader( ZyppObj pkgPtr );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ncurses-pkg-2.22.0/src/NCPkgTable.cc 
new/yast2-ncurses-pkg-2.22.1/src/NCPkgTable.cc
--- old/yast2-ncurses-pkg-2.22.0/src/NCPkgTable.cc      2012-01-17 
13:32:52.000000000 +0100
+++ new/yast2-ncurses-pkg-2.22.1/src/NCPkgTable.cc      2012-02-22 
09:40:43.000000000 +0100
@@ -755,7 +755,6 @@
            // show the patch info
            if (objPtr && slbPtr )
                updateInfo( objPtr, slbPtr, VisibleInfo() );
-           //packager->showPatchInformation( objPtr, slbPtr );
            break;
        default:
            break;

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to