Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new macros: %%target, %%version, %%header1 and such #68

Closed
GoogleCodeExporter opened this Issue Apr 18, 2015 · 6 comments

Comments

Projects
None yet
1 participant
@GoogleCodeExporter
Copy link

GoogleCodeExporter commented Apr 18, 2015

There are some new handy macros we can add, to insert dynamic data into the 
body of a txt2tags document:

File information
%%encoding

Conversion information:
%%target
%%cmdline

Txt2tags information:
%%appname
%%appversion
%%appurl

Header information:
%%header1
%%header2
%%header3

They are useful in templates, for example.

They are great to compose informational messages like:
At %%date this file %%outfile was converted to %%target with 
%%appname-%%appversion from a single text file %%infile.

In templates, we can then rewrite the standard footer comment message:
<!-- html code generated by txt2tags 2.6 (http://txt2tags.org) -->
<!-- cmdline: txt2tags -t html --toc index.t2t -->

To this:
<!-- %%target code generated by %%appname %%appversion (%%appurl) -->
<!-- cmdline: %%cmdline -->

Since all this information is already available inside txt2tags code, this 
macros are VERY EASY too add. Just search for 'mtime' (the already done %%mtime 
macro) an add the new macro next to it.

I will travel and get back in 3 days. Who volunteers to do some (of all) of 
this new macros until 2010-11-16?

Don't let me disappointed! :)

Original issue reported on code.google.com by aureliojargas@gmail.com on 13 Nov 2010 at 11:30

@GoogleCodeExporter

This comment has been minimized.

Copy link
Author

GoogleCodeExporter commented Apr 18, 2015

I think I managed to do it for 
%%appname
%%appversion
%%appurl 

For the others, I fear a name clash, but I'll test it anyway.

Original comment by eforg...@gmail.com on 13 Nov 2010 at 2:20

@GoogleCodeExporter

This comment has been minimized.

Copy link
Author

GoogleCodeExporter commented Apr 18, 2015

it was ok for %%target and %%cmdline because those were local variables. 
I didn't manage to extract the encoding.

Original comment by eforg...@gmail.com on 14 Nov 2010 at 8:41

  • Changed state: Started
@GoogleCodeExporter

This comment has been minimized.

Copy link
Author

GoogleCodeExporter commented Apr 18, 2015

Oh, forgot to say in the original issue text that the idea for most of these 
macros came from Emmanuel Godard.

Original comment by aureliojargas@gmail.com on 17 Nov 2010 at 12:37

@GoogleCodeExporter

This comment has been minimized.

Copy link
Author

GoogleCodeExporter commented Apr 18, 2015

Thanks a ton Eric!! I'm glad you didn't disappointed me :)

Your fixes (r469, r474) are working ok, I just removed (in r479) the call to 
self.walk_file_format() that is not necessary.

Thanks again!

Original comment by aureliojargas@gmail.com on 17 Nov 2010 at 1:18

@GoogleCodeExporter

This comment has been minimized.

Copy link
Author

GoogleCodeExporter commented Apr 18, 2015

%%encoding added in r482.

Original comment by aureliojargas@gmail.com on 17 Nov 2010 at 1:28

@GoogleCodeExporter

This comment has been minimized.

Copy link
Author

GoogleCodeExporter commented Apr 18, 2015

This issue was closed by revision r483.

Original comment by aureliojargas@gmail.com on 17 Nov 2010 at 2:30

  • Changed state: Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.