You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Email from Kevin:.
I was creating a "config" file to be used in all the documents in a
project and one thing I wanted to do was "auto-anchor" titles.
I have titles like so:
= An Awesome Heading =
and I have the following preproc so far:
%%!preproc: '^=+(.*?)=+$' '\g<0>[\1]'
This gets me this far:
= An Awesome Heading =[ An Awesome Heading ]
...
-------------------------------------------------[email end]
This is a great feature o implement in the core.
Every title should be anchored automatically, and the user, of course, can
overwrite it with the [anchor].
We need to create a new function to make a "slug" from the text: convert to
lower case, change spaces and punctuation to hyphens, unaccent chars (á -> a).
For example:
>>> get_anchor("Hello João, nice hat!!!")
hello-joao-nice-hat
>>>
I'm sure such a function was already implemented countless times, not let's not
reinvent the wheel. I know Python's docutils have it, maybe we can copy it.
Original issue reported on code.google.com by aureliojargas@gmail.com on 29 Jul 2012 at 10:54
The text was updated successfully, but these errors were encountered:
Just a couple more things. If a title has already been used you might want to
add a <code>-#</code> to the end.
So you get "note", "note-2", "note-3" and "note-..."
And of course still allow overrides in the usual form.
Original comment by kevincox...@gmail.com on 29 Jul 2012 at 12:43
Original issue reported on code.google.com by
aureliojargas@gmail.com
on 29 Jul 2012 at 10:54The text was updated successfully, but these errors were encountered: