feat: param line size
This commit is contained in:
parent
164f8c5a60
commit
deee4acd79
6 changed files with 118 additions and 13 deletions
37
locale/fr/LC_MESSAGES/rougail_output_formatter.po
Normal file
37
locale/fr/LC_MESSAGES/rougail_output_formatter.po
Normal 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"
|
||||||
37
locale/rougail_output_formatter.pot
Normal file
37
locale/rougail_output_formatter.pot
Normal 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 ""
|
||||||
|
|
||||||
|
|
@ -57,13 +57,10 @@ from rougail.tiramisu import normalize_family, RENAME_TYPE
|
||||||
from rougail.utils import undefined
|
from rougail.utils import undefined
|
||||||
|
|
||||||
from .upgrade import RougailUpgrade
|
from .upgrade import RougailUpgrade
|
||||||
|
from .i18n import _
|
||||||
from .__version__ import __version__
|
from .__version__ import __version__
|
||||||
|
|
||||||
|
|
||||||
def _(text):
|
|
||||||
return text
|
|
||||||
|
|
||||||
|
|
||||||
# XXX explicit null
|
# XXX explicit null
|
||||||
def represent_none(self, data):
|
def represent_none(self, data):
|
||||||
return self.represent_scalar("tag:yaml.org,2002:null", "null")
|
return self.represent_scalar("tag:yaml.org,2002:null", "null")
|
||||||
|
|
@ -119,6 +116,7 @@ class RougailOutputFormatter:
|
||||||
self.attributes = {}
|
self.attributes = {}
|
||||||
|
|
||||||
self.yaml = YAML()
|
self.yaml = YAML()
|
||||||
|
self.yaml.width = self.rougailconfig["formatter.line_width"]
|
||||||
self.conv_yaml = YAML()
|
self.conv_yaml = YAML()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
|
||||||
|
|
@ -17,28 +17,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from .i18n import _
|
||||||
|
|
||||||
|
|
||||||
def get_rougail_config(
|
def get_rougail_config(
|
||||||
*,
|
*,
|
||||||
backward_compatibility=True,
|
backward_compatibility=True,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
options = """
|
options = f"""
|
||||||
load_unexist_redefine:
|
load_unexist_redefine:
|
||||||
redefine: true
|
redefine: true
|
||||||
type: boolean
|
type: boolean
|
||||||
default:
|
default:
|
||||||
jinja: >-
|
jinja: >-
|
||||||
{% if step.output is not propertyerror and step.output == 'formatter' %}
|
{{% if step.output is not propertyerror and step.output == 'formatter' %}}
|
||||||
true
|
true
|
||||||
{% else %}
|
{{% else %}}
|
||||||
false
|
false
|
||||||
{% endif %}
|
{{% endif %}}
|
||||||
hidden:
|
hidden:
|
||||||
jinja: >-
|
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
|
load_unexist_redefine is always true with 'formatter' output
|
||||||
{% endif %}
|
{{% endif %}}
|
||||||
|
|
||||||
cli:
|
cli:
|
||||||
|
|
||||||
|
|
@ -48,11 +49,16 @@ cli:
|
||||||
type: boolean
|
type: boolean
|
||||||
default:
|
default:
|
||||||
jinja: >-
|
jinja: >-
|
||||||
{% if step.output is not propertyerror and step.output == 'formatter' %}
|
{{% if step.output is not propertyerror and step.output == 'formatter' %}}
|
||||||
false
|
false
|
||||||
{% else %}
|
{{% else %}}
|
||||||
true
|
true
|
||||||
{% endif %}
|
{{% endif %}}
|
||||||
|
|
||||||
|
formatter:
|
||||||
|
description: {_('Configuration for rougail-ouput-formatter')}
|
||||||
|
|
||||||
|
line_width: 120 # {_('Line size')}
|
||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
"name": "formatter",
|
"name": "formatter",
|
||||||
|
|
|
||||||
27
src/rougail/output_formatter/i18n.py
Normal file
27
src/rougail/output_formatter/i18n.py
Normal 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
|
||||||
|
|
||||||
Binary file not shown.
Loading…
Reference in a new issue