Commit 6519915b authored by Denis Salem's avatar Denis Salem
Browse files

fix venc migration with missing field, wip on jsonp

parent a6551715
......@@ -165,6 +165,10 @@
WIP | Change nomenclature: Most of the usual patterns are changed. Fix doc.
# version 2.1.x
TODO | Fix gvim / -ex.
TODO | Fix encoding issue in JSON-LD document.
TODO | Catch "OSError: [Errno 98] Address already in use".
TODO | Catch invalid encoding at startup.
TODO | Create entry with default template, if defined.
TODO | Add support for access metadata by key.
TODO | Make some dependencies optional.
......@@ -175,11 +179,9 @@
TODO | Decrease halt_level to render reStructuredText even if errors occurs.
TODO | Access {count} and {weight} from LeavesForEntrycategories.
TODO | Add Yaml comments in blog configuration.
TODO | Catch invalid encoding at startup.
TODO | Add nice 404 errors page.
TODO | Improve Feed.
TODO | Print out what's going on while FTP transfert.
TODO | Fix gvim / -ex.
TODO | Warn about entry title duplicates.
TODO | Handle missing args in case of unknown number of args (Pattern).
TODO | Add configuration field type check.
......@@ -187,17 +189,16 @@
TODO | Concatenate user defined blog keywords with entries keywords.
TODO | Add more informations into JSON-LD document.
TODO | Optimize and refine JSON-LD processing.
TODO | Fix encoding issue in JSON-LD document.
TODO | Embed as much as possible microdata/JSON-LD into blog.
TODO | Automatically add entries categories to entries tags.
TODO | Make entry URL nicer when filename is index.html and has subfolder.
TODO | Catch "OSError: [Errno 98] Address already in use".
TODO | Improve sub folder management in Entry and EntriesThread.
TODO | Optimize objects dereferencing.
TODO | Add draft support.
TODO | Add CPU threads support.
TODO | Regenerate any missing folders.
TODO | Override server port with extra arg.
# version 3.x.x
TODO | Replace categories with taxonomy support.
TODO | Add support for plugin.
......
......@@ -122,7 +122,9 @@ new_keys = {
"disable_rss_feed":False,
"disable_atom_feed":False,
"feed_lenght": 5,
"sort_by":'id'
"sort_by":'id',
"enable_jsonld": True,
"enable_jsonp": True
}
new_path_keys = {
......
......@@ -143,7 +143,8 @@ def new_blog(argv):
"path_encoding": "utf-8",
"server_port": 8888,
"sort_by": "id",
"enable_jsonld": True
"enable_jsonld": True,
"enable_jsonp": True
}
for folder_name in argv:
try:
......
......@@ -54,6 +54,7 @@ class DataStore:
self.blog_configuration = get_blog_configuration()
self.sort_by = self.blog_configuration["sort_by"]
self.enable_jsonld = self.blog_configuration["enable_jsonld"]
self.enable_jsonp = self.blog_configuration["enable_jsonp"]
self.disable_threads = [thread_name.strip() for thread_name in self.blog_configuration["disable_threads"].split(',')]
self.entries = list()
self.entries_per_dates = list()
......@@ -71,7 +72,7 @@ class DataStore:
self.html_chapters = {}
# Build JSON-LD doc if any
if self.enable_jsonld:
if self.enable_jsonld or self.enable_jsonp:
if "https://schema.org" in self.blog_configuration.keys():
self.optionals_schemadotorg = self.blog_configuration["https://schema.org"]
......@@ -85,7 +86,7 @@ class DataStore:
# Build entries
try:
jsonld_callback = self.entry_to_jsonld_callback if self.enable_jsonld else None
jsonld_callback = self.entry_to_jsonld_callback if (self.enable_jsonld or self.enable_jsonp) else None
for filename in yield_entries_content():
self.entries.append(Entry(
filename,
......
......@@ -57,7 +57,8 @@ def get_blog_configuration():
"disable_rss_feed",
"disable_atom_feed",
"sort_by",
"enable_jsonld"
"enable_jsonld",
"enable_jsonp"
]
everything_is_okay = True
......
......@@ -65,7 +65,7 @@ class ArchivesThread(Thread):
continue
super().do()
if self.datastore.enable_jsonld:
if self.datastore.enable_jsonld or self.enable_jsonp:
from venc2.l10n import messages
notify("│\t "+('│' if i != len_archives-1 else ' ')+" └─ "+messages.generating_jsonld_doc)
......
......@@ -126,7 +126,7 @@ class CategoriesThread(Thread):
super().do()
tree_special_char = ' ' if i == len_root-1 else '│'
self.do_feeds(entries, node, tree_special_char)
if self.datastore.enable_jsonld:
if self.datastore.enable_jsonld or self.enable_jsonp:
self.do_jsonld(node, tree_special_char)
# jump to branchs
......
......@@ -131,7 +131,7 @@ class EntriesThread(Thread):
f.write(dump)
def do(self):
if self.datastore.enable_jsonld:
if self.datastore.enable_jsonld or self.enable_jsonp:
notify(self.indentation_level+'└─ '+messages.generating_jsonld_docs)
self.page_number = 0
......
......@@ -67,14 +67,18 @@ class MainThread(Thread):
FeedThread(self.datastore, self.theme, self.patterns_map, "rss").do(entries, self.export_path, self.relative_origin, "│ ", '└' if not self.datastore.enable_jsonld else '├')
def do_jsonld(self):
if self.datastore.enable_jsonld:
if self.datastore.enable_jsonld or self.datastore.enable_jsonp:
from venc2.prompt import notify
from venc2.l10n import messages
import json
notify(self.indentation_level+'└─ '+messages.generating_jsonld_doc)
dump = json.dumps(self.datastore.root_as_jsonld)
if self.datastore.enable_jsonld:
f = open("blog/root.jsonld", 'w')
f.write(dump)
if self.datastore.enable_jsonp
def do(self):
super().do()
......
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