Summary: | akregator article view doesn't display <pre> passages correctly | ||
---|---|---|---|
Product: | [Applications] akregator | Reporter: | Sandro Giessl <sgiessl> |
Component: | general | Assignee: | Sashmit Bhaduri <smt> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | akregator-devel |
Priority: | VHI | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Sandro Giessl
2004-06-27 18:37:24 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 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("<pre>(.+)</pre>", 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", "<br/>"); + + 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; 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? |