Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Only compile files with .html extension. #39

Merged
merged 2 commits into from

2 participants

@runejuhl

Fixes the issue at ChicagoBoss/ChicagoBoss#140 , wrongly attributed to Chicago Boss.

@evanmiller
Owner

Some people use other extensions (.dtl, .txt, etc.). I think the patch should just exclude files that end with a tilde rather than require the .html extension.

@runejuhl

ErlyDTL (or is it Chicago Boss?) only accepts views with the ".html" ending, which is why I chose this.

I'm not sure excluding files with a ending tilde is a good way to go, as backup files might have a trillion different endings, e.g. .bak or .old. I'll be glad to change it, but I'd prefer something in the way of (html)|(djhtml)|(dtl).

@evanmiller
Owner

ErlyDTL accepts templates with any file extension. I think just excluding tildes is the way to go. There might be other backup file endings but I would prefer to deal with them on a case-by-case basis.

@evanmiller
Owner

Thanks!

@evanmiller evanmiller merged commit 8552440 into erlydtl:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/erlydtl_compiler.erl
View
4 src/erlydtl_compiler.erl
@@ -117,7 +117,9 @@ compile_dir(Dir, Module) ->
compile_dir(Dir, Module, Options) ->
Context = init_dtl_context_dir(Dir, Module, Options),
- Files = filelib:fold_files(Dir, ".*", true, fun(F1,Acc1) -> [F1 | Acc1] end, []),
+ %% Find all files in Dir (recursively), matching the regex (no
+ %% files ending in "~").
+ Files = filelib:fold_files(Dir, ".+[^~]$", true, fun(F1,Acc1) -> [F1 | Acc1] end, []),
{ParserResults, ParserErrors} = lists:foldl(fun
(File, {ResultAcc, ErrorAcc}) ->
case filename:basename(File) of
Something went wrong with that request. Please try again.