From 6e120a3bc18c6a0fe6f1b2833045d3908314098d Mon Sep 17 00:00:00 2001 From: Panayotis Vryonis Date: Tue, 29 Mar 2011 12:09:18 +0000 Subject: [PATCH 1/3] tag files are formated in markdown (not csv) and named .markdown. This makes it much easier to browse them on GitHub which renders .markdown files as HTML. --- gitmark.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gitmark.py b/gitmark.py index d65062aa..062cbc41 100644 --- a/gitmark.py +++ b/gitmark.py @@ -83,13 +83,14 @@ def saveContent(self, filename, content): def saveTagData(self, tag, url, title, content_filename): try: - tag_writer = csv.writer(open('%s%s' % (TAG_PATH, tag), 'a')) + f = open('%s%s.markdown' % (TAG_PATH, tag), 'a') except IOError: os.mkdir(TAG_PATH,0755) - tag_writer = csv.writer(open('%s%s' % (TAG_PATH, tag), 'a')) - - tag_writer.writerow([url, title, content_filename]) - return '%s%s' % (TAG_PATH, tag) + f = open('%s%s.markdown' % (TAG_PATH, tag), 'a') + + line = '[%s](%s), %s \n' % (title, url, content_filename) + f.write(line) + return '%s%s.markdown' % (TAG_PATH, tag) def parseTitle(self, content): re_htmltitle = re.compile(".*(.*).*") From 903fa868398926a3ae7ada04b2211472578a5352 Mon Sep 17 00:00:00 2001 From: Panayotis Vryonis Date: Wed, 30 Mar 2011 10:28:24 +0000 Subject: [PATCH 2/3] Active git branch is defined in settings.py --- gitmark.py | 10 +++++++--- settings.py | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gitmark.py b/gitmark.py index 062cbc41..3c5be168 100644 --- a/gitmark.py +++ b/gitmark.py @@ -67,7 +67,11 @@ def gitCommit(self, msg): subprocess.call(['git', 'commit', '-m', msg], shell=USE_SHELL) def gitPush(self): - pipe = subprocess.Popen("git push origin master", shell=True) + # pipe = subprocess.Popen("git push origin master", shell=True) + # I'm using a separate branch of gitmarks to store my data. + # The active "data" branch is defined in settings.py (defaults to "master") + command = "git push origin %" % GIT_BRANCH + pipe = subprocess.Popen(command, shell=True) pipe.wait() def saveContent(self, filename, content): @@ -88,8 +92,8 @@ def saveTagData(self, tag, url, title, content_filename): os.mkdir(TAG_PATH,0755) f = open('%s%s.markdown' % (TAG_PATH, tag), 'a') - line = '[%s](%s), %s \n' % (title, url, content_filename) - f.write(line) + line = '[%s](%s), %s \n' % (title.decode('utf-8'), url, content_filename) + f.write(line.encode('utf-8')) return '%s%s.markdown' % (TAG_PATH, tag) def parseTitle(self, content): diff --git a/settings.py b/settings.py index 11df11f9..691877c9 100644 --- a/settings.py +++ b/settings.py @@ -2,4 +2,6 @@ CONTENT_PATH = 'content/' -GITMARKS_WEB_PORT = 44865 \ No newline at end of file +GITMARKS_WEB_PORT = 44865 + +GIT_BRANCH = 'master' From 6f61c904c3a052fd5a43fef8f0fa7028a9310d81 Mon Sep 17 00:00:00 2001 From: Panayotis Vryonis Date: Wed, 30 Mar 2011 11:23:32 +0000 Subject: [PATCH 3/3] bug fixes --- gitmark.py | 2 +- settings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitmark.py b/gitmark.py index 3c5be168..ef3fb2f7 100644 --- a/gitmark.py +++ b/gitmark.py @@ -70,7 +70,7 @@ def gitPush(self): # pipe = subprocess.Popen("git push origin master", shell=True) # I'm using a separate branch of gitmarks to store my data. # The active "data" branch is defined in settings.py (defaults to "master") - command = "git push origin %" % GIT_BRANCH + command = "git push origin %s" % GIT_BRANCH pipe = subprocess.Popen(command, shell=True) pipe.wait() diff --git a/settings.py b/settings.py index 691877c9..f6edf6bb 100644 --- a/settings.py +++ b/settings.py @@ -4,4 +4,4 @@ GITMARKS_WEB_PORT = 44865 -GIT_BRANCH = 'master' +GIT_BRANCH = 'mydata'