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

Modify extension handling to allow for .coffee.md #2738

Merged
merged 1 commit into from Feb 28, 2013
Merged

Modify extension handling to allow for .coffee.md #2738

merged 1 commit into from Feb 28, 2013

Conversation

ghost
Copy link

@ghost ghost commented Feb 28, 2013

This addresses #2736.

Source file name processing is moved to helpers.coffee and standardized. The new function also accounts for the fact that path.extname only returns the last file extension - returning only .md, rather than the full .coffee.md.

@jashkenas
Copy link
Owner

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 isCoffee function that looks at a path, perhaps?

@ghost
Copy link
Author

ghost commented Feb 28, 2013

We could possibly split it out into multiple functions - isCoffee, isLiterate, and getBasename. getBasename is necessary to deal with stripping out .coffee.md at the end, as this isn't handled correctly by the old approach of

path.basename(source, path.extname(source))

as path.extname returns only the ending .md.

@ghost
Copy link
Author

ghost commented Feb 28, 2013

I've made those changes and squashed the commit down. Anything else that could be simplified further?

@jashkenas
Copy link
Owner

You don't think that line 88 and onwards in command.coffee could still get merged together?

1 similar comment
@jashkenas
Copy link
Owner

You don't think that line 88 and onwards in command.coffee could still get merged together?

@ghost
Copy link
Author

ghost commented Feb 28, 2013

It sure could. Done.

@jashkenas
Copy link
Owner

Oh, sorry, needed to look closer. That fallback path checking is only supposed to be for the .coffee variant, and is just there for parallelism with node. You can put that bit back the way it was.

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`.
@ghost
Copy link
Author

ghost commented Feb 28, 2013

Aaand reverted.

@jashkenas
Copy link
Owner

I think there's still some stuff here that can be taken out (getBasename for example) -- but I'll do it. edit: Nevermind, carry on.

@@ -2,6 +2,8 @@
# the **Lexer**, **Rewriter**, and the **Nodes**. Merge objects, flatten
# arrays, count characters, that sort of thing.

path = require 'path'
Copy link
Collaborator

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?

Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants