summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-02-16 18:44:05 +0200
committerLars Wirzenius <liw@liw.fi>2016-02-16 18:44:05 +0200
commit2c8e8622f9833167c76512466cc0ed2e847d1df7 (patch)
tree374a726da11284b3c601565a6f2e10d7f4f3efa2
parentc237c74e0a6f62c9c489cdef53179d4c8e176fa0 (diff)
parente133e66ac3255a3abf88e0bea5a9177f21a8bf0f (diff)
downloadjt-2c8e8622f9833167c76512466cc0ed2e847d1df7.tar.gz
Merge branch 'liw/nonascii'
-rw-r--r--jtlib/app.py8
-rw-r--r--jtlib/draftsdir.py2
-rw-r--r--yarns/020-basic-workflow.yarn9
-rw-r--r--yarns/yarn.sh1
4 files changed, 14 insertions, 6 deletions
diff --git a/jtlib/app.py b/jtlib/app.py
index ad0d7a3..ddbb94a 100644
--- a/jtlib/app.py
+++ b/jtlib/app.py
@@ -134,5 +134,9 @@ class JournalTool(cliapp.Application):
def render_template(self, basename, vars):
text = self.read_template(basename)
- template = jinja2.Template(text)
- return template.render(**vars)
+ utext = unicode(text, 'utf8')
+ uvars = dict(
+ (unicode(k, 'utf8'), unicode(v, 'utf8'))
+ for k, v in vars.items())
+ template = jinja2.Template(utext)
+ return template.render(**uvars)
diff --git a/jtlib/draftsdir.py b/jtlib/draftsdir.py
index 59eb47d..67b4e66 100644
--- a/jtlib/draftsdir.py
+++ b/jtlib/draftsdir.py
@@ -39,7 +39,7 @@ class DraftsDirectory(object):
draft_id = self._pick_available_draft_id()
pathname = self.get_draft_pathname(draft_id)
with open(pathname, 'w') as f:
- f.write(content)
+ f.write(content.encode('utf8'))
return draft_id
def _pick_available_draft_id(self):
diff --git a/yarns/020-basic-workflow.yarn b/yarns/020-basic-workflow.yarn
index fc1c756..d86ab0b 100644
--- a/yarns/020-basic-workflow.yarn
+++ b/yarns/020-basic-workflow.yarn
@@ -12,16 +12,19 @@ invoked, because it'd be difficult to control the editor.
SCENARIO add a simple note
GIVEN an empty journal in SRC
AND the time is 2014-11-22 17:30:45
- WHEN I run jt new TITLE
+ WHEN I run jt new TITLE-TRÖÖT
THEN file SRC/drafts/0.mdwn exists
- AND file SRC/drafts/0.mdwn matches title="TITLE"
+ AND file SRC/drafts/0.mdwn matches title="TITLE-TRÖÖT"
+
+(Note that we use a title with non-ASCII characters to make sure jt
+handles that.)
This is where the user would normally use their editor to edit the
draft, and exit the editor when done.
WHEN I run jt finish
THEN file SRC/drafts/0.mdwn doesn't exist
- AND file SRC/notes/2014/11/22/title.mdwn exists
+ AND file SRC/notes/2014/11/22/title-tr_t.mdwn exists
This is how you create a note, in the simplest case. A more complex
case is when there's more than one draft at a time.
diff --git a/yarns/yarn.sh b/yarns/yarn.sh
index 1f02369..04539da 100644
--- a/yarns/yarn.sh
+++ b/yarns/yarn.sh
@@ -24,6 +24,7 @@
run_jt()
{
set +e
+ touch "$DATADIR/time.conf"
EDITOR=true \
"$SRCDIR/jt" --no-default-config \
--config "$DATADIR/source.conf" \