[sync] page: working with content header for html content
This commit is contained in:
1 parent
3954dfaeb0
commit
f5c42d454f
1 file changed
+17
-12
+17
-12
@@ -54,24 +54,29 @@ def create_document_from_folder(provider, path):
|
|||||||
|
|
||||||
|
|
||||||
def get_manifest(provider, path):
|
def get_manifest(provider, path):
|
||||||
|
dirname = os.path.dirname(path)
|
||||||
data = provider.read(path).read().decode('utf-8')
|
data = provider.read(path).read().decode('utf-8')
|
||||||
y, m = read_yaml_md(data)
|
manifest, body = read_yaml_md(data)
|
||||||
y = y if y else {}
|
manifest = manifest if manifest else {}
|
||||||
|
|
||||||
if 'date' in y:
|
if 'date' in manifest:
|
||||||
y['date'] = create_date(y['date'], settings.date_formats)
|
manifest['date'] = create_date(manifest['date'], settings.date_formats)
|
||||||
|
|
||||||
if 'until' in y:
|
if 'until' in manifest:
|
||||||
y['until'] = create_date(y['until'], settings.date_formats)
|
manifest['until'] = create_date(manifest['until'], settings.date_formats)
|
||||||
|
|
||||||
if 'id' in y:
|
if 'id' in manifest:
|
||||||
y['id'] = str(y['id'])
|
manifest['id'] = str(manifest['id'])
|
||||||
|
|
||||||
|
if 'content' in manifest:
|
||||||
|
body = provider.read(os.path.join(dirname, manifest['content'])).read().decode('utf-8')
|
||||||
|
del manifest['content']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
**y,
|
**manifest,
|
||||||
'data': m,
|
'data': body,
|
||||||
'title': title_from_html(m),
|
'title': title_from_html(body),
|
||||||
'images': images_from_html(m)
|
'images': images_from_html(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user