Commit 7fa7a623 authored by Denis Salem's avatar Denis Salem
Browse files

WIP: Fix VenC-Categories so it can be used with chapters

parent c8355c1e
......@@ -120,6 +120,7 @@ footer
width: 100%;}
#blog-categories-header,
#blog-chapters-header,
#blog-navigation-header
{text-transform: uppercase;
text-align: center;
......@@ -130,6 +131,7 @@ footer
margin-top: 1em;}
#blog-categories-header-wrapper,
#blog-chapters-header-wrapper,
#blog-navigation-header-wrapper
{width: 750px;
height: 20px;
......@@ -138,23 +140,23 @@ footer
margin-left: -375px;}
#blog-categories-header-wrapper div,
#blog-chapters-header-wrapper div,
#blog-navigation-header-wrapper div
{width: 315px;
height: 5px;
float: left;
margin-top: 7px;
border-top: 1px solid grey;
border-bottom: 1px solid grey;}
border-bottom: 1px solid grey;
margin-left:5px;}
#blog-categories-header-wrapper div,
#blog-navigation-header-wrapper div
{margin-left:5px;}
#blog-categories-header-wrapper div:first-child,
#blog-chapters-header-wrapper div:first-child,
#blog-navigation-header-wrapper div:first-child
{margin-right:5px;}
#blog-categories-header span,
#blog-chapters-header span,
#blog-navigation-header span
{float: left;}
......
......@@ -25,7 +25,7 @@
.:GetBlogMetadataIfExists::diaspora:: <a href="{value}" class="social-network-item"><img src=".:GetRelativeOrigin:.diaspora.png" alt="Diaspora*" title="Diaspora*"/></a>:.
.:GetBlogMetadataIfExists::mastodon:: <a href="{value}" class="social-network-item"><img src=".:GetRelativeOrigin:.mastodon.png" alt="Mastodon" title="Mastodon"/></a>:.
</div>
.:IfCategories::
<!--.:IfCategories::
<div id="blog-categories-header">
<div id="blog-categories-header-wrapper">
<div></div><span>Categories</span><div></div>
......@@ -35,7 +35,17 @@
.:TreeForBlogCategories::<ul class="__VENC_CATEGORY_NODE__">::<li><a href="{path}" title="{count} publications">{value}</a>::</li>::</ul>:.
</div>
:.
-->
.:IfChapters::
<div id="blog-chapters-header">
<div id="blog-chapters-header-wrapper">
<div></div><span>Chapters</span><div></div>
</div>
</div>
<div id="blog-chapters">
.:Chapters::<ul class="chapter-level{level}">::<li>{index}. <a href="{path}">{title}</a>::</li>::</ul>:.
</div>
:.
.:IfPages::
<div id="blog-navigation-header">
<div id="blog-navigation-header-wrapper">
......
......@@ -187,7 +187,7 @@ class DataStore:
})
def if_categories(self, argv):
if self.entries_per_categories != []:
if self.entries_per_categories != [] and not self.blog_configuration["disable_categories"]:
return argv[0]
else:
......@@ -197,7 +197,7 @@ class DataStore:
return ''
def if_chapters(self, argv):
if self.chapters_index != []:
if self.chapters_index != [] and not self.blog_configuration["disable_chapters"]:
return argv[0]
else:
......@@ -209,7 +209,7 @@ class DataStore:
def root_site_to_jsonld(self):
self.root_as_jsonld = {
q "@context": "http://schema.org",
"@context": "http://schema.org",
"@type": ["Blog","WebPage"],
"@id" : self.blog_configuration["blog_url"]+"/root.jsonld",
"name": self.blog_configuration["blog_name"],
......
......@@ -65,6 +65,7 @@ class PatternsMap():
},
"extra": {
"IfCategories": datastore.if_categories,
"IfChapters": datastore.if_chapters,
"GetEmbedContent": datastore.wrapper_embed_content,
"GetGenerationTimestamp": datastore.get_generation_timestamp,
"CodeHighlight" : code_highlight.highlight,
......
......@@ -40,15 +40,15 @@ def tree_list_dir(root_path, clear):
def test_theme(args, test_name):
refs, theme = args
null = open('/dev/null', 'w')
stdout = sys.stdout
sys.stdout = null
export_blog([theme])
sys.stdout = stdout
tested = tree_list_dir('blog', 1)
refs = tree_list_dir('../refs/'+(theme.capitalize()), 3)
......@@ -58,10 +58,10 @@ def test_theme(args, test_name):
tested_exists_append = tested_exists.append
for f in tested:
if not f in refs:
extra_append(f)
tested_extra_append(f)
else:
tested_exists_append(f)
missings = []
refs_exists = []
missings_append = missings.append
......@@ -95,7 +95,7 @@ def test_theme(args, test_name):
line_index = 0
for l in diff.compare(file_ref, file_tested):
if l[0] in ['-','+'] and not "Page generated" in l:
if (l[0] in ['-','+']) and (not "Page generated" in l):
print(get_formatted_message("\t\tMismatch: "+("refs: \t" if l[0] == '-' else "tested:\t")+refs_exists[index]+": "+str(line_index+1)+": "+l, color="RED", prompt=""))
mismatch = True
......@@ -103,7 +103,7 @@ def test_theme(args, test_name):
line_index -= 2
line_index += 1
if len_missings or len_extra or mismatch:
return False
......
......@@ -12,7 +12,7 @@ date_format: '%A %d. %B %Y'
disable_archives: false
disable_atom_feed: false
disable_categories: false
disable_chapters: true
disable_chapters: false
disable_main_thread: false
disable_rss_feed: false
disable_single_entries: false
......
authors: 'Denis Salem'
categories: 'Templates > Footnotes'
tags: ''
chapter: 1
title: Footnotes unit test
---VENC-BEGIN-PREVIEW---
---VENC-END-PREVIEW---
......
authors: 'Denis Salem'
categories: 'Templates > Patterns > CodeHighlight'
tags: ''
chapter: 1.2
title: CodeHighlight unit test
---VENC-BEGIN-PREVIEW---
---VENC-END-PREVIEW---
......
authors: 'Denis Salem'
categories: ' Templates > Patterns > Latex2MathML'
tags: ''
chapter: 1.2.3
title: Latex2MathML unit test
---VENC-BEGIN-PREVIEW---
---VENC-END-PREVIEW---
......
authors: 'Denis Salem'
categories: 'Templates > Patterns > Escape'
tags: ''
chapter: 2
title: Escape unit test
---VENC-BEGIN-PREVIEW---
---VENC-END-PREVIEW---
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment