Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Publicaciones sobre programming (publicaciones antiguas, página 17)

Using TinyURL in python

Is­n't this neat?

import urllib

def makeTiny(url):

  url='http://tinyurl.com/api-create.php?'+urllib.urlencode({'url':url})
  return urllib.urlopen(url).read()

>>> makeTiny('http://www.kde.org')
'http://tinyurl.com/3cnthx'

Son of bartleblog XI: the highlight of the syntax

I had a few min­utes wait­ing for yum to do its thing and added a cou­ple of easy fea­tures:

bartleblog9

The Sil­verCi­ty-based code-block syn­tax high­light­ing di­rec­tive was re­placed with a ver­sion us­ing Pyg­ment which sup­ports more lan­guages and is (I think) nicer look­ing... and comes with sev­er­al styles, as you can see above in the con­fig­u­ra­tion di­a­log.

Oth­er than that, I added sup­port in the back­end to:

  • Re­­gen­er­ate HTML from RST ev­ery­where

  • Do the same on­­ly on items marked "dirty"

  • A mod­­el thingie that shows if there are posts or sto­ries with RST er­rors

  • Some GUI love

I need to make the con­fig di­a­log sup­port more than one gad­get at the same time, though ;-)

Son of Bartlebog VII: the nuclear test site

A lot of new fea­tures go­ing on, like openo­my based file up­load­ing and links that work like sim­ple rst di­rec­tives:

.. openomy:: my-file.ext

And you should get a link to the file, stored in the 1GB the openo­my guys kind­ly pro­vide.

Al­so, you can ac­tu­al­ly see how the test site looks at //ralsi­na.me/we­blog (us­ing the ex­act same da­ta as this one).

I ac­tu­al­ly up­load al­most ev­ery change I do, so it breaks of­ten ;-)

Son of Bartleblog VI: The flickr directive

I added a Re­struc­tured Text di­rec­tive that takes as ar­gu­ment the ti­tle of one of your (my) flickr pic­tures, like this:

.. flickr:: pa120071

And pro­duces this:

Which is much nicer than my im­ages have looked for a while.

It can still be im­proved, prob­a­bly add a cap­tion, link to im­age com­ments if avail­able, etc.

The bad side is that if you don't have in­ter­net ac­cess the ren­der­ing fail­s.

Son of bartleblog 5: Menus

Added a Ya­hoo! Ui menubar gen­er­a­tor. It turns this:

a
b
c
 1
 2
  x
  y
d

In­to this:

bartleblog4

Or this if you are us­ing links:

bartleblog5

Or rather in­to this, which ex­plains why it's nec­es­sary (con­sid­er this is a very sim­ple menu!):

Still some miss­ing fea­tures, but a neat thingie al­ready.


Contents © 2000-2024 Roberto Alsina