add option to prepend id

This commit is contained in:
Guilhem Fauré 2023-06-02 17:56:48 +02:00
parent cea92e59cb
commit 5d25796323
2 changed files with 5 additions and 8 deletions

View File

@ -22,6 +22,7 @@ class Configuration:
output_dir: str = "output/" # The directory to which DB will be exported
data_dir: str = "data/" # The directory in which SPIP images & documents are stored
prepend_h1: bool = True # Add the title of the article as a Markdown h1
prepend_id: bool = True # Add the ID of object before slug
unknown_char_replacement: str = "??" # Replaces unknown characters
export_languages = ("fr", "en") # Languages that will be exported
export_filetype: str = "md" # Extension of exported text files

View File

@ -269,10 +269,8 @@ class Document(WritableObject, NormalizedDocument):
return data_dir + self.fichier
# Get directory of this object
def dest_directory(
self, prepend_id: bool = True, prepend: str = "", append: str = ""
) -> str:
_id: str = str(self._id) + "-" if prepend_id else ""
def dest_directory(self, prepend: str = "", append: str = "") -> str:
_id: str = str(self._id) + "-" if CFG.prepend_id else ""
return (
self._parentdir
+ prepend
@ -361,10 +359,8 @@ class RedactionalObject(WritableObject):
return text
# Get slugified directory of this object
def dest_directory(
self, prepend_id: bool = True, prepend: str = "", append: str = "/"
) -> str:
_id: str = str(self._id) + "-" if prepend_id else ""
def dest_directory(self, prepend: str = "", append: str = "/") -> str:
_id: str = str(self._id) + "-" if CFG.prepend_id else ""
return (
self._parentdir
+ prepend