[yast-commit] r67488 - in /trunk/ncurses-pkg/src: NCPkgPackageDetails.cc NCPkgPackageDetails.h
Author: gs Date: Mon Feb 20 13:15:01 2012 New Revision: 67488 URL: http://svn.opensuse.org/viewcvs/yast?rev=67488&view=rev Log: improve displaying of patch description (add paragraphs) Modified: trunk/ncurses-pkg/src/NCPkgPackageDetails.cc trunk/ncurses-pkg/src/NCPkgPackageDetails.h Modified: trunk/ncurses-pkg/src/NCPkgPackageDetails.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgPackageDetails.cc?rev=67488&r1=67487&r2=67488&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgPackageDetails.cc (original) +++ trunk/ncurses-pkg/src/NCPkgPackageDetails.cc Mon Feb 20 13:15:01 2012 @@ -264,6 +264,34 @@ } +string NCPkgPackageDetails::createHtmlParagraphs( string value ) +{ + NCstring input( value ); + NCtext descr( input ); + NCtext html_descr( NCstring( "<p>" ) ); + string description = ""; + + list<NCstring>::const_iterator line; + + for ( line = descr.Text().begin(); line != descr.Text().end(); ++line ) + { + NCstring curr_line( *line ); + if ( curr_line.Str().empty() ) + html_descr.append( NCstring("</p><p>") ); + else + html_descr.append( NCstring(" " + curr_line.Str()) ); + } + html_descr.append( NCstring("</p>") ); + + for ( line = html_descr.Text().begin(); line != html_descr.Text().end(); ++line ) + { + NCstring curr_line( *line ); + description += curr_line.Str(); + } + + return description; +} + bool NCPkgPackageDetails::patchDescription( ZyppObj objPtr, ZyppSel selectable ) { ZyppPatch patchPtr = tryCastToZyppPatch( objPtr ); @@ -301,9 +329,9 @@ // get and format the patch description string value = patchPtr->description(); - descr += "<p>"; - descr += value; - descr += "</p>"; + yuiDebug() << "Patch description: " << value << endl; + + descr += createHtmlParagraphs( value ); descr += _("References:<br>"); for ( Patch::ReferenceIterator rit = patchPtr->referencesBegin(); Modified: trunk/ncurses-pkg/src/NCPkgPackageDetails.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgPackageDetails.h?rev=67488&r1=67487&r2=67488&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgPackageDetails.h (original) +++ trunk/ncurses-pkg/src/NCPkgPackageDetails.h Mon Feb 20 13:15:01 2012 @@ -61,6 +61,8 @@ string createText( list <string> info, bool oneline ); + string createHtmlParagraphs( string description ); + string createRelLine( const zypp::Capabilities & info ); string commonHeader( ZyppObj pkgPtr ); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
gs@svn2.opensuse.org