Loading toMkdocs/toMkdocs.py +9 −3 Original line number Diff line number Diff line Loading @@ -118,13 +118,15 @@ class Clause: self.lines.extend(clause.lines) def asStringList(self) -> list[str]: def asStringList(self, paddings:int = 0) -> list[str]: """ Return the clause as a list of strings. Args: paddings: The number of empty lines to add before the clause. Returns: The clause's lines as a list of strings. """ return [ l.text for l in self.lines ] return [ '\n' for _ in range(paddings) ] + [ l.text for l in self.lines ] def __len__(self) -> int: Loading Loading @@ -480,7 +482,11 @@ def writeClauses(outClauses:list[Clause], filename:str, navTitle:str, addNavTitl if verbose: print(f'[dim]Writing "{f.clauseNumber}.md" - "{f.title}"') with open(f'{os.path.dirname(filename)}/{navTitle}/{f.clauseNumber}.md', 'w') as file: file.writelines(f.asStringList()) # Add one empty line before the clause. This is done to avoid # a bug in MkDocs that does not display the first line of a clause # if it contains a colon. It does not matter otherwise if the line # is empty or not. file.writelines(f.asStringList(1)) # write nav.yml file Loading Loading
toMkdocs/toMkdocs.py +9 −3 Original line number Diff line number Diff line Loading @@ -118,13 +118,15 @@ class Clause: self.lines.extend(clause.lines) def asStringList(self) -> list[str]: def asStringList(self, paddings:int = 0) -> list[str]: """ Return the clause as a list of strings. Args: paddings: The number of empty lines to add before the clause. Returns: The clause's lines as a list of strings. """ return [ l.text for l in self.lines ] return [ '\n' for _ in range(paddings) ] + [ l.text for l in self.lines ] def __len__(self) -> int: Loading Loading @@ -480,7 +482,11 @@ def writeClauses(outClauses:list[Clause], filename:str, navTitle:str, addNavTitl if verbose: print(f'[dim]Writing "{f.clauseNumber}.md" - "{f.title}"') with open(f'{os.path.dirname(filename)}/{navTitle}/{f.clauseNumber}.md', 'w') as file: file.writelines(f.asStringList()) # Add one empty line before the clause. This is done to avoid # a bug in MkDocs that does not display the first line of a clause # if it contains a colon. It does not matter otherwise if the line # is empty or not. file.writelines(f.asStringList(1)) # write nav.yml file Loading