Saturday, March 29

Geek

New In 1.2: Dump (And Now, Print!)

A couple of hours of hackery and I've added a very useful new tool to Minx: The [dump] tag.

The dump tag comes in five forms: HTML, XML, HTML table, JSON, and text.  What it does is simple: You give it a tag, or a list of tags, and it dumps the tag data in an appropriate format.  The one trick is that if you give it the name of an object, it dumps all the fields and sub-fields for you automatically.

This makes it trivial to write, for example, an export routine.  This will do it:
[posts count=9999]
<post>
[print.xml post]
[comments]
<comment>
[print.xml comment]
</comment>
[/comments]
</post>
[/posts]
Also very handy for writing APIs like, oh, OpenSocial or MetaWeblog.  Should I happen to be considering doing that... wink

Come to think of it, that dump routine would be less than ideal, since it would expand out all the auto-format options.  And there are a lot of those.

Want to see just how much data Minx gives you for a single post?  Hit the extended entry.

Update: Okay, I've added a [print] tag which strips out most of the excess baggage.  So [dump] to get the entire contents of an object, and [print] to get the useful contents.

<post.abstract></post.abstract>
<post.abstract.clean></post.abstract.clean>
<post.abstract.esc></post.abstract.esc>
<post.abstract.raw></post.abstract.raw>
<post.abstract.text></post.abstract.text>
<post.allow.attach>0</post.allow.attach>
<post.allow.comments>1</post.allow.comments>
<post.allow.pings>1</post.allow.pings>
<post.author>Pixy Misa</post.author>
<post.author.aim></post.author.aim>
<post.author.hash>PiXy!</post.author.hash>
<post.author.icq></post.author.icq>
<post.author.id>1</post.author.id>
<post.author.interests></post.author.interests>
<post.author.location></post.author.location>
<post.author.mail>bloglets@pixymisa.com</post.author.mail>
<post.author.msn></post.author.msn>
<post.author.name>Pixy Misa</post.author.name>
<post.author.nick>Reverend Pixy</post.author.nick>
<post.author.occupation></post.author.occupation>
<post.author.sig></post.author.sig>
<post.author.web>http://ai.mee.nu</post.author.web>
<post.authorlink>&lt;a href="http://ai.mee.nu" rel="nofollow"&gt;Pixy Misa&lt;/a&gt;</post.authorlink>
<post.blurb></post.blurb>
<post.blurb.clean></post.blurb.clean>
<post.blurb.esc></post.blurb.esc>
<post.blurb.raw></post.blurb.raw>
<post.blurb.text></post.blurb.text>
<post.bytes>459</post.bytes>
<post.category>Anime</post.category>
<post.category.desc></post.category.desc>
<post.category.name>Anime</post.category.name>
<post.category.path>anime</post.category.path>
<post.category.tagline></post.category.tagline>
<post.category.type>Category</post.category.type>
<post.categoryid>15</post.categoryid>
<post.cdate>Saturday, March 22</post.cdate>
<post.comment.date>Sunday, March 23</post.comment.date>
<post.comment.datetime>Sunday, March 23 2008 01:16 PM</post.comment.datetime>
<post.comment.day>Sunday</post.comment.day>
<post.comment.month>March</post.comment.month>
<post.comment.shortdate>2008-03-23</post.comment.shortdate>
<post.comment.time>01:16 PM</post.comment.time>
<post.comment.year>2008</post.comment.year>
<post.commented>Sunday, March 23</post.commented>
<post.comments>5</post.comments>
<post.create.date>Saturday, March 22</post.create.date>
<post.create.datetime>Saturday, March 22 2008 10:32 PM</post.create.datetime>
<post.create.day>Saturday</post.create.day>
<post.create.month>March</post.create.month>
<post.create.shortdate>2008-03-22</post.create.shortdate>
<post.create.time>10:32 PM</post.create.time>
<post.create.year>2008</post.create.year>
<post.currently>0</post.currently>
<post.custom></post.custom>
<post.data></post.data>
<post.data.clean></post.data.clean>
<post.data.esc></post.data.esc>
<post.data.raw></post.data.raw>
<post.data.text></post.data.text>
<post.date>Sunday, March 23</post.date>
<post.datetime>Sunday, March 23 2008 03:12 AM</post.datetime>
<post.day>Sunday</post.day>
<post.defer>0</post.defer>
<post.edate></post.edate>
<post.edit></post.edit>
<post.edit.date></post.edit.date>
<post.edit.datetime></post.edit.datetime>
<post.edit.day></post.edit.day>
<post.edit.month></post.edit.month>
<post.edit.shortdate></post.edit.shortdate>
<post.edit.time></post.edit.time>
<post.edit.year></post.edit.year>
<post.edited></post.edited>
<post.editor>0</post.editor>
<post.editor.id>0</post.editor.id>
<post.edits>0</post.edits>
<post.end>Saturday, March 22</post.end>
<post.end.date>Saturday, March 22</post.end.date>
<post.end.datetime>Saturday, March 22 2008 10:32 PM</post.end.datetime>
<post.end.day>Saturday</post.end.day>
<post.end.month>March</post.end.month>
<post.end.shortdate>2008-03-22</post.end.shortdate>
<post.end.time>10:32 PM</post.end.time>
<post.end.year>2008</post.end.year>
<post.etid>142684</post.etid>
<post.even>False</post.even>
<post.excerpt></post.excerpt>
<post.excerpt.clean></post.excerpt.clean>
<post.excerpt.esc></post.excerpt.esc>
<post.excerpt.raw></post.excerpt.raw>
<post.excerpt.text></post.excerpt.text>
<post.expire>0</post.expire>
<post.fid>14</post.fid>
<post.filter></post.filter>
<post.first>True</post.first>
<post.folder.desc>Default default default!</post.folder.desc>
<post.folder.name>Blog</post.folder.name>
<post.folder.path></post.folder.path>
<post.folder.tagline>My default folder!</post.folder.tagline>
<post.folder.type>Blog</post.folder.type>
<post.hidden>0</post.hidden>
<post.id>142684</post.id>
<post.images>0</post.images>
<post.info></post.info>
<post.ip>0</post.ip>
<post.ip.hash>PiXy!</post.ip.hash>
<post.isauthor>True</post.isauthor>
<post.junk>0.0</post.junk>
<post.kbytes>1</post.kbytes>
<post.keywords></post.keywords>
<post.keywords.clean></post.keywords.clean>
<post.keywords.esc></post.keywords.esc>
<post.keywords.raw></post.keywords.raw>
<post.keywords.text></post.keywords.text>
<post.last>False</post.last>
<post.license></post.license>
<post.links>0</post.links>
<post.locked>0</post.locked>
<post.mail>bloglets@pixymisa.com</post.mail>
<post.memo></post.memo>
<post.memo.clean></post.memo.clean>
<post.memo.esc></post.memo.esc>
<post.memo.raw></post.memo.raw>
<post.memo.text></post.memo.text>
<post.meta></post.meta>
<post.meta.clean></post.meta.clean>
<post.meta.esc></post.meta.esc>
<post.meta.raw></post.meta.raw>
<post.meta.text></post.meta.text>
<post.misc></post.misc>
<post.misc.clean></post.misc.clean>
<post.misc.esc></post.misc.esc>
<post.misc.raw></post.misc.raw>
<post.misc.text></post.misc.text>
<post.mod></post.mod>
<post.mod.3>1</post.mod.3>
<post.mod.4>1</post.mod.4>
<post.mod.5>1</post.mod.5>
<post.mod.clean></post.mod.clean>
<post.mod.esc></post.mod.esc>
<post.mod.raw></post.mod.raw>
<post.mod.text></post.mod.text>
<post.month>March</post.month>
<post.mood>0</post.mood>
<post.more></post.more>
<post.more.clean></post.more.clean>
<post.more.esc></post.more.esc>
<post.more.raw></post.more.raw>
<post.more.text></post.more.text>
<post.mpath></post.mpath>
<post.name>Pixy Misa</post.name>
<post.new.date>Sunday, March 23</post.new.date>
<post.newdate>Sunday, March 23</post.newdate>
<post.notes></post.notes>
<post.notes.clean></post.notes.clean>
<post.notes.esc></post.notes.esc>
<post.notes.raw></post.notes.raw>
<post.notes.text></post.notes.text>
<post.number>1</post.number>
<post.odd>1</post.odd>
<post.page>0</post.page>
<post.path>sketchbook_full_color_apostrophes</post.path>
<post.pdate>Sunday, March 23</post.pdate>
<post.pid>931045</post.pid>
<post.ping.date></post.ping.date>
<post.ping.datetime></post.ping.datetime>
<post.ping.day></post.ping.day>
<post.ping.month></post.ping.month>
<post.ping.shortdate></post.ping.shortdate>
<post.ping.time></post.ping.time>
<post.ping.year></post.ping.year>
<post.pinged></post.pinged>
<post.pings>0</post.pings>
<post.plocked>0</post.plocked>
<post.pmpath></post.pmpath>
<post.ppath></post.ppath>
<post.prev.date></post.prev.date>
<post.published></post.published>
<post.rating>0.0</post.rating>
<post.reads>0</post.reads>
<post.reply></post.reply>
<post.reply.clean></post.reply.clean>
<post.reply.esc></post.reply.esc>
<post.reply.raw></post.reply.raw>
<post.reply.text></post.reply.text>
<post.search></post.search>
<post.shortdate>2008-03-23</post.shortdate>
<post.show.bbcode>1</post.show.bbcode>
<post.show.dict>0</post.show.dict>
<post.show.flag>0</post.show.flag>
<post.show.html>1</post.show.html>
<post.show.macro>0</post.show.macro>
<post.show.sig>0</post.show.sig>
<post.show.smilies>1</post.show.smilies>
<post.show.ttags>0</post.show.ttags>
<post.site.desc>Zerg rush!</post.site.desc>
<post.site.host>ai.mee.xx</post.site.host>
<post.site.name>Ambient Irony</post.site.name>
<post.site.short></post.site.short>
<post.site.tagline>Little blogses made out of ticky-tacky...</post.site.tagline>
<post.site.type>0</post.site.type>
<post.start>Saturday, March 22</post.start>
<post.start.date>Saturday, March 22</post.start.date>
<post.start.datetime>Saturday, March 22 2008 10:32 PM</post.start.datetime>
<post.start.day>Saturday</post.start.day>
<post.start.month>March</post.start.month>
<post.start.shortdate>2008-03-22</post.start.shortdate>
<post.start.time>10:32 PM</post.start.time>
<post.start.year>2008</post.start.year>
<post.status>Publish</post.status>
<post.sticky>0</post.sticky>
<post.style>0</post.style>
<post.subject></post.subject>
<post.subject.clean></post.subject.clean>
<post.subject.esc></post.subject.esc>
<post.subject.raw></post.subject.raw>
<post.subject.text></post.subject.text>
<post.system>0</post.system>
<post.tags></post.tags>
<post.tags.clean></post.tags.clean>
<post.tags.esc></post.tags.esc>
<post.tags.raw></post.tags.raw>
<post.tags.text></post.tags.text>
<post.template>0</post.template>
<post.text>Azumanga Daioh, if all the girls were
Osaka.&lt;br&gt;&lt;br&gt;Which you can take as a recommendation or a
warning, according to taste.&lt;br&gt;&lt;br&gt;Update: Just finished
watching it, and I have to say that Azumanga Daioh where all the girls
are Osaka is really really good.&lt;br&gt;&lt;br&gt;It's a quiet and
somewhat slow-moving series, something you probably need to be in the
right mood to enjoy, but if you are in that mood, highly
recommended.&lt;br&gt;</post.text>
<post.text.clean>Azumanga Daioh, if all the girls were
Osaka.&lt;br&gt;&lt;br&gt;Which you can take as a recommendation or a
warning, according to taste.&lt;br&gt;&lt;br&gt;Update: Just finished
watching it, and I have to say that Azumanga Daioh where all the girls
are Osaka is really really good.&lt;br&gt;&lt;br&gt;It's a quiet and
somewhat slow-moving series, something you probably need to be in the
right mood to enjoy, but if you are in that mood, highly
recommended.&lt;br&gt;</post.text.clean>
<post.text.esc>Azumanga Daioh, if all the girls were
Osaka.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Which you can take as a
recommendation or a warning, according to
taste.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Update: Just finished
watching it, and I have to say that Azumanga Daioh where all the girls
are Osaka is really really
good.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;It's a quiet and somewhat
slow-moving series, something you probably need to be in the right mood
to enjoy, but if you are in that mood, highly
recommended.&amp;lt;br&amp;gt;</post.text.esc>
<post.text.raw>Azumanga Daioh, if all the girls were
Osaka.&lt;br&gt;&lt;br&gt;Which you can take as a recommendation or a
warning, according to taste.&lt;br&gt;&lt;br&gt;Update: Just finished
watching it, and I have to say that Azumanga Daioh where all the girls
are Osaka is really really good.&lt;br&gt;&lt;br&gt;It's a quiet and
somewhat slow-moving series, something you probably need to be in the
right mood to enjoy, but if you are in that mood, highly
recommended.&lt;br&gt;</post.text.raw>
<post.text.text>Azumanga Daioh, if all the girls were Osaka. Which you
can take as a recommendation or a warning, according to taste. Update:
Just finished watching it, and I have to say that Azumanga Daioh where
all the girls are Osaka is really really good. It's a quiet and
somewhat slow-moving series, something you probably need to be in the
right mood to enjoy, but if you are in that mood, highly recommended.</post.text.text>
<post.tid>142684</post.tid>
<post.time>03:12 AM</post.time>
<post.title>Sketchbook: Full Color Apostrophes</post.title>
<post.title.clean>Sketchbook: Full Color Apostrophes</post.title.clean>
<post.title.esc>Sketchbook: Full Color Apostrophes</post.title.esc>
<post.title.raw>Sketchbook: Full Color Apostrophes</post.title.raw>
<post.title.text>Sketchbook: Full Color Apostrophes</post.title.text>
<post.tlocked>0</post.tlocked>
<post.topic>Sketchbook: Full Color Apostrophes</post.topic>
<post.type>Post</post.type>
<post.udate>Sunday, March 23</post.udate>
<post.update.date>Sunday, March 23</post.update.date>
<post.update.datetime>Sunday, March 23 2008 01:16 PM</post.update.datetime>
<post.update.day>Sunday</post.update.day>
<post.update.month>March</post.update.month>
<post.update.shortdate>2008-03-23</post.update.shortdate>
<post.update.time>01:16 PM</post.update.time>
<post.update.year>2008</post.update.year>
<post.url>http://ai.mee.xx/sketchbook_full_color_apostrophes</post.url>
<post.version>0</post.version>
<post.warn></post.warn>
<post.warn.clean></post.warn.clean>
<post.warn.esc></post.warn.esc>
<post.warn.raw></post.warn.raw>
<post.warn.text></post.warn.text>
<post.web>http://ai.mee.nu</post.web>
<post.words>76</post.words>
<post.xid></post.xid>
<post.xml></post.xml>
<post.xml.clean></post.xml.clean>
<post.xml.esc></post.xml.esc>
<post.xml.raw></post.xml.raw>
<post.xml.text></post.xml.text>
<post.xsticky>0</post.xsticky>
<post.year>2008</post.year>

Posted by: Pixy Misa at 02:26 PM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 910 words, total size 18 kb.

Comments are disabled. Post is locked.
57kb generated in CPU 0.03, elapsed 0.1557 seconds.
50 queries taking 0.1336 seconds, 275 records returned.
Powered by Minx 1.1.6c-pink.