Bug 84095 - akregator article view doesn't display <pre> passages correctly
Summary: akregator article view doesn't display <pre> passages correctly
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: VHI normal
Target Milestone: ---
Assignee: Sashmit Bhaduri
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-27 18:37 UTC by Sandro Giessl
Modified: 2007-02-14 15:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sandro Giessl 2004-06-27 18:37:24 UTC
Version:           1.0-beta3 "Teemu" (using KDE 3.2.90 (3.3 alpha1, CVS >= 20040522), compiled sources)
Compiler:          gcc version 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)
OS:                Linux (i686) release 2.6.3

Akregator seems to be unable to display <pre></pre> code passages: Line breaks are removed, so the whole text is one huge line which is usually cut at the end.
There are a few articles in the Planet KDE feed where this can be seen.
Comment 1 Sashmit Bhaduri 2004-07-07 17:04:46 UTC
Hmm.. khtml doesn't support CSS 2.1 white-space: pre-wrap (or mozilla's -moz-pre-wrap, opera's -o-pre-wrap, or IE's word-wrap: break-word. 

Hopefully we can hack that into khtml in kde 4.0.

Until then, we could do a number of things:
- not show pre tags at all (display: none them)
- show pre tags without formatting (white-space: normal)
- keep as is
Comment 2 Stanislav Karchebny 2004-07-17 17:23:05 UTC
CVS commit by karchebny: 

* Fix formatting of <pre> contents.

CCMAIL: 84095-done@bugs.kde.org


  M +18 -3     loader.cpp   1.7


--- kdenonbeta/akregator/src/librss/loader.cpp  #1.6:1.7
@@ -258,4 +258,6 @@ const KURL &Loader::discoveredFeedURL() 
 }
 
+#include <kdebug.h>
+
 void Loader::slotRetrieverDone(const QByteArray &data, bool success)
 {
@@ -284,6 +286,20 @@ void Loader::slotRetrieverDone(const QBy
       }
 
-      QByteArray tmpData;
-      tmpData.setRawData(charData, len);
+      QCString tmpData(charData, len);
+      
+      // hack: support formatting inside <pre> tags
+      QRegExp pres("&lt;pre&gt;(.+)&lt;/pre&gt;", false);
+      pres.setMinimal(TRUE);
+      int pos = 0;
+      while( (pos = pres.search(tmpData, pos)) != -1 )
+      {
+        int len = pres.matchedLength();
+        
+        QCString str = tmpData.mid(pos, len);
+        str.replace("\n", "&lt;br/&gt;");
+        
+        tmpData.replace(pos, len, str);
+        pos += len;
+      }
 
       if (doc.setContent(tmpData))
@@ -302,5 +318,4 @@ void Loader::slotRetrieverDone(const QBy
       }
       
-      tmpData.resetRawData(charData, len);
    } else
       status = RetrieveError;


Comment 3 Tap 2007-02-14 15:45:25 UTC
This bug seems to have reappeared in a slightly different form since 2004; Akregator now matches pre tags literally instead of allowing for attributes to be added, breaking feeds like this one [1], which uses class="literal-block" in its pre tags. Currently that feed has a post titled "C is not Python" where the example code renders all on one line.

I am using Akregator 1.2.5 from KDE 3.5.5, but I looked at the changelog to KDE 3.5.6 and didn't see any fix like this mentioned.

[1] http://feeds.feedburner.com/LateralOpinion

P.S.: I can't figure out how to set the bug status back to open. Is it better to file a separate bug instead?