spip specific meta optional
This commit is contained in:
parent
dc80f32df5
commit
548dc36875
@ -51,6 +51,7 @@ class Configuration:
|
|||||||
loglevel: str = "WARNING" # Minimum criticity of logs written in logfile
|
loglevel: str = "WARNING" # Minimum criticity of logs written in logfile
|
||||||
logname: str = "spip2md" # Labelling of logs
|
logname: str = "spip2md" # Labelling of logs
|
||||||
export_filetype: str = "md" # Extension of exported text files
|
export_filetype: str = "md" # Extension of exported text files
|
||||||
|
debug_meta: bool = False # Include more metadata from SPIP DB in frontmatters
|
||||||
# max_articles_export: int = 1000 # TODO reimplement
|
# max_articles_export: int = 1000 # TODO reimplement
|
||||||
# max_sections_export: int = 500 # TODO reimplement
|
# max_sections_export: int = 500 # TODO reimplement
|
||||||
|
|
||||||
|
@ -583,10 +583,13 @@ class SpipRedactional(SpipWritable):
|
|||||||
"lastmod": self.maj,
|
"lastmod": self.maj,
|
||||||
"draft": self._draft,
|
"draft": self._draft,
|
||||||
"description": self._description,
|
"description": self._description,
|
||||||
# Debugging
|
|
||||||
"spip_id_secteur": self.id_secteur,
|
|
||||||
"spip_id": self._id,
|
|
||||||
}
|
}
|
||||||
|
# Add debugging meta if needed
|
||||||
|
if CFG.debug_meta:
|
||||||
|
meta = meta | {
|
||||||
|
"spip_id": self._id,
|
||||||
|
"spip_id_secteur": self.id_secteur,
|
||||||
|
}
|
||||||
# Add url if different of directory
|
# Add url if different of directory
|
||||||
if self.url() not in self.dest_directory():
|
if self.url() not in self.dest_directory():
|
||||||
meta = meta | {"url": self.url()}
|
meta = meta | {"url": self.url()}
|
||||||
@ -723,9 +726,10 @@ class Article(SpipRedactional, SpipArticles):
|
|||||||
"subtitle": self.soustitre,
|
"subtitle": self.soustitre,
|
||||||
"date": self.date_redac,
|
"date": self.date_redac,
|
||||||
"authors": [author.nom for author in self.authors()],
|
"authors": [author.nom for author in self.authors()],
|
||||||
# Debugging
|
|
||||||
"spip_id_rubrique": self.id_rubrique,
|
|
||||||
}
|
}
|
||||||
|
# Add debugging meta if needed
|
||||||
|
if CFG.debug_meta:
|
||||||
|
meta = meta | {"spip_id_rubrique": self.id_rubrique}
|
||||||
if append is not None:
|
if append is not None:
|
||||||
return super().frontmatter(meta | append)
|
return super().frontmatter(meta | append)
|
||||||
else:
|
else:
|
||||||
@ -781,16 +785,17 @@ class Section(SpipRedactional, SpipRubriques):
|
|||||||
class Meta:
|
class Meta:
|
||||||
table_name: str = "spip_rubriques"
|
table_name: str = "spip_rubriques"
|
||||||
|
|
||||||
def frontmatter(self, append: Optional[dict[str, Any]] = None) -> str:
|
def frontmatter(self, add: Optional[dict[str, Any]] = None) -> str:
|
||||||
meta: dict[str, Any] = {
|
meta: dict[str, Any] = {}
|
||||||
# Debugging
|
# Add debugging meta if needed
|
||||||
"spip_id_parent": self.id_parent,
|
if CFG.debug_meta:
|
||||||
"spip_profondeur": self.profondeur,
|
meta = meta | {
|
||||||
}
|
"spip_id_parent": self.id_parent,
|
||||||
if append is not None:
|
"spip_profondeur": self.profondeur,
|
||||||
return super().frontmatter(meta | append)
|
}
|
||||||
else:
|
if add is not None:
|
||||||
return super().frontmatter(meta)
|
meta = meta | add
|
||||||
|
return super().frontmatter(meta)
|
||||||
|
|
||||||
# Get articles of this section
|
# Get articles of this section
|
||||||
def articles(self, limit: int = 10**6) -> tuple[Article]:
|
def articles(self, limit: int = 10**6) -> tuple[Article]:
|
||||||
|
Loading…
Reference in New Issue
Block a user