Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about python (old posts, page 87)

Math Works Now

Do­cu­tils has sup­port­ed math ren­der­ing for a while now. That means Niko­la should have sup­port­ed it for a while too, but nev­er did cor­rect­ly be­cause ... well, be­cause noone ev­er tried, may­be?

Well, it does now, be­cause Dami­an Avi­la has fixed it!

Read more…

Nikola 5.3 released

I am hap­py to an­nounce the re­lease of ver­sion 5.3 of Niko­la a stat­ic blog/site gen­er­a­tor. It in­cludes some mi­nor fea­tures and a good amount of bug­fix­ing. Up­grad­ing to it should not cause you any trou­ble, as far as I know.

Here's the changel­og:

Features

  • Boot­s­trap 2.3.0

  • Op­­tion­al­­ly use con­­tent dis­­tri­bu­­tion net­­works for jquery and twit­ter-­­boot­s­trap (USE_CDN op­­tion)

  • Im­prove pro­­gres­­sive ren­der­ing by mov­ing javascript to the bot­­tom of pages

  • New Brazil­ian por­­tuguese tran­s­la­­tion.

  • New plan­e­­toid ex­per­i­­men­­tal ex­­tra_­­plu­g­in

Bugfixes

  • Make re­al­­ly sure we im­­port the right con­f.py

  • Make SLUG_­­TAG_­­PATH a con­­fig dep for most pages

  • Re­­moved meta ti­­tle tag for bet­ter HTML val­i­­da­­tion

  • Re­­moved #999 back­­­ground from foot­note back­­link.

  • Made foot­note re­f­er­ences be su­per­scrip­t­ed.

  • Cen­tered fig­ure's im­age and cap­­tion.

  • Re­­moved out­­set bor­der from ad­­mo­ni­­tion­s.

  • Use de­­fault theme as last re­­source for mes­sages/­­tran­s­la­­tions

  • DATE_­­FOR­­MAT op­­tion was be­ing ig­nored

  • Re­­move trail­ing "" on win­­dows gallery links (Is­­sue #298)

  • In­­­con­­sis­­tent bread­­crumbs in gallery pages (Is­­sue #303)

  • Use source files as bun­­dle de­pen­­den­­cies in­­stead of out­­puts (Is­­sue #294)

En­joy!

Nikola 5.2 released!

I am thrilled to an­nounce that you can now down­load Niko­la 5.2. a new ver­sion of my stat­ic blog/site gen­er­a­tor.

What's new in this ver­sion? A LOT. Don't let the mi­nor ver­sion tick fool you, this ver­sion is packed with good­ness. Let's start with fea­tures:

You can eas­i­ly em­bed more con­tent:

  • New vimeo di­rec­­tive for re­struc­­tured tex­t.

  • Cus­­tom "gist" di­rec­­tive pro­vid­ing re­Struc­­tured text sup­­port for GitHub gist­s.

You can write your con­tent in al­most any markup:

  • Tex­tile markup sup­­port.

  • Cre­ole Wi­­ki markup sup­­port.

  • tx­t2­­tags markup sup­­port.

  • bb­­code markup sup­­port.

  • And of course, it still sup­­ports re­Struc­­tured tex­t, Mark­­down and HT­M­L.

More lan­guages:

  • New Catalá tran­s­la­­tion

  • New pol­ish tran­s­la­­tion.

  • New Sim­­pli­­fied Chi­­nese tran­s­la­­tion.

  • Use mul­ti­lin­gual Dis­­qus (although it does­n't seem to work)

You can im­port your data:

  • New Blog­ger/Blogspot im­­porter

  • Much im­proved Word­­press im­­porter

  • Ex­­tract meta­­da­­ta from file­­name by us­ing reg­­exp (help­­ful for im­­port­ing from oc­­to­­press or oth­­er sys­tem­s).

You can do fanci­er and more con­fig­urable sites:

  • One-­­page, dy­­nam­ic-load­­ing, clien­t-ren­dered site plug­in (task_­­mus­­tache)

  • Re­cur­­sive post/s­­to­ry fold­ers

  • New COM­­MENTS_IN_­­GAL­­LERIES and COM­­MENTS_IN_S­­TO­RIES op­­tion­s.

  • Lo­­cal search based on Tipue (ex­­tra_­­plu­g­in­s/­­task_lo­­calsearch)

  • Added com­­ments to im­age gal­­leries

  • New op­­tion RSS_TEASERS

  • New STO­RY_IN­DEX op­­tion to gen­er­ate in­­dex.html in sto­ry fold­er­s.

  • Add mul­ti size fav­i­­con sup­­port.

You can use Python 2.6 or high­er ... in­clud­ing Python 3. The on­ly miss­ing bit for full Python 3 sup­port is Google sitemap gen­er­a­tion.

And of course, a lot of bugs got smashed:

  • Added sane de­­faults for most op­­tion­s, so you can have a lean con­­fig file.

  • Made lay­out of the site theme re­spon­­sive, with col­lap­s­ing navbar.

  • Use time­­line in­­stead of pars­ing post_­­pages in gen­er­ic_­­page_ren­der­er and task_ren­der_­­pages.

  • Up­­­dat­ed dis­­qus in­­te­­gra­­tion code, added iden­ti­­fiers so it works on any URL.

  • Make sure fold­er links end in "/" in the gallery code.

  • Re­­moved copy of PyRSS2­­Gen, made it a de­pen­­den­­cy.

  • De­­tect "names­­pace" de­pen­­den­­cies for Mako tem­­plates.

  • Use con­­sis­­tent en­­cod­ings in RSS feed­s.

  • Refac­­tored dis­­qus code in­­­to sep­a­rate helpers

  • Use the cor­rect ex­ten­­sion (or raise an er­ror) on new_­­post

  • Fix ti­­tles that in­­­clude quotes

  • Up­­­dat­ed to cur­rent CSS from do­cu­tils (was us­ing ver­­sion from 2005)

  • Avoid need­­less re­­gen­er­a­­tion of gallery in­­dex­es.

  • Al­ways en­­sure the fold­er for the new post ex­ist­s.

  • Get ti­­tle from file­­name if not avail­able in meta­­da­­ta.

  • Don't copy sources if they end in ".ht­m­l"

  • Don't link to un­ex­ist­ing tran­s­la­­tion­s.

  • Sort tags case in­­sen­si­­tive.

En­joy!

Lunch-hour feature in Nikola: Blogger import

To­day at lunch, I added sup­port for im­port­ing blog­ger (maybe al­so blogspot? They seem to be the same nowa­days) blogs in­to Niko­la my stat­ic blog/site en­gine.

What works?

Well, the on­ly site I tried work­s, most­ly.

  • Posts

  • Pages

  • Tags

  • Drafts

  • Blog Meta­­da­­ta (ex­­cept lan­guage)

  • Redi­rects to keep URLs sta­ble (at least it tries re­al­­ly hard!)

  • URL rewrit­ing in the posts (it tries!)

What's not there?
  • Com­­ments im­­port (it makes more sense to im­­port them via Dis­­qus' im­­port tool)

  • At­­tach­­ments (im­ages and such)

  • Much test­ing

It's ba­si­cal­ly on par with the Word­press im­port, ex­cept noone has used it for re­al. So, feel free to try!

(It's niko­la im­port_blog­ger name_of_the_­dump.xm­l)

Refreshed rst-cheatsheet

A while ago, I cre­at­ed a 2-­page PDF ver­sion of the re­struc­tured text quick­start meant to be print­ed, fold­ed in half and kept handy un­til you fi­nal­ly re­mem­ber how to do foot­notes (10 years and still wait­ing, in my case).

It was brought to my at­ten­tion that the github project did not men­tion how to build it. Then I no­ticed that not on­ly it did­n't ex­plain that, it was al­so miss­ing crit­i­cal files.

So, I added the files, fixed a cou­ple of things that were not work­ing per­fect­ly with the lat­est rst2pdf and there is now a fresh PDF ready for you!


Contents © 2000-2020 Roberto Alsina