Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about nikola (old posts, page 7)

Nikola v5 Released

A new ver­sion of Niko­la is out! You can get it at the usu­al place.

This ver­sion is not com­plete­ly back­wards com­pat­i­ble, thus the new ma­jor ver­sion num­ber, but switch­ing to it should be easy-ish. If you are us­ing ver­sion 4.0.3:

  1. Re­­move your do­­do.py

  2. Use niko­la build in­stead of doit from now on

  3. use niko­la serve in­stead of doit serve, niko­la new_­post in­stead of doit new_­post, and so on. Some oth­er doit task are al­so con­vert­ed in­to niko­la com­mand you can get the list us­ing niko­la help

The in­te­gra­tion of doit in­to Niko­la is not done in a very nice way, that's still on­go­ing work, but it should be Good Enough To Work (T­M).

Hope you en­joy this re­lease!

Features

  • Tem­­plates now know their name from tem­­plate_­­name in their con­­tex­t.

  • Made most of Niko­la in­­­to Yap­sy plug­in­s.

  • Re­curse gal­­leries/ and ren­der each fold­er as a gallery.

  • Bread­­crumbs and fold­er links in im­age gal­­leries.

Bugfixes

  • Fixed doc in­­stal­la­­tion

  • Put we­bas­sets cache in cache/we­bas­sets

  • Up­­­date to doit 0.17

  • Don't crash on in­­­com­­plete tran­s­la­­tions

  • Fixed Is­­sue 160: ren­der_­­tags did­n't call scan_­­post­s()

  • Fixed Is­­sue 161: we­bas­sets set­t­ing USE_BUN­­DLES was ig­nored (fix by schet­ti­no72)

  • Fixed Is­­sue 153: in­­dex.txt was be­ing ig­nored in gal­­leries.

Coming Soon...

... lots of trav­el pic­tures. On this trip I want to cre­ate a work­flow so it's very easy for me to pub­lish each day's pho­tos at the end of it.

I will be fold­ing that work­flow in­to Niko­la's gal­leries, since I don't ex­pect it to be a big amount of code, and I have sev­er­al hours of dead time while trav­el­ing.

Nikola is Pluginificated.

Yes, I know that's not a re­al word.

So, the git mas­ter of Niko­la now has plug­ins. In fac­t, not on­ly does it have plu­g­in­s, but is ba­si­cal­ly made of plug­ins.

You see, the code used to most­ly be in­side a class (called Niko­la), and ... it had grown. That class had grown up to around 2000 lines of code. Which is com­plete­ly ridicu­lous.

So, us­ing Yap­sy I turned the code in­side out: al­most all the code that was in that mon­ster class was moved in­to plug­ins and the class turned in­to a smart plug­in load­er.

This has brought sev­er­al ad­van­tages:

  • Now you can ex­­tend Niko­la for your own pur­­pos­es. Just cre­ate a plug­in fold­er in your site, and put the ex­­tra func­­tion­al­i­­ty there.

  • Sup­­port for whole cat­e­­gories of things is now mod­­u­lar. Want to sup­­port a dif­fer­­ent markup? A dif­fer­­ent tem­­plate sys­tem? Just write a plug­in.

  • Want to add com­­plete­­ly new func­­tions to Niko­la? Like, say, a way to im­­port da­­ta from an­oth­er blog tool, or some­thing like plan­et soft­­ware? Well, just add a "com­­mand plug­in".

What has changed for the user?

  • You can delete do­do.py from your site.

  • Use niko­la build in­stead of doit

  • Use niko­la serve in­stead of doit serve

Some mi­nor things still need do­ing in this area (no­table, fix­ing the doc­s), but the main refac­tor­ing is there.

Improved Wordpress.com Importer and a Question

Thanks to the co­op­er­a­tion of Hu­mi­tos who gave me his word­press back­up, I did some im­prove­ments in the word­press.­com im­port fea­ture of Niko­la, my stat­ic web­site/blog gen­er­a­tor

So, if you were to try to use nikola_wordpress_importer from master now, it would:

  1. Not crash ;-)

  2. Down­load at­­tach­­ments

  3. Fix links to at­­tach­­ments so they work on the new site

How­ev­er, I am now un­sure of what ex­act­ly is in word­press.­com's ex­port XML file. The posts them­selves are in this for­m:

Muchas gracias Nico por hacer el video este. Groso, quedó muy bueno.

[youtube=http://www.youtube.com/watch?hl=es&v=882qxARXa6c]

Two things jump to me:

  1. That's not HTML

  2. WTF is that youtube thing?

I am hav­ing some suc­cess pro­cess­ing it as mark­down, since that han­dles the para­graph breaks and some oth­er stuff. Maybe the youtube em­bed­ding is done with a mark­down ex­ten­sion?

Any­one knows?

New Nikola Feature: wordpress.com Importer

I im­ple­ment­ed a first drat of a word­press.­com im­porter for my Niko­la stat­ic site/blog gen­er­a­tor It's a work in progress but it works well enough that it can turn this blog in­to this blog

What work­s:

  • Posts

  • Pages

  • Drafts

  • Tags

  • Per­­son­al in­­­for­­ma­­tion

What does­n't work:

  • Com­­ments

  • Links across post­s/­­pages are left un­­touched

  • The out­­put is pret­­ty gen­er­ic

This needs testing, so feel free to get master and try it. Asuming foo.xml is your data from wordpress.com:

nikola_import_wordpress foo.xml
cd new_site
doit && doit serve

And point your brows­er to http://lo­cal­host:8000 to see the re­sult :-)

Minor tweaking of the generated conf.py is generally needed for improved results.


Contents © 2000-2023 Roberto Alsina