pombreda / txt2tags

Automatically exported from code.google.com/p/txt2tags
GNU General Public License v2.0
0 stars 0 forks source link

Set nicknames and fIle extension in targets/*.py #157

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Now that we have separate Python files for each target, new target configs 
could be added.

Today the file extension is bound to the target nickname (that used in the 
--target option). For example "txt2tags -t md" will generate a file with the 
".md" extension. I think it's time to unbound them.

There could be a separate setting for the output file extention:

    EXTENSION = 'md'

And another setting for the target nickname(s):

    ID = ['md', 'mdown', 'markdown']

That way, the user can convert his files with more flexibility:

    txt2tags -t md foo.t2t
    txt2tags -t mdown foo.t2t
    txt2tags -t markdown foo.t2t

Those three commands are similar, and the output file will always be foo.md, 
which is "INFILE_BASENAME.EXTENSION"

What you think?

Original issue reported on code.google.com by aureliojargas@gmail.com on 27 Jul 2012 at 3:30

GoogleCodeExporter commented 9 years ago
The output file extension is the name of the file module i.e. md.py (or the 
name of the directory like the mama exemple), KISS.

Multiple IDs, why not, but should we show them in the --targets command ?

Original comment by fgalla...@gmail.com on 29 Jul 2012 at 2:17

GoogleCodeExporter commented 9 years ago
I would really like the EXTENSION attribute. Then we can also have xhtml files 
named .html for example.

The ID attribute is also very helpful! Users don't wnat to remember whether 
it's tex or latex and md or markdown.

Original comment by jendriks...@gmail.com on 29 Jul 2012 at 11:04

GoogleCodeExporter commented 9 years ago
I agree with Florent, using the file name as the main ID is simple and better.

What we could have is a --extension option to change the default extension at 
run time. And a new config, useful to be put in the RC file:

%!extension(xhtml): html

About the multiple IDs, the aliases should be considered valid in every place 
the main ID is. But for --help and --targets, I think the main ID should be e 
only one mentioned.

Original comment by aureliojargas@gmail.com on 29 Jul 2012 at 11:24

GoogleCodeExporter commented 9 years ago
Is -o name_of_the_file.extension really so hard ? Anyway, if some people think 
it's useful, it's easy to implement, and OK for me. 

Original comment by fgalla...@gmail.com on 29 Jul 2012 at 2:17

GoogleCodeExporter commented 9 years ago
ALIASES in r1020

Original comment by fgalla...@gmail.com on 29 Jul 2012 at 5:08

GoogleCodeExporter commented 9 years ago
The -o option isn't hard for a single file, but when you have a website powered 
by txt2tags, this becomes a PITA.

There's XHTML and now HTML5. You'll have to set -o for every website file just 
to have the nice .html extension. An you loose the automatic output filename. 
So, if you change the source filename from changelog.t2t to history.t2t, you'll 
have to remember to update the %!options inside it to have "-o history.html".

With the new %!extension config, I just put this *once* in my ~/.txt2tagsrc 
file:

    %!extension(xhtml): html
    %!extension(html5): html

And forget about it. Now every website will have the correct filenames, ending 
in .html, with no need to use -o.

Original comment by aureliojargas@gmail.com on 30 Jul 2012 at 2:09

GoogleCodeExporter commented 9 years ago
Definitely OK !

Original comment by fgalla...@gmail.com on 30 Jul 2012 at 2:34

GoogleCodeExporter commented 9 years ago
For reference: more info about the 'extension' setting, see also issue 107 and 
issue 66.

Original comment by aureliojargas@gmail.com on 30 Jul 2012 at 3:24

GoogleCodeExporter commented 9 years ago
With the new ALIASES setting, ambiguity are now possible if different targets 
have a same alias, or if a target has the name of an other target as alias. 
Should we support this conflicts, or assume that people are doing things in the 
right way ?

Original comment by fgalla...@gmail.com on 30 Jul 2012 at 3:49

GoogleCodeExporter commented 9 years ago
Since there's no way to know which one is the correct in these cases, I think 
we should raise an error and abort, so somebody notice and fix.

Original comment by aureliojargas@gmail.com on 30 Jul 2012 at 4:53

GoogleCodeExporter commented 9 years ago
The %!extension config is a step in the right direction, but I think we should 
take the burden of changing e.g. the html5 extension to the sane html one from 
the user. That would be a little KISS for the user I guess :)

Nobody wants to have a file ending texs, htmls, aat or the like. Everybody 
wants tex, html and txt.  

Original comment by jendriks...@gmail.com on 30 Jul 2012 at 8:17

GoogleCodeExporter commented 9 years ago
Finaly, I agree with Jendrik ! As Aurelio said in issue 107 : "The html 
variants should all save the results as .html, because they are HTML files."
The target name as extension is good for tests with the sample file, but not a 
good default for users.
An extension attribute is not such a big deal.

Original comment by fgalla...@gmail.com on 14 Aug 2012 at 7:00

GoogleCodeExporter commented 9 years ago
EXTENSION in r1048

Original comment by fgalla...@gmail.com on 14 Aug 2012 at 7:23

GoogleCodeExporter commented 9 years ago
With r1053, if you use an ALIAS it overrides the EXTENSION. Mix alias/extension 
choice, so in theory not good, but seems to be a good default in practice.

Original comment by fgalla...@gmail.com on 15 Aug 2012 at 5:21

GoogleCodeExporter commented 9 years ago
Advices about that ? We close the Issue ?

Original comment by fgalla...@gmail.com on 15 Aug 2012 at 5:28