adjust css for subfolder
This commit is contained in:
parent
e37c9dfb27
commit
55bdc78582
17
microblog.py
17
microblog.py
@ -139,7 +139,7 @@ class Paginator:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def toc(self, n=None, page=None): #style 1
|
def toc(self, n=None, page=None): #style 1
|
||||||
if self.TOTAL_PAGES < 1 or (n == None and page == None):
|
if self.TOTAL_PAGES < 1 or (n == None or page == None):
|
||||||
return "[no pages]"
|
return "[no pages]"
|
||||||
# For page 'n' do not create an anchor tag
|
# For page 'n' do not create an anchor tag
|
||||||
fmt = "<a href=\"%s/%s\">[%i]</a>" #(self.subdir, page, page number)
|
fmt = "<a href=\"%s/%s\">[%i]</a>" #(self.subdir, page, page number)
|
||||||
@ -184,6 +184,17 @@ if __name__ == "__main__":
|
|||||||
email = sys.argv[3] if (argc >= 4) else None
|
email = sys.argv[3] if (argc >= 4) else None
|
||||||
return template, content, email
|
return template, content, email
|
||||||
|
|
||||||
|
# change the path of css for pages in a separate dir from index
|
||||||
|
def adjust_css(template):
|
||||||
|
# in order
|
||||||
|
x = template.find("./style.css")
|
||||||
|
y = template.find("./timeline.css")
|
||||||
|
chars = [char for char in template]
|
||||||
|
chars.insert(x, '.')
|
||||||
|
y += 1
|
||||||
|
chars.insert(y, '.')
|
||||||
|
return "".join(chars)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
template, content, email = get_args()
|
template, content, email = get_args()
|
||||||
tl, tc = make_timeline(content, email)
|
tl, tc = make_timeline(content, email)
|
||||||
@ -194,13 +205,13 @@ if __name__ == "__main__":
|
|||||||
html = f.read()
|
html = f.read()
|
||||||
#print(html % (count, "\n".join(tcl), "\n\n".join(tl)))
|
#print(html % (count, "\n".join(tcl), "\n\n".join(tl)))
|
||||||
count = len(tl)
|
count = len(tl)
|
||||||
posts_per_page = 5
|
posts_per_page = 20
|
||||||
pagectrl = Paginator(count, posts_per_page)
|
pagectrl = Paginator(count, posts_per_page)
|
||||||
if count <= posts_per_page:
|
if count <= posts_per_page:
|
||||||
print(pagectrl.paginate(html, tcl, timeline))
|
print(pagectrl.paginate(html, tcl, timeline))
|
||||||
else:
|
else:
|
||||||
latest = tl[:posts_per_page]
|
latest = tl[:posts_per_page]
|
||||||
print(pagectrl.singlepage(html, tcl, latest))
|
print(pagectrl.singlepage(html, tcl, latest))
|
||||||
pagectrl.paginate(html, tcl, tl)
|
pagectrl.paginate(adjust_css(html), tcl, tl)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user