Older blog entries for ralsina (starting at number 682)

Nikola 5.2 released!

I am thrilled to announce that you can now download Nikola 5.2. a new version of my static blog/site generator.

What's new in this version? A LOT. Don't let the minor version tick fool you, this version is packed with goodness. Let's start with features:

You can easily embed more content:

  • New vimeo directive for restructured text.
  • Custom "gist" directive providing reStructured text support for GitHub gists.

You can write your content in almost any markup:

  • Textile markup support.
  • Creole Wiki markup support.
  • txt2tags markup support.
  • bbcode markup support.
  • And of course, it still supports reStructured text, Markdown and HTML.

More languages:

  • New Catalá translation
  • New polish translation.
  • New Simplified Chinese translation.
  • Use multilingual Disqus (although it doesn't seem to work)

You can import your data:

  • New Blogger/Blogspot importer
  • Much improved Wordpress importer
  • Extract metadata from filename by using regexp (helpful for importing from octopress or other systems).

You can do fancier and more configurable sites:

  • One-page, dynamic-loading, client-rendered site plugin (task_mustache)
  • Recursive post/story folders
  • New COMMENTS_IN_GALLERIES and COMMENTS_IN_STORIES options.
  • Local search based on Tipue (extra_plugins/task_localsearch)
  • Added comments to image galleries
  • New option RSS_TEASERS
  • New STORY_INDEX option to generate index.html in story folders.
  • Add multi size favicon support.

You can use Python 2.6 or higher ... including Python 3. The only missing bit for full Python 3 support is Google sitemap generation.

And of course, a lot of bugs got smashed:

  • Added sane defaults for most options, so you can have a lean config file.
  • Made layout of the site theme responsive, with collapsing navbar.
  • Use timeline instead of parsing post_pages in generic_page_renderer and task_render_pages.
  • Updated disqus integration code, added identifiers so it works on any URL.
  • Make sure folder links end in "/" in the gallery code.
  • Removed copy of PyRSS2Gen, made it a dependency.
  • Detect "namespace" dependencies for Mako templates.
  • Use consistent encodings in RSS feeds.
  • Refactored disqus code into separate helpers
  • Use the correct extension (or raise an error) on new_post
  • Fix titles that include quotes
  • Updated to current CSS from docutils (was using version from 2005)
  • Avoid needless regeneration of gallery indexes.
  • Always ensure the folder for the new post exists.
  • Get title from filename if not available in metadata.
  • Don't copy sources if they end in ".html"
  • Don't link to unexisting translations.
  • Sort tags case insensitive.

Enjoy!

Syndicated 2013-02-06 20:37:56 from Lateral Opinion

Siempre que pasa un tren.

Escuchando "Mi Gin Tonic" de Calamaro con mi señora, escuchamos "Hay un deseo que pido siempre que pasa un tren". Me río, digo "Ese verso es una pancheza", y ella me aclara que cuando estás en el andén y pasa el tren, hay que pedir un deseo.

Jamás había oído hablar de esa superstición, y entonces caigo: es porque en Santa Fe nunca pasa el tren. Esto me abre la puerta a inventar supersticiones hiperlocales, como "cuando te mea una catinga indica futuro infortunio en el amor", o "el paso del camalote predice el clima". O, como decía mi vieja, "si cruzan los sirirís, viene tormenta".

Los dejo con Calamaro:

Syndicated 2013-02-01 12:45:12 from Lateral Opinion

Lunch-hour feature in Nikola: Blogger import

Today at lunch, I added support for importing blogger (maybe also blogspot? They seem to be the same nowadays) blogs into Nikola my static blog/site engine.

What works?

Well, the only site I tried works, mostly.

  • Posts
  • Pages
  • Tags
  • Drafts
  • Blog Metadata (except language)
  • Redirects to keep URLs stable (at least it tries really hard!)
  • URL rewriting in the posts (it tries!)
What's not there?
  • Comments import (it makes more sense to import them via Disqus' import tool)
  • Attachments (images and such)
  • Much testing

It's basically on par with the Wordpress import, except noone has used it for real. So, feel free to try!

(It's nikola import_blogger name_of_the_dump.xml)

Syndicated 2013-01-30 17:26:38 from Lateral Opinion

The Rest Of San Francisco

I wrote about the trip and the segway tour a while ago. But that's not all that happened in San Francisco, of course.

I forgot to mention that on one of the airports there was a display of antique boardgames:

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010149.JPG

Alejandro Cura would have broken that glass, and tried to play while the police chased him.

I didn't know San Francisco had a sign-in-the-hill like Hollywood

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010150.JPG

Not quite as glamorous.

The Segway trip ended in a ... rather scenic place:

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010182.JPG

Old ship... check.

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010183.JPG

Skyline... check.

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010172.JPG

Alcatraz... check.

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010174.JPG

Bridge view... check.

So there I said goodbye to my steel pony, good old seggcrates, and went out for a walk.

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010175.JPG

Argentines-only joke:

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010186.JPG

La foto con la estatua del lobo marino!

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010187.JPG

The sea lion colony at the piers.

We had a grilled cheese sandwich, went to the hotel, yadda yadda yadda. The next day was our last day off. We had a car. So we went to ... Fry's! We got a metric crapload of gadgets, including a tiny USB battery, a powered 7 port USB hub, beef jerky, usb flash drives, SD cards, cables, a sim card, a camera, a Nexus 7, a backpack, and other stuff.

https://pbs.twimg.com/media/BBdo5ejCAAABehE.jpg:large

Some of the aforementioned gadgetry.

After fighting for two hours to get a phone with a data plan, we sailed off, guided by google maps and EDGE. Yes EDGE. It worked, though!

We had a very vague notion about heading north, into San Francisco, across the Golden Gate into who knows where (ended up being Napa Valley).

So, we started, and found ourselves into (I think) the Presidio Park, which is lovely but the pictures are in Lucio's camera, so it's up to him to post a link to them in the comments. emade And of course, the Golden Gate. Which is a very photogenic piece of iron. So we got off the car, at the parking lot, and saw this:

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010191.JPG

Saved! Ka-ching!

A little walk through a fort...

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010199.JPG

And there it was.

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010207.JPG

Of course I took a ton of pictures. The rest is in the gallery if you want to take a look.

So, we got a cup of ghastly coffee, got back in the car and set across the bridge.

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010210.JPG

Yes, I should straighten it.

Then there are some hills, and this cute tunnel:

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010218.JPG

Nice landscapes, in a surprisingly rural area 15 minutes off the city.

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010226.JPG

Really rural.

Then the infamous homemade jerky incident happened.

nota mental: contarle a mis nietos que no comi beef jerky casero por culpa de @ralsina

— Lucio Torre (@luciotorre) January 22, 2013

System Message: WARNING/2 (<string>, line 129)

Explicit markup ends without a blank line; unexpected unindent.

<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

So, homemade-jerky-less we continued into the Sonoma Valley, and got to the Viansa Winery where we stopped for a taste (Lucio, I don't drink. Also, I don't drive so just a taste).

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010250.JPG

In your face, instagram!

It's a really nice place. Lovely handrails, too.

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010242.JPG

I mean, lovely handrails.

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010240.JPG

This part was closed, boo!

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010262.JPG

Lovely views.

We got some souvenirs, some picnic supplies (salami, cheese, olives, Pellegrino lemonade, crostini), and started off again. We forgot to reset the GPS so instead of going back, we kept forward into Napa Valley. And we got to some vintner's monument which closes at sunset. Right on time.

http://ralsina.com.ar/static/galleries/san_francisco_2013/P1010299.JPG

The images don't capture the scale of the thing. Or the cold.

We got back via Oakland, at night which means there's no more pictures. I was shocked to find out that not only does ask.com still exist, but that they pay for billboards with inane questions in them.

The rest of the trip was basically work, with dinner excursions. We had american (Cheesecake Factory), lebanese (at tannourine ok, sort of boring), and .... mongolian at Little Sheep Hot Pot.

At the mongolian restaurant none thought of bringing a camera, so the only picture that exists is taken with a Nexus 7's front-facing camera. Since the Nexus has no camera app, I had to take it using twitter. I am ashamed.

https://pbs.twimg.com/media/BA3zabACcAA1fTa.jpg:large

Yes, worst picture ever.

So, what is that? You get a pot of soup which is about 40% garlic, 40% pepper, 20% unknown things, and you check boxes in a menu for things to dip and cook in them. Since we are adventurous nerds, we included:

  • Rice and pig blood cakes (tastes exactly like a rice and morcilla sandwich)
  • Goose intestines (taste like intestines)
  • Assorted mushrooms
  • Assorted meatballs (including beef tendon meatballs (taste like nothing))
  • Assorted seafood
  • Assorted beef slices (looks creepy, taste as beef)

and a ton of other stuff. The bad side of it is that after a while it all has exactly the same taste: hot, spicy soup. The good side: it's fun to eat, and filling.

We had a last shopping spree a few days later, (I got shirts, 24 pairs of socks, a suitcase to put all the things I could not fit in the old one), and I started back alone to Argentina (Lucio stayed).

The return trip was complicated.

  • I forgot the carryon suitcase in the airline's desk, so I had to do the security check twice.
  • I didn't know the checked-in suitcase was headed to Buenos Aires directly, so I tried to check it out and back in, and thought I had lost it. Of course, not lost, but I paid 5 dollars for a cart I used for 5 meters.
  • Dallas->Ezeiza plane got delayed because it was "too full" (WAT?)
  • Forgot my passport in the backseat pocket, so I had to run across Ezeiza twice to get it back, got so flustered and nervous my blood pressure spiked. Not fun.
  • Got stopped at customs because I had not declared my laptop on the way out. Luckily, I talked my way out of it.

But got back, was fun, and very useful in the work-related bits.

Syndicated 2013-01-26 12:22:56 from Lateral Opinion

Refreshed rst-cheatsheet

A while ago, I created a 2-page PDF version of the restructured text quickstart meant to be printed, folded in half and kept handy until you finally remember how to do footnotes (10 years and still waiting, in my case).

It was brought to my attention that the github project did not mention how to build it. Then I noticed that not only it didn't explain that, it was also missing critical files.

So, I added the files, fixed a couple of things that were not working perfectly with the latest rst2pdf and there is now a fresh PDF ready for you!

Syndicated 2013-01-24 09:54:25 from Lateral Opinion

Nikola Can Parse That

Just for completeness' sake I have gone over Wikipedia's list of lightweight markup languages and added support in Nikola (a static site and blog generator) for a couple of them: BBCode and txt2tags, which brings the number of supported markup formats to 7 (the others are reStructured text, markdown, HTML, textile and Wiki).

Of the list of markup languages, the only missing ones with a Python implementation are AsciiDoc and Markdown Extra.

Why bother with this? It's not as if there was someone asking for BBCode support. However, one of the uses I want to support is archiving sites. Suppose you have a forum you want to shut down? I want you to be able to archive it (even if it's some work) and keep the data out there. A wiki? Same thing.

This is a first step in that direction.

Syndicated 2013-01-22 17:05:04 from Lateral Opinion

Make Me Talk

One of the things that have helped me be less shy and thus have helped me move forward in life is speaking in public. However, I have been speaking in public very little these last couple of years.

So, make me do it more. I am looking forward to speaking in places I haven't been. If it's not horribly far from Buenos Aires, I may not even ask you to pay for my trip and/or hotel, I will pay for it myself if the event is interesting or the place looks like a fun place to travel to.

I can speak about python, free software in general or other things you may suggest, and I can do it in spanish or in english.

Syndicated 2013-01-21 10:13:49 from Lateral Opinion

Mardel->Retiro->San Isidro->Ezeiza->Dallas->San Francisco

I am at a Canonical thing in San Mateo (right next to San Francisco). Arrived yesterday, and have my last free day today, so I need to get some sightseeing done.

For starters, here's the trip gallery, not very full yet but going to post the as I get them.

But the trip...

I was in Mar del Plata visiting family on thursday, and had tickets for Buenos Aires at midnight. At 9 PM... long distance drivers strike. All buses suspended. Ran to the train station to see if there was a chance of getting one: no tickets for a week. Seriously considering a 500KM taxi ride.

At 11PM... strike suspended! So, get the family, get the bags, get on the bus... no, sorry, you can't get on the bus because you are an idiot and you bought them for the wrong day. Really, I bought tickets for thursday 00:05 not friday 00:05.

In a busy vacation town, at midnight, without tickets... ok, so we bought new tickets for 15 minutes later. If it's a problem you can fix with a given amount of oney, at least that puts a certain value on how uch of a moron yours truly is. I am about 120 dollars worth of moron.

So, new tickets. but they are not (of course) tickets to where I live, they are tickets for BUenos Aires Retiro bus station, which is about 25KM away from home.

So, at 00:30 we get on the bus, at 5:45 we are at retiro, at 6:00 we are on a car, at 6:45 we are at home. At 7:00 I am asleep. At 9:00 I am awake and ready for work!

I work intermittently while packing bags and such, at 5:30PM am on a car to Ezeiza (35km ride). When we are entering the airport, smoke starts coming out of the AC (did I mention that the AC was broken and it's roughly 1.5 hours in bad traffic in 30C, under the sun, to get to the airport? I should have!).

So, apparently the car is on fire, but just a little bit, the smoke goes away, I get off the car, meet Lucio, we do our checkin, I have a cup of coffee, at 10:00 PM I am on the plane.

But we have to wait 30 minutes in the runway because of traffic. Also, the captain mentions that this is the plane's last flight because it's too old and is being sold for scrap. So we are flying in scrap. Also, half the screens don't work, it has a whooping 6 movies you can watch, and ... they have specific starting times. Yes, you say "hey, I feel like atching Taken 2!" and you are presented with a nice sign giving you the option of "want to start watching it even though it started 45 minutes ago, or would you rather wtch it in 63 minutes?".

This was my first trip in American Airlines, is it always like this?

We arrive in Dallas, go through what it feels like twelve security checks, customs checks, dental checks, and we get to the actual USofA. Then Lucio says "OMFG we don't have the same plane to SF!", but it's just that he's looking at the wrong boarding pass.

So, to get to our plane, we get on the monorail, and go to the exact opposite end of the airport, and we get in the plane with 5 minutes to spare. Since I missed dinner in the previous flight being asleep, and breakfast was absolutely pathetic, and the new flight (a 3:50 hours one) includes no meals, I get an apple fritter from Dunkin Donuts.

Oh, apple fritter. I don't know if you really are this delicious, or I am just so hungry, but I loved you. You were so sweet and smooth, so sugary and apple-y, your texture so nice and your size so huge. I did love you, apple fritter. Even if I suspect you gave me food poisoning, it was all worth it. I'll always remember you.

So, we get on a 757 which is completely filthy. I suspect the reason it doesn't fall apart is the willpower of the bazillion dust mites that make a living in the ratty seats. It has 14" CRT screens every few rows, and the view out the window is amazing, so I decide to look out instead.

We get to the airport and we took the monorail, and got to pick our rental car. Given the choice, of course I picked a Blue Nissan Versa! Good Car!

http://heroeswiki.com/images/thumb/b/b2/Nissan_versa.jpg/250px-Nissan_versa.jpg

I know noone remembers, but Heroes 1st season was kinda cool.

We have to get to our Segway tour in 2.5 hours. So we skip the hotel, put the suitcases in the trunk, and head to Fisherman's Wharf. We park, have a meal, walk there, are early, get a cup of coffee, get on the segways, and had a ton of fun.

http://ralsina.com.ar/galleries/san_francisco_2013/P1010162.JPG

That's Alcatraz in the back, that's two nerds having un in the front.

After we were done, we saw the sea lions at Pier 39, got a cup of coffee and a cheese sandwich, and got back on the car, with the idea of going back. Of course we didn't actually have GPS, or a phone that worked in the US, but we had cached maps! And a vague idea of where the hotel was! So we eventually got there, got into the room, got into the internet, called the family, and I passed out of exhaustion at rough;y midnight Argentine time, two days after I got on the bus in Mar del Plata.

And then I woke up, and wrote this.

Syndicated 2013-01-13 12:35:33 from Lateral Opinion

Adding Support for a Markup to Nikola

One of the goals for Nikola, my static site/blog generator is that it should be easy to extend. For example, today I added support for two markups: textile and CreoleWiki.

Since Nikola already supported HTML, reStructuredText and Markdown, adding a couple more is not very difficult. Here's how:

  1. Create a .plugin file like this one:
[Core]
Name = textile
Module = compile_textile

[Documentation]
Author = Roberto Alsina
Version = 0.1
Website = http://nikola.ralsina.com.ar
Description = Compile Textile into HTML

Then you need to create a python module called (in this case) compile_textile.py

That file is boilerplate plus two methods, compile_html and create_post

The compile_html method takes two arguments, one file from which it reads the markup, and one to write HTML. Example:

def compile_html(self, source, dest):
    if textile is None:
        raise Exception('To build this site, you need to install the "textile" package.')
    try:
        os.makedirs(os.path.dirname(dest))
    except:
        pass
    with codecs.open(dest, "w+", "utf8") as out_file:
        with codecs.open(source, "r", "utf8") as in_file:
            data = in_file.read()
        output = textile(data, head_offset=1)
        out_file.write(output)

Make sure to use utf8 everyhere.

The create_post function is used to create a new, empty, post with some metadata in it. Example:

def create_post(self, path, onefile=False, title="", slug="", date="", tags=""):
    with codecs.open(path, "wb+", "utf8") as fd:
        if onefile:
            fd.write('<notextile>  <!--\n')
            fd.write('.. title: %s\n' % title)
            fd.write('.. slug: %s\n' % slug)
            fd.write('.. date: %s\n' % date)
            fd.write('.. tags: %s\n' % tags)
            fd.write('.. link: \n')
            fd.write('.. description: \n')
            fd.write('--></notextile>\n\n')
        fd.write("\nWrite your post here.")

The metadata has to be in the form ".. fieldname: fieldvalue" and usually needs to be wrapped in a comment so that it's not shown in the output.

The onefile parameter means you have to write that metadata in the post. If it's False, you don't.

In some rare cases (Creole, I am looking at you) comments are not supported and you should raise an exception if onefile is True.

And that's it, markup support is fairly easy to add as long as there is a python implementation of a function to convert markup into html.

Syndicated 2013-01-10 17:24:21 from Lateral Opinion

673 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!