OPML export ordering and cleanup

Development-related discussion, including bundled plugins
User avatar
gmargo
Bear Rating Disaster
Bear Rating Disaster
Posts: 62
Joined: 08 Jan 2012, 22:33
Location: Silicon Valley

OPML export ordering and cleanup

Postby gmargo » 12 Mar 2012, 21:56

I noticed that the OPML export result does not preserve the user's preferred category and feed ordering.
(I'm not leaving, I just wanted to try something in "liferea".)

I set out to add ordering to the opml export function, which was relatively easy,
but then I started fiddling with the output format to get a prettier output.
Plus a few other edits, so I submit this opml export cleanup for your consideration.

All of the following changes are contained in the attached patch to opml.php.
I could lay them out as several sequential patches for each individual change if you prefer.

1. Category and Feed ordering are now preserved.
2. Pretty Printing. Added indentation and lots of newlines. Output looks quite nice now.
3. Sort preference settings by name.
4. Source code indentation: spaces to tabs.
Seven lines of code were indented with spaces instead of tabs.
(Of those 7, four matched tabstop=8 and three matched tabstop=4.)
One line of code had a leading space.
5. Vim syntax: made a purely cosmetic change so the vim syntax highlighter wouldn't get confused.
In the xml declaration I separated a "?>" into two separate strings "?".">" so vim would not think it was malformed PHP.

Edit: Oops... missed a spot. Uploading new patch in a minute.... Done. Version 2 uploaded.
Attachments
opml_export_cleanup_v2.patch.gz
OPML export ordering and cleanup patch, version 2
(1.58 KiB) Downloaded 126 times
Last edited by gmargo on 12 Mar 2012, 23:48, edited 2 times in total.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: OPML export ordering and cleanup

Postby fox » 12 Mar 2012, 23:09

Thanks, you are really working a lot on this. :) I'll take a look tomorrow.

This vim breakage has been annoying me for a while, btw, I didn't figure out how to fix it.

User avatar
gmargo
Bear Rating Disaster
Bear Rating Disaster
Posts: 62
Joined: 08 Jan 2012, 22:33
Location: Silicon Valley

Re: OPML export ordering and cleanup

Postby gmargo » 19 Mar 2012, 23:13

I've updated the method of "pretty printing" the OPML output. The patch above did the indentation manually because at the time I could not get "saveXML()" to do what I wanted. I've managed that now, so the indentation code is less obtrusive.

Give me a day to get it cleaned up and I'll submit some new patches.

User avatar
gmargo
Bear Rating Disaster
Bear Rating Disaster
Posts: 62
Joined: 08 Jan 2012, 22:33
Location: Silicon Valley

Re: OPML export ordering and cleanup

Postby gmargo » 21 Mar 2012, 22:00

Here are the new patches for opml.php. I've split the changes into five patches so they are easier to review.
They should be applied in numerical order since a few lines were affected by multiple patches.

Oops, I just found out that only 3 attachments are allowed, so I will post patches 4 and 5 in the next entry.
Attachments
0003-OPML-cleanup-Sort-preference-settings.patch.gz
Patch to sort the preference settings.
(599 Bytes) Downloaded 111 times
0002-OPML-cleanup-Cosmetic-change-to-support-Vim-syntax-h.patch.gz
Patch to help Vim syntax highlighting.
(612 Bytes) Downloaded 100 times
0001-OPML-cleanup-Fix-whitespace-in-code.patch.gz
Patch to fix whitespace in the code.
(1001 Bytes) Downloaded 113 times

User avatar
gmargo
Bear Rating Disaster
Bear Rating Disaster
Posts: 62
Joined: 08 Jan 2012, 22:33
Location: Silicon Valley

Re: OPML export ordering and cleanup

Postby gmargo » 21 Mar 2012, 22:01

The rest of the patches...
Attachments
0005-OPML-cleanup-Pretty-printing.patch.gz
Patch to Pretty Print the XML output.
(1.55 KiB) Downloaded 109 times
0004-OPML-cleanup-Preserve-Category-Feed-ordering.patch.gz
Patch to preserve Category & Feed ordering.
(720 Bytes) Downloaded 117 times


Return to “Development”

Who is online

Users browsing this forum: No registered users and 3 guests