angrykoala / yamp

Yet Another Markdown Parser

Home Page:https://angrykoala.github.io/yamp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove extension on -o option

angrykoala opened this issue · comments

e.g. yamp readme.md -o readme.pdf will generate readme.pdf.pdf

It should only be readme.pdf

This issue is related to #41

I've added pull request #106 for this issue.

@cosminlupu I see you removed extensions matching the output filename in #106
What do you think we should do if the given extension is different?
e.g.

yamp file.md -o newfile.html --pdf

I'm not sure if the expected behavior for the user will be to remove the extension (newfile.pdf) or get a file (newfile.html.pdf)

@angrykoala IMO if the output filename doesn't contain the given extension, then the extension should be appended, as what we perceive as an extension, might be wanted as part of the filename.

Example: yamp file.md -o newfile.v1 --pdf should result in newfile.v1.pdf

If there is no given extension, but the output filename contains one ( and the it is one used by renderers ), then that should be automatically detected. I guess that is what issue #41 is all about.

Example:

yamp file.md -o newfile.html should result in newfile.html
yamp file.md -o newfile.pdf should result in newfile.pdf

Makes sense. We could add the /i to the regular expression, so .HTML and .PDF are also replaced

I agree. Added in pull request #107

Nice, some tests may be updated, but for now, the issue is closed