Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Some New Stuff in Nikola

I did so­me qui­ck wo­rk on Niko­la (a sta­tic web­si­te/­blog ge­ne­ra­to­r) la­te­l­y, after a long ti­me, and he­re's what it wa­s:

Multilingual Sitemaps

So, site­maps are us­ed by Google to in­dex your si­te. It turns out that they can des­cri­be when the­re are se­ts of pa­ges that are trans­la­tions of ea­ch othe­r. So the next re­lea­se wi­ll do that (Is­sue #1610)

Matplotlib Plots

Ma­tplo­tlib co­mes wi­th a sphi­nx ex­ten­sion to do plo­ts So I went and im­ple­men­ted it, this was Is­sue #1242 and it's a plu­gin ca­lled py­plo­ts, whi­ch wi­ll be soon at http://­plu­gin­s.­ge­tniko­la.­co­m#­p­y­plo­ts

I hated the ori­gi­nal co­de. It felt con­vo­lute­d, and just weird (i­t's pro­ba­bly just me) so I wro­te it from scra­tch and it has so­me mi­nor di­ffe­ren­ce­s, but it's fair­ly com­pa­ti­ble.

Classy Images

The do­cu­tils ima­ge di­rec­ti­ve, for whate­ver rea­so­n, does­n't su­pport a cla­ss op­tio­n, so you need to do things like this:

.. class:: foo

.. image:: blah.png

Whi­ch is ... not pre­tty. So I did a ha­cky plu­gin that mo­nke­y­pa­tches the ima­ge di­rec­ti­ve to add that op­tio­n. The plu­gin is at http://­plu­gin­s.­ge­tniko­la.­co­m/#­cla­ss­y-i­ma­ges and this fixes Is­sue 1538

Mediawiki Markup

dj­b­cla­rk pointed out that the­re is a li­bra­ry to par­se Me­diaWiki from py­thon ca­lled sm­c.­mw so I im­ple­men­ted a plu­gin to use it, so now you can use Me­diaWiki ma­rku­p. The plu­gin is at http://­plu­gin­s.­ge­tniko­la.­co­m/#­me­diawiki

Removed Default Swatch from Bootswatch

This was Is­sue #1656 and now you ha­ve to spe­ci­fy the swa­tch. This is a usa­bi­li­ty fix, be­cau­se de­faul­ts ma­tter.

Played with KaTeX

Niko­la su­ppor­ts ma­th using Ma­th­Ja­x. Ma­th­Jax has so­me in­te­res­ting qua­li­tie­s:

  • It's 160MB of co­­­de or so

  • It's not pra­c­­ti­­cal to use wi­­thout a CDN

  • It's not pra­c­­ti­­cal to use we­­ba­sset bun­d­­les wi­­th it

Then, klin­gtnet men­tio­ned so­me­thing ca­lled Ka­TeX I had ne­ver heard abou­t. I did a qui­ck ha­cky con­ver­sion to see how it wo­rks. Not do­ne ye­t, to­ta­lly ex­pe­ri­men­ta­l, but it may be po­s­si­ble to bund­le it, and ma­y­be even ha­ve it tur­ned on by de­faul­t, re­mo­ving the need for the ma­th­jax la­bel whi­ch is aw­ful usa­bi­li­ty-wi­se.

So­me of the­se things are mer­ge­d, so­me are sti­ll PR­s, so­me are in co­re, so­me are plu­gin­s. They we­re all pre­tty fun to do :-)

cHagHi / 2015-05-05 20:10:

I'm a bit lost with the purpose of the Classy Images plugin.

This seems to be valid reST for the docutils parser:


.. image:: blah.png
:class: foo

At least rst2html doesn't complain, and generates the expected result. So I don't understand what use case Classy Images is trying to solve/fix...

Roberto Alsina / 2015-05-05 20:14:

I wonder what I was drinking? I could swear this used to fail.

Roberto Alsina / 2015-05-05 20:18:

Looks like I misunderstood the bug. The problem is that when you have a target and a class, the class is applied to the img tag, and that made the islink hack fail. So this was never necessary, and I will delete it now :-)

cHagHi / 2015-05-05 20:33:

I had just started to add the :class: option to dozens of posts that link to Flickr (aka apply the islink hack), and then read this, and found the bug #1538, and the comment that having a :class: option inside an image directive was not standard reST, and panicked :P, because even if "Classy Images" seemed clean and small enough I didn't want to use non-standard reST. At first I thought "ok, this works because of this particular monkey-patching", but then I saw the plugin was commited just a few days ago, so I don't have it yet. And that's when I asked :-)

Good to confirm that mi reST is still standard then! Now I can go on with the (boring!) task of adding the damned class option...

Roberto Alsina / 2015-05-05 20:45:

You could tweak the template and make it be the other way around :-)

So then only links with a specific class get colorbox

re:fi.64 / 2015-10-13 18:34:

It's actually quite possible to already use KaTeX with Nikola, although it's kind of suckish:

http://kirbyfan64.github.io... (the page)
https://raw.githubuserconte... (source code)


Contents © 2000-2024 Roberto Alsina