Skip to content

Tag files are formatted in markdown and named .markdown. #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions gitmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 %s" % GIT_BRANCH
pipe = subprocess.Popen(command, shell=True)
pipe.wait()

def saveContent(self, filename, content):
Expand All @@ -83,13 +87,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.decode('utf-8'), url, content_filename)
f.write(line.encode('utf-8'))
return '%s%s.markdown' % (TAG_PATH, tag)

def parseTitle(self, content):
re_htmltitle = re.compile(".*<title>(.*)</title>.*")
Expand Down
4 changes: 3 additions & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

CONTENT_PATH = 'content/'

GITMARKS_WEB_PORT = 44865
GITMARKS_WEB_PORT = 44865

GIT_BRANCH = 'mydata'