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!
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.
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.
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!
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.
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.
[Core]Name=textileModule=compile_textile[Documentation]Author=Roberto AlsinaVersion=0.1Website=http://nikola.ralsina.meDescription=Compile Textile into HTML
Then you need to create a python module called (in this case) compile_textile.py
The compile_html method takes two arguments, one file from which it reads the markup, and one to write HTML. Example:
defcompile_html(self,source,dest):iftextileisNone:raiseException('To build this site, you need to install the "textile" package.')try:os.makedirs(os.path.dirname(dest))except:passwithcodecs.open(dest,"w+","utf8")asout_file:withcodecs.open(source,"r","utf8")asin_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:
defcreate_post(self,path,onefile=False,title="",slug="",date="",tags=""):withcodecs.open(path,"wb+","utf8")asfd:ifonefile: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.