feat: param line size

This commit is contained in:
egarette@silique.fr 2025-09-29 11:49:35 +02:00
parent 164f8c5a60
commit deee4acd79
6 changed files with 118 additions and 13 deletions

View file

@ -0,0 +1,37 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2025-09-29 11:38+0200\n"
"PO-Revision-Date: 2025-09-29 11:46+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.7\n"
#: src/rougail/output_formatter/__init__.py:105
msgid "the \"step.output\" is not set to \"{0}\""
msgstr "\"step.output\" n'est pas défini pour \"{0}\""
#: src/rougail/output_formatter/__init__.py:155
msgid "only one file is allowed"
msgstr "seulement un fichier est autorisé"
#: src/rougail/output_formatter/__init__.py:158
msgid "only a file is allowed"
msgstr "seulement un fichier est autorisé"
#: src/rougail/output_formatter/config.py:59
msgid "Configuration for rougail-ouput-formatter"
msgstr "Configuration pour rougail-ouput-formatter"
#: src/rougail/output_formatter/config.py:61
msgid "Line size"
msgstr "Taille des lignes"

View file

@ -0,0 +1,37 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-09-29 11:47+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
#: src/rougail/output_formatter/__init__.py:105
msgid "the \"step.output\" is not set to \"{0}\""
msgstr ""
#: src/rougail/output_formatter/__init__.py:155
msgid "only one file is allowed"
msgstr ""
#: src/rougail/output_formatter/__init__.py:158
msgid "only a file is allowed"
msgstr ""
#: src/rougail/output_formatter/config.py:59
msgid "Configuration for rougail-ouput-formatter"
msgstr ""
#: src/rougail/output_formatter/config.py:61
msgid "Line size"
msgstr ""

View file

@ -57,13 +57,10 @@ from rougail.tiramisu import normalize_family, RENAME_TYPE
from rougail.utils import undefined
from .upgrade import RougailUpgrade
from .i18n import _
from .__version__ import __version__
def _(text):
return text
# XXX explicit null
def represent_none(self, data):
return self.represent_scalar("tag:yaml.org,2002:null", "null")
@ -119,6 +116,7 @@ class RougailOutputFormatter:
self.attributes = {}
self.yaml = YAML()
self.yaml.width = self.rougailconfig["formatter.line_width"]
self.conv_yaml = YAML()
def run(self):

View file

@ -17,28 +17,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from pathlib import Path
from .i18n import _
def get_rougail_config(
*,
backward_compatibility=True,
) -> dict:
options = """
options = f"""
load_unexist_redefine:
redefine: true
type: boolean
default:
jinja: >-
{% if step.output is not propertyerror and step.output == 'formatter' %}
{{% if step.output is not propertyerror and step.output == 'formatter' %}}
true
{% else %}
{{% else %}}
false
{% endif %}
{{% endif %}}
hidden:
jinja: >-
{% if step.output is not propertyerror and step.output == 'formatter' %}
{{% if step.output is not propertyerror and step.output == 'formatter' %}}
load_unexist_redefine is always true with 'formatter' output
{% endif %}
{{% endif %}}
cli:
@ -48,11 +49,16 @@ cli:
type: boolean
default:
jinja: >-
{% if step.output is not propertyerror and step.output == 'formatter' %}
{{% if step.output is not propertyerror and step.output == 'formatter' %}}
false
{% else %}
{{% else %}}
true
{% endif %}
{{% endif %}}
formatter:
description: {_('Configuration for rougail-ouput-formatter')}
line_width: 120 # {_('Line size')}
"""
return {
"name": "formatter",

View file

@ -0,0 +1,27 @@
"""Internationalisation utilities
Silique (https://www.silique.fr)
Copyright (C) 2025
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
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from gettext import translation
from pathlib import Path
t = translation(
"rougail_output_formatter", str(Path(__file__).parent / "locale"), fallback=True
)
_ = t.gettext