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
Modify extension handling to allow for .coffee.md #2738
Conversation
Great idea to make it a helper function, but this is also adding maybe a bit more than we need. Do you see any ways to potentially simplify? Just an |
We could possibly split it out into multiple functions - path.basename(source, path.extname(source)) as path.extname returns only the ending |
I've made those changes and squashed the commit down. Anything else that could be simplified further? |
You don't think that line 88 and onwards in command.coffee could still get merged together? |
1 similar comment
You don't think that line 88 and onwards in command.coffee could still get merged together? |
It sure could. Done. |
Oh, sorry, needed to look closer. That fallback path checking is only supposed to be for the |
Move filename processing to a `parseFileName` function in helpers.coffee. Map `.coffee.md` as a Literate CoffeeScript extension. Also, make .litcoffee and .coffee.md files executable without their file extension - eg. `coffee test` would work for a file called `test.litcoffee`.
Aaand reverted. |
I think there's still some stuff here that can be taken out ( |
@@ -2,6 +2,8 @@ | |||
# the **Lexer**, **Rewriter**, and the **Nodes**. Merge objects, flatten | |||
# arrays, count characters, that sort of thing. | |||
|
|||
path = require 'path' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this break browser support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point. I'll move the offenders over into command
.
This addresses #2736.
Source file name processing is moved to
helpers.coffee
and standardized. The new function also accounts for the fact thatpath.extname
only returns the last file extension - returning only.md
, rather than the full.coffee.md
.