Friday, 27 September 2013

Zoundry Raven: Preventing Double Line Spacing In Blogger.com

Enable "Remove Newlines" To Avoid Getting Double Line Spacing Between Paragraphs In Blogger.com

I have to enable the "Remove Newlines" option, found in the "Account Manager" dialog box, when publishing my blog post to Blogger.com. If I do not, I will get double line spacing between paragraphs.

Saturday, 21 September 2013

Zoundry Raven: Inserting Amazon Affiliate "iframe" Ads

With This Modification, There Should Be A New Version For Zoundry Raven

The offline blog editor Zoundry Raven converts my Amazon Affiliate "<iframe><iframe/>" tags to "<iframe/>" upon publishing my blog posts. As a consequence, my Amazon Affiliate "iframe" ads do not get displayed correctly when viewed from the Opera desktop and Opera Mini web browsers, and perhaps on other web browsers too. What puzzles me though is that Raven displays these ads correctly while editing - albeit the ad must be inserted at the end of a blog post and no editing is allowed in the "Design" tab after these ads have been inserted. I wonder why?

The Problem

After having successfully installed the development environment, I went about searching and digging into Raven's source code and I managed to narrow down the problem to the 4Suite XML processing library that Raven uses.

For any XML tags containing empty element (elements are the text between the opening and closing tags), the tag will be represented as a single tag ended with a slash in 4Suite. Amazon Affiliate "iframe" ads have empty elements and hence, self-terminating "iframe" tags upon publishing.

My Work-around

To enable me to insert these "iframe" ads, what I did is to filter my blog post through uTidyLib just before publishing so that any invalid HTML tags generated by 4Suite will be corrected by uTidyLib (uTidyLib is just a wrapper for TidyLib, and TidyLib is just a library version of Dave Raggett's HTML Tidy, a program that fixes invalid HTML markups). To achieve this, I added 3 extra lines of code (enclosed between "# ---- START ----" and "# ---- END -----" in the code below) to the function _transformContentForPublishing in the file "zoundry\blogapp\services\pubsystems\blog\blogpublisher.py".