Posts Tagged With 'quoted forsooth'

Flask-Markdown bug

Written by Tracy Poff in misc on Wed 07 October 2015. Tags: quoted forsooth, flask-markdown,

I encountered a mysterious bug in Flask-Markdown: footnotes in one document were polluting others. I noticed footnotes being duplicated in a markdown-formatted sidebar, and then I found them showing up on new pages altogether.

The (approximate) cause was obvious: markdown was keeping state between different renders.

It turns out that Python-Markdown allows you to instantiate a renderer with options set and reuse that, if you choose, and Flask-Markdown takes advantage of this. However, when using Python-Markdown in that way, you need to reset() the instance between renders.

Solution: change line 69 of Flask-Markdown’s markdown.py from:

        return Markup(self._instance.convert(stream))

to

        return Markup(self._instance.reset().convert(stream))

Simple.

Unfortunately, it looks like the maintainer of Flask-Markdown hasn’t been active on github in quite a while, so this problem may persist.


Building a Better Mousetrap

Written by Tracy Poff in misc on Tue 06 October 2015. Tags: python, quoted forsooth,

All of my public projects have been suffering, lately (not that I’ve ever been the most constant of writers), because I’ve been working in the background on a tool to aid me in my research.

Some background: Until now, I’ve been collecting my copious notes in wikidPad, a very nice personal wiki application. If all you need is a text-based notebook with some simple formatting and organizational capabilities, it’s great. I recommend it to everyone. My needs are a bit more extreme, though. I’ve currently got notes on about eighteen hundred individual items, along with pages of organizational and planning information. Making use of all the data I have stored in wikidPad was getting to be impossible, and, worse still, some of my notes were scattered in different locations elsewhere due to my needing features not supported by wikidPad.

I’ve tested the various available research notebook tools (Docear, Zotero, Mendeley, ReadCube, Evernote, OneNote, …) but most are heavily oriented toward research artifacts being PDFs (does no one use photographs, or recorded interviews, or anything? just PDFs?), and none had remotely powerful enough metadata and reporting capabilities.

So, I finally bit the bullet and created my own tool. It’s ugly and user-unfriendly right now, but for my purposes it’s already more useful than wikidPad, and I continue adding features as needs arise. The benefit of using custom-built software is that I can readily make any required modifications. If I want to see all of my screenshots of character selection screens for games released between 1987 and 1996, ordered by the name of the developer, with games I’ve never reviewed highlighted in green, I can have that in a couple of minutes. Television episodes about gambling written by people born before 1960? People who starred in movies from the nineties based on games released in the eighties? Games I haven’t beaten developed by defunct companies? Any desired query can be constructed in a few minutes, as long as the information is there. And a lack of information was never my problem.

I don’t know if anyone else would find this useful. The lack of tools that did even remotely what I want seems to indicate that my needs are a bit idiosyncratic. I’ll probably release the code once I’ve got it in a less embarrassing state, all the same.