Commit 24f3e2db authored by Denis Salem's avatar Denis Salem
Browse files

fully factorise for_entry_*

parent 3ca78783
......@@ -168,12 +168,14 @@
DONE | Make entry URL nicer when filename is index.html and has subfolder.
DONE | Fix url with special char in chapter.
DONE | Add CodeHighlightInclude
WIP | Reorganize themes dependencies in setup.
DONE | Reorganize themes dependencies in setup.
WIP | Add relevant templates for themes.
WIP | Client-side search engine.
TODO | Add definition in documentation for optional fields in blog configuration.
WIP | Change nomenclature: Most of the usual patterns are changed. Fix doc.
WIP | Add definition in documentation for optional fields in blog configuration.
WIP | Change nomenclature: Most of the usual patterns are changed. Fix doc.
TODO | Documenter le type des métadonnées: list, str ou dict
TODO | Fix chapters rendering (only first level sub-chapter are rendered for now)
# version 2.1.x
TODO | Include threads preview in entry
TODO | Add command for reorder entries by criteria
......
......@@ -43,7 +43,6 @@ for theme in themes:
src_files
))
extra_files.append((homedir+"/.local/share/VenC/embed_providers/", ["share/embed_providers/oembed.json"]))
extra_files.append((homedir+"/.local/share/VenC/themes_assets", ["share/themes_assets/"+filename for filename in listdir("share/themes_assets")]) )
extra_files.append((homedir+"/.local/share/VenC/themes_includes", ["share/themes_includes/"+filename for filename in listdir("share/themes_includes")]) )
......
......@@ -750,19 +750,23 @@ class DataStore:
def for_entry_metadata(self, argv):
if len(argv) != 3:
raise PatternMissingArguments(expected=3,got=len(argv))
entry = self.entries[self.requested_entry_index]
key = ''.join(argv)
try:
l = getattr(entry, argv[0].strip())
if type(l) != list:
raise GenericMessage(messages.entry_metadata_is_not_a_list.format(argv[0], entry.id))
except:
raise GenericMessage(messages.entry_has_no_metadata_like.format(argv[0]))
if not key in entry.html_for_metadata:
entry.html_for_metadata[key] = ''.join([
try:
l = getattr(entry, argv[0].strip())
if type(l) == dict:
raise GenericMessage(messages.entry_metadata_is_not_a_list.format(argv[0], entry.id))
elif type(l) == str:
l = l.split(",")
except AttributeError as e:
raise GenericMessage(messages.entry_has_no_metadata_like.format(argv[0]))
entry.html_for_metadata[key] = argv[2].join([
argv[1].format(**{"value": item.strip()}) for item in l
])
......
......@@ -112,7 +112,7 @@ class Messages:
theme_has_no_description = "This theme has no description."
undefined_variable = "{0} is undefined in {1}."
too_much_call_of_content = "There is too much call of .:GetEntryContent:. and/or .:GetEntryPreview in {0}"
entry_has_no_metadata_like = "Entry has no metadata identified by {0}."
entry_has_no_metadata_like = "Entry has no metadata identified by \"{0}\"."
blog_has_no_metadata_like = "Blog has no metadata identified by {0}."
invalid_range = "Invalid range {0}:{1}."
entry_metadata_is_not_a_list = "Metadata named \"{0}\" from entry {1} is not a list."
......@@ -110,7 +110,7 @@ class Messages:
theme_has_no_description = "Ce thème n'a pas de description."
undefined_variable = "{0} n'est pas défini dans \"{1}\"."
too_much_call_of_content = "Il y a trop d'appels de .:GetEntryContent:. et/ou de .:GetEntryPreview:. dans {0}"
entry_has_no_metadata_like = "La publication ne possède pas la métadonnée identifié par {0}."
entry_has_no_metadata_like = "La publication ne possède pas la métadonnée identifié par \"{0}\"."
blog_has_no_metadata_like = "Le blog ne possède pas la métadonnée identifié par {0}."
invalid_range = "Plage de nombres invalide {0}:{1}."
entry_metadata_is_not_a_list = "La métadonné \"{0}\" de la publication {1} n'est pas une liste."
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