summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-11-22 19:28:59 +0200
committerLars Wirzenius <liw@liw.fi>2014-11-22 19:28:59 +0200
commit5523218f134c29adaf83314f2d1b48d25c22c5dc (patch)
tree1e152b8febb2731f15e81b791f1b968b8dae9852
parent3f49554a438bc153852d1dacc1db54e78a303c12 (diff)
downloadjt-5523218f134c29adaf83314f2d1b48d25c22c5dc.tar.gz
Move summarise_title into FinishCommand
-rwxr-xr-xjt22
1 files changed, 11 insertions, 11 deletions
diff --git a/jt b/jt
index 6b82994..c042ff6 100755
--- a/jt
+++ b/jt
@@ -199,13 +199,23 @@ class FinishCommand(Command):
title = self._app.get_draft_title(draft_mdwn)
if not title:
raise Exception("%s has no title" % draft_mdwn)
- basename = self._app.summarise_title(title)
+ basename = self._summarise_title(title)
else:
raise Exception(
'Setting --layout=%s is unknown' % self._app.settings['layout'])
return basename
+ def _summarise_title(self, title):
+ basename = ''
+ acceptable = set(string.ascii_letters + string.digits + '-_')
+ for c in title.lower():
+ if c in acceptable:
+ basename += c
+ elif not basename.endswith('_'):
+ basename += '_'
+ return basename
+
def _commit_to_git(self, pathnames):
cliapp.runcmd(
['git', 'add'] + pathname,
@@ -360,16 +370,6 @@ class JournalTool(cliapp.Application):
'''Publish a draft journal entry.'''
FinishCommand(self).run(args)
- def summarise_title(self, title):
- basename = ''
- acceptable = set(string.ascii_letters + string.digits + '-_')
- for c in title.lower():
- if c in acceptable:
- basename += c
- elif not basename.endswith('_'):
- basename += '_'
- return basename
-
def cmd_new_person(self, args):
'''Create a page to list all notes referring to a person.