From a9ae0264de61e057972d0c08436e50a0e016e379 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 22 Nov 2014 19:45:39 +0200 Subject: Remove non-pkb layouts (sorry) --- jt | 33 +++++---------------------------- yarns/yarn.sh | 1 - 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/jt b/jt index 12db5b9..d41bb55 100755 --- a/jt +++ b/jt @@ -115,7 +115,6 @@ class NewCommand(Command): raise cliapp.AppException('Usage: journal-note new TITLE') self._app.settings.require('source') - self._app.settings.require('layout') values = { 'title': args[0], @@ -178,9 +177,12 @@ class FinishCommand(Command): draft_attch = drafts_dir.get_draft_attachments_dirname(draft_id) title = drafts_dir.get_draft_title(draft_id) + if not title: + raise Exception("%s has no title" % draft_mdwn) + pub_attch = os.path.join( self._published_dir(), - self._published_basename(title, draft_mdwn)) + self._summarise_title(title)) pub_mdwn = pub_attch + '.mdwn' if os.path.exists(pub_mdwn): @@ -197,28 +199,9 @@ class FinishCommand(Command): self.push_git() def _published_dir(self): - subdirs = { - 'liw': 'notes', - 'ct': 'log/%d' % time.localtime().tm_year, - 'pkb': time.strftime('notes/%Y/%m/%d'), - } - - subdir = subdirs[self._app.settings['layout']] + subdir = time.strftime('notes/%Y/%m/%d') return os.path.join(self._app.settings['source'], subdir) - def _published_basename(self, title, draft_mdwn): - if self._app.settings['layout'] in ('liw', 'ct'): - basename = time.strftime('%Y-%m-%d-%H:%M:%S') - elif self._app.settings['layout'] == 'pkb': - if not title: - raise Exception("%s has no title" % draft_mdwn) - 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 + '-_') @@ -302,12 +285,6 @@ class JournalTool(cliapp.Application): 'use journal source tree in DIR', metavar='DIR') - self.settings.choice( - ['layout'], - ['ct', 'liw', 'pkb'], - 'use journal layout (one of liw, ct, pkb)', - metavar='LAYOUT') - self.settings.boolean( ['git'], 'add entries to git automatically', diff --git a/yarns/yarn.sh b/yarns/yarn.sh index 5f3e59b..1f02369 100644 --- a/yarns/yarn.sh +++ b/yarns/yarn.sh @@ -28,7 +28,6 @@ run_jt() "$SRCDIR/jt" --no-default-config \ --config "$DATADIR/source.conf" \ --config "$DATADIR/time.conf" \ - --layout=pkb \ --no-git \ "$@" exit_code="$?" -- cgit v1.2.1