fix: without namespace

This commit is contained in:
egarette@silique.fr 2026-06-11 08:09:04 +02:00
parent 106357a27c
commit df5f3b6782
3 changed files with 31 additions and 28 deletions

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2022-2025 Copyright (C) 2022-2026
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the
@ -28,7 +28,7 @@ from .i18n import _
from .__version__ import __version__ from .__version__ import __version__
TABULATE = {"console": "plain", TABULATE = {"console": "heavy_grid",
"html": "unsafehtml", "html": "unsafehtml",
} }
ENTER = {"github": '<br/>'} ENTER = {"github": '<br/>'}
@ -57,11 +57,7 @@ class RougailOutputTable:
) )
self.rougailconfig = rougailconfig self.rougailconfig = rougailconfig
self.config = config self.config = config
try: self.support_namespace = rougailconfig["main_namespace"] is not None
groups.namespace
self.support_namespace = True
except AttributeError:
self.support_namespace = False
if user_data_errors: if user_data_errors:
self.errors = user_data_errors.copy() self.errors = user_data_errors.copy()
else: else:
@ -80,6 +76,7 @@ class RougailOutputTable:
self.columns = self.rougailconfig["table.columns"].copy() self.columns = self.rougailconfig["table.columns"].copy()
self.first_column = self.rougailconfig["table.first_column"] self.first_column = self.rougailconfig["table.first_column"]
if self.first_column == 'namespace': if self.first_column == 'namespace':
if self.support_namespace:
self.columns.insert(0, 'namespace') self.columns.insert(0, 'namespace')
else: else:
self.columns.insert(0, 'description') self.columns.insert(0, 'description')
@ -88,7 +85,10 @@ class RougailOutputTable:
namespace = option.description() namespace = option.description()
else: else:
namespace = "" namespace = ""
if option.isoptiondescription():
self.walk(option, namespace) self.walk(option, namespace)
else:
self.manage(option, namespace)
if self.rougailconfig["table.header"]: if self.rougailconfig["table.header"]:
headers = tuple([col.capitalize() for col in self.columns]) headers = tuple([col.capitalize() for col in self.columns])
else: else:
@ -117,11 +117,14 @@ class RougailOutputTable:
def walk(self, config, namespace): def walk(self, config, namespace):
for option in config: for option in config:
self.manage(option, namespace)
def manage(self, option, namespace):
if option.isoptiondescription(): if option.isoptiondescription():
self.walk(option, namespace) self.walk(option, namespace)
tags = option.information.get('tags', []) tags = option.information.get('tags', [])
if not tags: if not tags:
continue return
for col in self.columns: for col in self.columns:
if col in tags: if col in tags:
value = option.value.get() value = option.value.get()

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2025 Copyright (C) 2025-2026
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,6 +1,6 @@
"""Internationalisation utilities """Internationalisation utilities
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2025 Copyright (C) 2025-2026
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the