Skip to content

Commit

Permalink
add config item: nopublic_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
LeslieZhu committed Jul 21, 2016
1 parent 5b0e1e7 commit 20e3480
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions orgnote/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class Config(object):
# Category & Tag
default_tag: "默认"
# Nopublic Tab
nopublic_tag: "暂不公开"
# Theme
# the default is 'freemind' and it's only theme for OrgNote now
theme: freemind
Expand Down
13 changes: 8 additions & 5 deletions orgnote/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def __init__(self):
self.duoshuo_shortname = self.cfg.cfg.get("duoshuo_shortname",None)

self.default_tag = self.cfg.cfg.get("default_tag","默认")
self.nopublic_tag = self.cfg.cfg.get("nopublic_tag","暂不公开")


self.per_page = self.cfg.cfg.get("per_page",6)

Expand All @@ -78,7 +80,8 @@ def __init__(self):
self.dirs = [self.source_dir + "/public.org", self.source_dir + "/nopublic.org"]

self.minyi = [
[self.public_dir + "tags/nopublic.html","fa fa-link","暂不公开"]
#[self.public_dir + "tags/nopublic.html","fa fa-link",self.nopublic_tag]
[self.public_dir + "tags/" + self.nopublic_tag + ".html","fa fa-link",self.nopublic_tag]
]


Expand Down Expand Up @@ -819,7 +822,7 @@ def gen_page(self,note=list(),num=0,public=True):
if public:
print >> output,self.contain_prefix(self.page_tags[note[0]],"标签: ",util.gen_title(note[0]))
else:
print >> output,self.contain_prefix(['nopublic'],"标签: ",util.gen_title(note[0]))
print >> output,self.contain_prefix([self.nopublic_tag],"标签: ",util.gen_title(note[0]))
print >> output,self.contain_page(note[0],num,public) # auto gen
print >> output,self.gen_sidebar()
print >> output,self.contain_suffix()
Expand Down Expand Up @@ -928,11 +931,11 @@ def gen_timetags(self):
output.close()

def gen_nopublic(self):
output = open("./" + self.public_dir + "tags/nopublic.html","w")
print >> output,self.header_prefix(title="nopublic")
output = open("./" + self.public_dir + "tags/" + self.nopublic_tag + ".html","w")
print >> output,self.header_prefix(title=self.nopublic_tag)
print >> output,self.body_prefix()
print >> output,self.body_menu(self.menus)
print >> output,self.contain_prefix(["nopublic"],"分类: ","暂不公开")
print >> output,self.contain_prefix([self.nopublic_tag],"分类: ",self.nopublic_tag)
print >> output,self.contain_archive(self.localnotes) # auto gen
print >> output,self.contain_suffix()
print >> output,self.header_suffix()
Expand Down

0 comments on commit 20e3480

Please sign in to comment.