Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Test
/
templar-min
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
5c4a746f
authored
2017-04-20 18:25:23 -0600
by
Marcos Cano
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixes BOM ascii problem
1 parent
b0a3872d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
src/examples/Web.win.config → src/examples/Web.win.config.xml
src/templar.min.py
src/examples/Web.win.config
→
src/examples/Web.win.config
.xml
View file @
5c4a746
File moved
src/templar.min.py
View file @
5c4a746
...
...
@@ -58,23 +58,26 @@ def engine(ifile,ofile,vars):
template_content
=
open
(
ifile
,
"r"
)
.
read
()
template
=
MyTemplate
(
template_content
)
print
'MATCHES:'
,
template
.
pattern
.
findall
(
template
.
template
)
#
print 'MATCHES:', template.pattern.findall(template.template)
matches
=
template
.
pattern
.
findall
(
template
.
template
)
if
len
(
matches
):
#print '[ MATCHES ] - ', matches
outputText
=
template
.
safe_substitute
(
vars
)
#print "[ TEMPLATING ] - %s "%ifile
try
:
if
printit
:
#print "AFTER TEMPLATE:"
#print outputText
print
outputText
.
encode
(
'ascii'
,
'ignore'
)
else
:
f
=
open
(
ofile
,
'w'
)
f
.
write
(
outputText
.
encode
(
'ascii'
,
'ignore'
))
f
.
close
()
except
UnicodeDecodeError
:
if
printit
:
print
str
(
outputText
)
else
:
f
=
open
(
ofile
,
'w'
)
f
.
write
(
str
(
outputText
))
f
.
close
()
...
...
Please
register
or
sign in
to post a comment