Open GoogleCodeExporter opened 8 years ago
Yes, you're right. Thanks for pointing this out. I will look into a fix.
For the time being, you can type '+' when the cursor is on them. I realize
this is not a very practical solution, although it could get you started with a
creative "hack" ...
- S.
Original comment by stu.andrews
on 25 Aug 2012 at 4:53
[deleted comment]
Here's my hack:
{{{
#!/usr/bin/python
# generate a markdown diary
import glob
import re
import os.path
files = glob.glob('*.md')
dates = []
diary_file_re = re.compile('(\d\d\d\d)\-(\d\d)\-(\d\d).md')
for f in sorted(files, reverse=True):
m = diary_file_re.match(f)
if m:
date = dict( zip( ('file','year','month','day'), (f,)+m.groups() ) )
dates.append( date )
pyear = 0
pmonth = 0
print "# Diary\n"
month_name=['bug','January','Febuary','March','April','May','June','July','Augus
t','September','October','November','December']
for date in dates:
if date['year'] != pyear:
print "##",date['year'],"\n"
pyear = date['year']
pmonth = 0
if date['month'] != pmonth:
print "###",month_name[ int(date['month']) ],"\n"
pmonth = date['month']
(basename,_) = os.path.splitext( date['file'] )
print "[%s](%s)\n" % (basename,basename)
}}}
Original comment by 415...@gmail.com
on 25 Nov 2012 at 6:11
Here's one with a bit more noise which I guess would be a matter of taste.
{{{
#!/usr/bin/python
# generate a markdown diary
import glob
import re
import os.path
files = glob.glob('*.md')
dates = []
diary_file_re = re.compile('(\d\d\d\d)\-(\d\d)\-(\d\d).md')
markdown_heading_re = re.compile('^\s*\#+?\s+?(.*?)\#*?\s*?$',re.MULTILINE)
for f in sorted(files, reverse=True):
m = diary_file_re.match(f)
if m:
date = dict( zip( ('file','year','month','day'), (f,)+m.groups() ) )
dates.append( date )
pyear = 0
pmonth = 0
print "# Diary\n"
month_name=['bug','January','Febuary','March','April','May','June','July','Augus
t','September','October','November','December']
for date in dates:
if date['year'] != pyear:
print "##",date['year'],"\n"
pyear = date['year']
pmonth = 0
if date['month'] != pmonth:
print "###",month_name[ int(date['month']) ],"\n"
pmonth = date['month']
(basename,_) = os.path.splitext( date['file'] )
print "#### [%s](%s)\n" % (basename,basename)
f = open( date['file'] )
s = f.read()
f.close()
for h in markdown_heading_re.findall( s ):
print h,'\n'
}}}
Original comment by 415...@gmail.com
on 25 Nov 2012 at 7:07
Original issue reported on code.google.com by
vper...@gmail.com
on 25 Aug 2012 at 10:04