Michal Čihař - Archive for Jan. 12, 2012

Tiny blog improvements

Finally, I've found some time to do some improvements on this blog engine.

First thing which was more and more missing is reasonable content for description in HTML headers. This lead to sites like Google+ always fetch the constant text and that did not look that. So now, there is something really relevant to the content, either first paragraph (what is the case for all old entries) or something I can manually edit (in case I won't be too lazy).

For automatic extraction I tried several approaches. First attempt was simply extracting first paragraph from Markdown, however I quickly remembered that quite a lot of older posts were written directly in HTML, which made this big failure. Later trying BeautifulSoup on rendered HTML, what lead to missing spaces around text which was originally in links. Finally I discovered html2text, which worked pretty easily and does what I need.

In the end the code looks like following:

def get_auto_summary(self):
    h2t = html2text.HTML2Text()
    h2t.body_width = 0
    h2t.ignore_images = True
    h2t.ignore_links = True
    h2t.ignore_emphasis = True
    text = h2t.handle(self.body.rendered)
    return text.splitlines()[0]

Other change affects Flattr, as providing Flattr links for each posts is now possible even without javascript (it's called Auto-submit URL), I've decided to implement them this way. Let's see how many things will get on Flattr this way (at least it will give me better indication what somebody considered being useful). Thanks for commenters on my older blog post for hints.

Call for translations of phpMyAdmin 3.5

First phpMyAdmin's alpha release for 3.5 is out for some time and it's best time to start translating if you want to be on time for final release.

For information about translating, check our website, in short you can translate either offline (get file from Git, translate and post it to translations tracker) or use online translation system available here:

https://l10n.cihar.com/projects/phpmyadmin/

As you can see in the summary, there is lot of new or changed strings, many of the new ones coming from advisor. I suggest you to keep these as last to translate as there is quite lot of them and it is more important to have translated rest of application. The advisor messages are placed at the end of po file.

I believe we can reach good amount of complete translations by final release with your contributions!

PS: You can expect me again to publish translations stats on this blog as we're heading to release.