Commit c960a883 authored by Matthieu Boileau's avatar Matthieu Boileau
Browse files

List articles from rubrique id

parent 2461c141
......@@ -509,6 +509,14 @@ class Website:
for pre, fill, rubrique_node in anytree.RenderTree(self.rubrique_nodes['0: root']):
print(f"{pre}{} [{rubrique_node.count}]")
def print_articles(self, id_rubrique):
"""Print the rubrique structure as a tree using anytree""""Spip articles that belong to rubrique {id_rubrique}: {self.labels[id_rubrique]}")
for article in self.articles:
if article.rubrique == id_rubrique and article.type != "rubrique":
print(f"- {article.short_id} # {article.title}")
def _build_doc_index(self):
"""Build the index dictionary: {id_doc: file_path}"""
......@@ -589,6 +597,8 @@ def parse_cl_args():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(description="Convert Spip website as YAML data to Pelican format")
parser.add_argument('-r', '--rubriques', action='store_true', help="Show Spip rubriques structure as a tree")
parser.add_argument('-a', '--articles', metavar="id_rubrique", nargs=1,
help="List Spip articles corresponding to given rubrique id")
parser.add_argument('-c', '--convert', action='store_true', default=True, help="Convert to Pelican")
return parser.parse_args()
......@@ -600,5 +610,7 @@ if __name__ == '__main__':
if args.rubriques:
# Show only Spip rubrique structure
elif args.articles:
Supports Markdown
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