Hi Kevin,

Using preproc, you can't go any further than what you already did. Beware
that title with punctuation will cause problems.

This auto anchor is a great feature should be added to the txt2tags itself,
by default. Every title should be anchored automatically, and the user, of
course, can overwrite it with the [anchor]. I've opened and issue for that:


Thanks for the idea!

On Monday, May 28, 2012, Kevin wrote:

> Hey guys, it's me again.
> 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 ]
> I can easily modify the regex to remove the outside spaces:
> = An Awesome Heading =[An Awesome Heading]
> but that doesn't quite cover it.  Is there a way to strip spaces (and
> other bad characters) from a section of a line.  I have considered
> brute-forcing it but that isn't pretty and can only handle a set amount
> of words.
> %!preproc: '^=+\s*(\S*?)\s*(\S*?)\s*(\S*?)\s*(\S*?)\s*=+$'
> '\g<0>[\1\2\3\4]'
> This last one works but is super ugly.  Does anyone have and suggestions?
> Thanks, Kevin

Aurelio | www.aurelio.net | @oreio
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
txt2tags-list mailing list

Reply via email to