Skip to content

{ Author Archives }

Extending Parsedown: attributes

Markdown Extra (including Parsedown Extra) allows for attributes to be applied to certain elements: headers, fenced code blocks, links, and images. I'd like to be able to apply them to any element. I'm going to use the syntax of Python Markdown attributes, but the attribute lists go before the elements. For block level elements, they […]

Extending Parsedown: Block elements

Continuing work on extending Parsedown. See the actual code. Adding block-level elements is not much different from adding inline elements. Kavanot.name originally used <footer> elements to indicate the source of a block quote: <blockquote> Do or do not. There is no try. </blockquote> <footer>Yoda</footer> </blockquote> While marking blockquotes this way is now acceptable, for a […]

Extending Parsedown: Inline elements

Extending Parsedown involves adding elements to the $InlineTypes and $BlockTypes arrays, then adding methods to handle them. See the actual code. Italics I use <i> a lot, to indicate transliterated words. So I use could use "/" to indicate that: /Shabbat/ is a Hebrew word becomes <i>Shabbat</i> is a Hebrew word. To do that: do […]

String Replacement in PHP

Working with Parsedown, I want to string manipulation but only in certain parts. For instance, on text not in HTML tags or not in quotes. The right way to do that is with a real parser. The easy way is by removing the unwanted strings, replacing them with a marker that won't come up in […]

Extending Parsedown

I've been spending all my intellectual free time on working on my Kavanot site, so I haven't been doing any independent programming. But that site uses raw HTML, which is a pain to type. So I decided to start using Markdown to make writing easier. After a little trial and error, I decided to use […]

H&R Block Updating Errors

(It's been almost a year since I've posted. My intellectual life is busy with other things) I use H&R Block software to prepare my taxes and have been generally very happy, but this year it would not update the program after January 1. Using the automatic update downloaded the updater but it silently failed. Manually […]

‘ob_gzhandler’ conflicts with ‘zlib output compression’

Nearly Free Speech has been a great hosting service, and they upgrade the stack consistently, which usually doesn't cause problems. But with the most recent upgrade, I started getting the above error. Looks like they turned on compression at the server level, so doing it on each page is redundant. Evidently they announced it on […]

Amazon Wish List Hack on github

I've put an Amazon Wishlist Widget for WordPress on my github site, that uses the techniques described before. You can see it running on the sidebar here.

Getting multiple pages in the Amazon Wish List

I figured out how to get all the pages from screen-scraping the Amazon wish list. Basically, look for the "Next" button (it's in a <li class=a-last> element). If that element is present, look for the next page. function getwishlistitems ($listID, $page=1){ // ignore parsing warnings $wishlistdom = new DOMDocument(); @$wishlistdom->loadHTMLFile("http://www.amazon.com/gp/registry/wishlist/$listID?disableNav=1&page=$page"); $wishlistxpath = new DOMXPath ($wishlistdom); […]

Hacking My Way Again to an Amazon Wishlist Widget

Amazon long ago elminated its API for getting wishlists. 4 years ago I made a screen-scraping WordPress widget to display my wishlist. Unfortunately, as happens with screen-scraping, Amazon changed their format and URL's. And now I can't seem to get the ItemLookup API to work either. doitlikejustin has a vanilla PHP wishlist scraper, but PHP […]