Yesterday I got a patch upstreamed to Firmant that
handles static pages that are written in reStructuredText. The "About" page in
the first sidebar box on the right is managed this way. This will allow me to
manage my project websites using Firmant as well. These should be coming up as
I get to work on them. In addition I should be getting an actual homepage
rather than the nginx default.
After this work, I worked on converting some of my old posts from the format in the database to
reStructuredText. One of the more annoying things to convert are the links.
After manually doing the first two of the posts, I recorded a macro within
Vim to do this for me. For anyone else that's converting
over to Firmant from an HTML-based blog format, this will be extremely
helpful:
/<a<CR>v8ld"udt"2s`<ESC>/<\/a<CR>4s <>`_<ESC>2h"uP
Step by step, here is what is happening:
- /<a<CR> --- Search for the opening tag for an anchor.
- v8ld --- Visually select 8 characters to the right and delete them
(this could be condensed to d8l). This requires that you have Vim set
to be able to go to the next line when moving right or left. If you do not
have this set, d8gl is what you need.
- "udt" --- Delete text until the next " character and place it in
the u buffer.
- 2s`<ESC> --- Replace the next two characters (the "> of the anchor
tag) with a single ` and return to normal mode.
- /<\/a<CR> --- Search for the end tag of the anchor.
- 4s <>`_<ESC> --- Replace the next four characters (the complete end
tag) with <>`_ and return to normal mode.
- 2h"uP --- Move left two characters and paste the u buffer before
the current position.
Once this is done to convert all of the links, I remove any escaping
characters (usually single quotes from the database dump) and reflow all of
the paragraphs with what is probably my favorite Vim command: vipgq. This
means "visually select the paragraph I am in (vip) and reformat it to fit
within my current textwidth setting (gq)". I use a textwidth of
78 personally. Hope this helps!