This commit is contained in:
hoangvv 2025-02-28 02:35:19 +07:00
parent d9cb9d975f
commit 6b0c648c8e
9 changed files with 192 additions and 165 deletions

View File

@ -216,7 +216,6 @@ myst_enable_extensions = [
"fieldlist", "fieldlist",
"html_admonition", "html_admonition",
"html_image", "html_image",
"linkify",
"replacements", "replacements",
"smartquotes", "smartquotes",
"strikethrough", "strikethrough",

40
config.yaml Normal file
View File

@ -0,0 +1,40 @@
# -d, --dry-run Do not write/remove any files
# -R, --replace-files Remove parsed files
# -S, --stop-on-fail Stop on first failure
# -W, --raise-on-warning Raise exception on parsing warning
# -l, --language TEXT Language code for directive names [default:
# en]
# --sphinx / --no-sphinx Load sphinx. [default: sphinx]
# -e, --extensions TEXT A comma-separated list of sphinx extensions
# to load.
# -dd, --default-domain TEXT Default sphinx domain [default: py]
# -dr, --default-role TEXT Default sphinx role [default: convert to
# literal]
# -cp, --cite-prefix TEXT Prefix to add to citation references
# [default: cite]
# --consecutive-numbering / --no-consecutive-numbering
# Apply consecutive numbering to ordered lists
# [default: consecutive-numbering]
# --colon-fences / --no-colon-fences
# Use colon fences for directives with parsed
# content [default: colon-fences]
# --dollar-math / --no-dollar-math
# Convert math (where possible) to dollar-
# delimited math [default: dollar-math]
# -c, --conversions PATH YAML file mapping directives -> conversions
# --encoding TEXT Encoding for read/write [default: utf8]
# --config FILE YAML file to read default configuration from
# -h, --help Show this message and exit.
language: en
sphinx: true
extensions:
- sphinx.ext.intersphinx
- sphinx.ext.todo
- sphinx_tabs.tabs
default_conversion: parse_all
conversions:
docutils.parsers.rst.directives.images.image: parse_content
default_domain: py
consecutive_numbering: true
colon_fences: true
dollar_math: true

View File

@ -42,7 +42,7 @@ and then push them to GitHub. Skip this section and go to
affecting the main codebase. Skip this step if you work at Odoo. affecting the main codebase. Skip this step if you work at Odoo.
4. ```{eval-rst} 4. ```{eval-rst}
.. include:: install_git.rst .. include:: install_git.md
``` ```
5. Configure Git to identify yourself as the author of your future contributions. Enter the same 5. Configure Git to identify yourself as the author of your future contributions. Enter the same

View File

@ -64,7 +64,7 @@ to make changes from the GitHub interface.
without affecting the main codebase. Skip this step if you work at Odoo. without affecting the main codebase. Skip this step if you work at Odoo.
04. ```{eval-rst} 04. ```{eval-rst}
.. include:: install_git.rst .. include:: install_git.md
``` ```
05. Configure Git to identify yourself as the author of your future contributions. Enter the same 05. Configure Git to identify yourself as the author of your future contributions. Enter the same

View File

@ -33,17 +33,17 @@ Avoid duplicating content whenever possible; if a topic is already documented on
::: :::
:::{important} :::{important}
When deleting or moving a `.rst` file, update the corresponding text file in the When deleting or moving a `.md` file, update the corresponding text file in the
{file}`redirects` folder based on your branch's version (e.g., {file}`17.0.txt`). To do so, add a {file}`redirects` folder based on your branch's version (e.g., {file}`17.0.txt`). To do so, add a
new line at the bottom of the relevant section (e.g., `# applications/sales`). On this line, new line at the bottom of the relevant section (e.g., `# applications/sales`). On this line,
first, add the redirection entry point with the old file location, followed by a space, and then first, add the redirection entry point with the old file location, followed by a space, and then
add the exit point with the new or relevant file location. For example, if moving the file add the exit point with the new or relevant file location. For example, if moving the file
{file}`unsplash.rst` from {file}`applications/websites/website/configuration` to {file}`unsplash.md` from {file}`applications/websites/website/configuration` to
{file}`applications/general/integrations`, add the following entry under the section {file}`applications/general/integrations`, add the following entry under the section
`# applications/websites`: `# applications/websites`:
```text ```text
applications/websites/website/configuration/unsplash.rst applications/general/integrations/unsplash.rst applications/websites/website/configuration/unsplash.md applications/general/integrations/unsplash.md
``` ```
::: :::
@ -302,7 +302,7 @@ A **media filename**:
Each RST file has its own folder for storing media files. The folder's name must be the same as the Each RST file has its own folder for storing media files. The folder's name must be the same as the
RST file's name. RST file's name.
For example, the document {file}`doc_filename.rst` refers to two images that are placed in the For example, the document {file}`doc_filename.md` refers to two images that are placed in the
folder `doc_filename`. folder `doc_filename`.
``` ```
@ -310,7 +310,7 @@ folder `doc_filename`.
│ └── doc_filename │ └── doc_filename
│ │ └── screenshot-tips.gif │ │ └── screenshot-tips.gif
│ │ └── awesome-filename.png │ │ └── awesome-filename.png
│ └── doc_filename.rst │ └── doc_filename.md
``` ```
:::{note} :::{note}

View File

@ -72,22 +72,22 @@ location *relative* to that of the source document.
│ │ │ └── sales │ │ │ └── sales
│ │ │ │ └── products_prices │ │ │ │ └── products_prices
│ │ │ │ │ └── products │ │ │ │ │ └── products
│ │ │ │ │ │ └── import.rst │ │ │ │ │ │ └── import.md
│ │ │ │ │ │ └── variants.rst │ │ │ │ │ │ └── variants.md
│ │ │ │ │ └── prices.rst │ │ │ │ │ └── prices.md
A reference to :file:`prices.rst` and :file:`variants.rst` could be made from :file:`import.rst` A reference to :file:`prices.md` and :file:`variants.md` could be made from :file:`import.md`
as follows: as follows:
#. Absolute: #. Absolute:
- `documentation/content/applications/sales/sales/products_prices/prices.rst` - `documentation/content/applications/sales/sales/products_prices/prices.md`
- `documentation/content/applications/sales/sales/products_prices/products/variants.rst` - `documentation/content/applications/sales/sales/products_prices/products/variants.md`
#. Relative: #. Relative:
- `../prices.rst` - `../prices.md`
- `variants.rst` - `variants.md`
``` ```
(contributing-rst-update-targets)= (contributing-rst-update-targets)=

View File

@ -81,15 +81,15 @@ The root element of form views is `form`.
Optional attributes can be added to the root element `form` to customize the view. Optional attributes can be added to the root element `form` to customize the view.
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_string.rst .. include:: view_architectures/root_attribute_string.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_create.rst .. include:: view_architectures/root_attribute_create.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_edit.rst .. include:: view_architectures/root_attribute_edit.md
``` ```
```{eval-rst} ```{eval-rst}
@ -104,7 +104,7 @@ Optional attributes can be added to the root element `form` to customize the vie
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_delete.rst .. include:: view_architectures/root_attribute_delete.md
``` ```
```{eval-rst} ```{eval-rst}
@ -163,7 +163,7 @@ exist with different values for the `required` attribute.
The `field` element can have the following attributes: The `field` element can have the following attributes:
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_name.rst .. include:: view_architectures/field_attribute_name.md
``` ```
```{eval-rst} ```{eval-rst}
@ -179,7 +179,7 @@ The `field` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_string.rst .. include:: view_architectures/field_attribute_string.md
``` ```
```{eval-rst} ```{eval-rst}
@ -214,19 +214,19 @@ The `field` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_readonly.rst .. include:: view_architectures/field_attribute_readonly.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_required.rst .. include:: view_architectures/field_attribute_required.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_groups.rst .. include:: view_architectures/generic_attribute_groups.md
``` ```
```{eval-rst} ```{eval-rst}
@ -313,7 +313,7 @@ The `field` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_class.rst .. include:: view_architectures/generic_attribute_class.md
``` ```
```{eval-rst} ```{eval-rst}
@ -432,11 +432,11 @@ The `label` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_class.rst .. include:: view_architectures/generic_attribute_class.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
(reference-view-architectures-form-button)= (reference-view-architectures-form-button)=
@ -453,39 +453,39 @@ The `label` element can have the following attributes:
The `button` element can have the following attributes: The `button` element can have the following attributes:
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_type.rst .. include:: view_architectures/button_attribute_type.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_name.rst .. include:: view_architectures/button_attribute_name.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_string.rst .. include:: view_architectures/button_attribute_string.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_icon.rst .. include:: view_architectures/button_attribute_icon.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_help.rst .. include:: view_architectures/button_attribute_help.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_context.rst .. include:: view_architectures/button_attribute_context.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_groups.rst .. include:: view_architectures/generic_attribute_groups.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_class.rst .. include:: view_architectures/generic_attribute_class.md
``` ```
```{eval-rst} ```{eval-rst}
@ -671,7 +671,7 @@ The `group` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
:::{admonition} Possible structure and representation of its rendering :::{admonition} Possible structure and representation of its rendering
@ -759,7 +759,7 @@ The `page` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
:::{admonition} Possible structure and representation of its rendering :::{admonition} Possible structure and representation of its rendering
@ -1112,11 +1112,11 @@ The `app` element can have the following attributes:
% todo: document attribute notApp % todo: document attribute notApp
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_groups.rst .. include:: view_architectures/generic_attribute_groups.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
(reference-view-architectures-settings-block)= (reference-view-architectures-settings-block)=
@ -1163,11 +1163,11 @@ The `block` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_groups.rst .. include:: view_architectures/generic_attribute_groups.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
(reference-view-architectures-settings-setting)= (reference-view-architectures-settings-setting)=
@ -1279,11 +1279,11 @@ The `<setting>` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_groups.rst .. include:: view_architectures/generic_attribute_groups.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
(reference-view-architectures-list)= (reference-view-architectures-list)=
@ -1315,19 +1315,19 @@ The root element of list views is `list` (the previous name was `tree`).
Optional attributes can be added to the root element `list` to customize the view. Optional attributes can be added to the root element `list` to customize the view.
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_string.rst .. include:: view_architectures/root_attribute_string.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_create.rst .. include:: view_architectures/root_attribute_create.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_edit.rst .. include:: view_architectures/root_attribute_edit.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_delete.rst .. include:: view_architectures/root_attribute_delete.md
``` ```
```{eval-rst} ```{eval-rst}
@ -1409,11 +1409,11 @@ Optional attributes can be added to the root element `list` to customize the vie
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_default_group_by.rst .. include:: view_architectures/root_attribute_default_group_by.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_default_order.rst .. include:: view_architectures/root_attribute_default_order.md
``` ```
```{eval-rst} ```{eval-rst}
@ -1476,7 +1476,7 @@ Optional attributes can be added to the root element `list` to customize the vie
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_sample.rst .. include:: view_architectures/root_attribute_sample.md
``` ```
(reference-view-architectures-list-components)= (reference-view-architectures-list-components)=
@ -1510,11 +1510,11 @@ Using the same field multiple times in a list view is not supported
The `field` element can have the following attributes: The `field` element can have the following attributes:
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_name.rst .. include:: view_architectures/field_attribute_name.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_string.rst .. include:: view_architectures/field_attribute_string.md
``` ```
```{eval-rst} ```{eval-rst}
@ -1547,23 +1547,23 @@ The `field` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_readonly.rst .. include:: view_architectures/field_attribute_readonly.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_required.rst .. include:: view_architectures/field_attribute_required.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_column_invisible.rst .. include:: view_architectures/generic_attribute_column_invisible.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_groups.rst .. include:: view_architectures/generic_attribute_groups.md
``` ```
```{eval-rst} ```{eval-rst}
@ -1679,43 +1679,43 @@ form view, as they cannot be grouped.
The `button` element can have the following attributes: The `button` element can have the following attributes:
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_type.rst .. include:: view_architectures/button_attribute_type.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_name.rst .. include:: view_architectures/button_attribute_name.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_string.rst .. include:: view_architectures/button_attribute_string.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_icon.rst .. include:: view_architectures/button_attribute_icon.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_help.rst .. include:: view_architectures/button_attribute_help.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/button_attribute_context.rst .. include:: view_architectures/button_attribute_context.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_groups.rst .. include:: view_architectures/generic_attribute_groups.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_column_invisible.rst .. include:: view_architectures/generic_attribute_column_invisible.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_class.rst .. include:: view_architectures/generic_attribute_class.md
``` ```
:::{admonition} Possible structure and representation of its rendering :::{admonition} Possible structure and representation of its rendering
@ -2011,7 +2011,7 @@ The `field` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_string.rst .. include:: view_architectures/field_attribute_string.md
``` ```
```{eval-rst} ```{eval-rst}
@ -2077,11 +2077,11 @@ The `field` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_groups.rst .. include:: view_architectures/generic_attribute_groups.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
:::{admonition} Possible structure and representation of its rendering :::{admonition} Possible structure and representation of its rendering
@ -2307,11 +2307,11 @@ The `filter` element can have the following attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_invisible.rst .. include:: view_architectures/generic_attribute_invisible.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_groups.rst .. include:: view_architectures/generic_attribute_groups.md
``` ```
```{eval-rst} ```{eval-rst}
@ -2455,7 +2455,7 @@ attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_string.rst .. include:: view_architectures/field_attribute_string.md
``` ```
```{eval-rst} ```{eval-rst}
@ -2481,7 +2481,7 @@ attributes:
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/generic_attribute_groups.rst .. include:: view_architectures/generic_attribute_groups.md
``` ```
```{eval-rst} ```{eval-rst}
@ -2673,27 +2673,27 @@ still be opened by the user.
Optional attributes can be added to the root element `kanban` to customize the view. Optional attributes can be added to the root element `kanban` to customize the view.
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_string.rst .. include:: view_architectures/root_attribute_string.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_create.rst .. include:: view_architectures/root_attribute_create.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_edit.rst .. include:: view_architectures/root_attribute_edit.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_delete.rst .. include:: view_architectures/root_attribute_delete.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_default_group_by.rst .. include:: view_architectures/root_attribute_default_group_by.md
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_default_order.rst .. include:: view_architectures/root_attribute_default_order.md
``` ```
```{eval-rst} ```{eval-rst}
@ -2851,7 +2851,7 @@ Optional attributes can be added to the root element `kanban` to customize the v
``` ```
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_sample.rst .. include:: view_architectures/root_attribute_sample.md
``` ```
(reference-view-architectures-kanban-components)= (reference-view-architectures-kanban-components)=
@ -2900,7 +2900,7 @@ Inside those templates, the `field` element allows to render a field. It can hav
attributes: attributes:
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/field_attribute_name.rst .. include:: view_architectures/field_attribute_name.md
``` ```
By default, field nodes are replaced by a `span` containing their formatted value, unless the By default, field nodes are replaced by a `span` containing their formatted value, unless the
@ -3345,7 +3345,7 @@ The main additions of qweb-as-view to the basic qweb-as-template are:
context: context:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`model` `model`
@ -3383,7 +3383,7 @@ record groups. Its root element is `<graph>` which can take the following
attributes: attributes:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`type` (optional) `type` (optional)
@ -3410,14 +3410,14 @@ attributes:
: string displayed in the breadcrumbs when redirecting to list view. : string displayed in the breadcrumbs when redirecting to list view.
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_sample.rst .. include:: view_architectures/root_attribute_sample.md
``` ```
The only allowed element within a graph view is `field` which can have the The only allowed element within a graph view is `field` which can have the
following attributes: following attributes:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`name` (mandatory) `name` (mandatory)
@ -3475,7 +3475,7 @@ The pivot view is used to visualize aggregations as a [pivot table]. Its root
element is `<pivot>` which can take the following attributes: element is `<pivot>` which can take the following attributes:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`disable_linking` (optional) `disable_linking` (optional)
@ -3501,7 +3501,7 @@ The only allowed element within a pivot view is `field` which can have the
following attributes: following attributes:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`name` (mandatory) `name` (mandatory)
@ -3520,7 +3520,7 @@ following attributes:
aggregated value within a group. Possible values are: aggregated value within a group. Possible values are:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`row` (default) `row` (default)
@ -3548,7 +3548,7 @@ following attributes:
such as fields in different units, e.g. € and \$). such as fields in different units, e.g. € and \$).
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_sample.rst .. include:: view_architectures/root_attribute_sample.md
``` ```
The measures are automatically generated from the model fields; only the The measures are automatically generated from the model fields; only the
@ -3608,14 +3608,14 @@ calendar view are:
Disable/enable record deletion on the view through the **Action** dropdown. Disable/enable record deletion on the view through the **Action** dropdown.
.. rst-class:: o-definition-list .. container:: o-definition-list
``date_start`` (required) ``date_start`` (required)
name of the record's field holding the start date for the event name of the record's field holding the start date for the event
``` ```
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`date_start` (required) `date_start` (required)
@ -3697,7 +3697,7 @@ calendar view are:
Fields can have additional attributes: Fields can have additional attributes:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`invisible` `invisible`
@ -3751,7 +3751,7 @@ The root element of the Activity view is `<activity>`, it accepts the following
attributes: attributes:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`string` (mandatory) `string` (mandatory)
@ -3761,7 +3761,7 @@ attributes:
Possible children of the view element are: Possible children of the view element are:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`field` `field`
@ -3772,7 +3772,7 @@ Possible children of the view element are:
Possible attributes are: Possible attributes are:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`name` (required) `name` (required)
@ -3791,7 +3791,7 @@ Possible children of the view element are:
(see {ref}`reference/view_architectures/kanban` for more details): (see {ref}`reference/view_architectures/kanban` for more details):
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`widget` `widget`
@ -3838,7 +3838,7 @@ The root element of the Cohort view is \<cohort>, it accepts the following
attributes: attributes:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`string` (mandatory) `string` (mandatory)
@ -3888,7 +3888,7 @@ attributes:
main use is for hiding a field from the selectable measures: main use is for hiding a field from the selectable measures:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`name` (mandatory) `name` (mandatory)
@ -3913,7 +3913,7 @@ attributes:
: alternate representations for a field's display. : alternate representations for a field's display.
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_sample.rst .. include:: view_architectures/root_attribute_sample.md
``` ```
(reference-view-architectures-grid)= (reference-view-architectures-grid)=
@ -4274,14 +4274,14 @@ take the following attributes:
Disable/enable record deletion on the view through the **Action** dropdown. Disable/enable record deletion on the view through the **Action** dropdown.
.. rst-class:: o-definition-list .. container:: o-definition-list
``date_start`` (required) ``date_start`` (required)
name of the field providing the start datetime of the event for each name of the field providing the start datetime of the event for each
``` ```
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`date_start` (required) `date_start` (required)
@ -4466,7 +4466,7 @@ take the following attributes:
<reference/qweb/javascript>` and provides the following context variables: <reference/qweb/javascript>` and provides the following context variables:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`widget` `widget`
@ -4517,7 +4517,7 @@ take the following attributes:
will display the users avatars next to their names when grouped by user_id. will display the users avatars next to their names when grouped by user_id.
```{eval-rst} ```{eval-rst}
.. include:: view_architectures/root_attribute_sample.rst .. include:: view_architectures/root_attribute_sample.md
``` ```
(reference-view-architectures-map)= (reference-view-architectures-map)=
@ -4545,7 +4545,7 @@ As soon as a valid [MapBox] token is provided in the general settings the view s
The view's root element is `<map>`. It can have the following attributes: The view's root element is `<map>`. It can have the following attributes:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`res_partner` `res_partner`
@ -4583,7 +4583,7 @@ The view's root element is `<map>`. It can have the following attributes:
The `<map>` element can contain multiple `<field>` elements. Each `<field>` element is interpreted as a line in the pin's popup. The field's attributes are the following: The `<map>` element can contain multiple `<field>` elements. Each `<field>` element is interpreted as a line in the pin's popup. The field's attributes are the following:
```{eval-rst} ```{eval-rst}
.. rst-class:: o-definition-list .. container:: o-definition-list
``` ```
`name` `name`

View File

@ -1,64 +1,55 @@
#!/bin/bash #!/bin/bash
# Enable stricter error handling
set -euo pipefail set -euo pipefail
# Check arguments
if [[ $# -ne 2 ]]; then if [[ $# -ne 2 ]]; then
echo "Usage: $0 <source_folder> <target_folder>" >&2 echo "Usage: $0 <source_folder> <target_folder>" >&2
exit 1 exit 1
fi fi
readonly SOURCE_DIR="$1" SOURCE_DIR=$(realpath "$1") # Normalize source path
readonly TARGET_DIR="$2" readonly TARGET_DIR="$2"
readonly TEMP_ERROR=$(mktemp) readonly TEMP_ERROR=$(mktemp)
readonly LOG_FILE="/tmp/convert2md_$$.log" readonly LOG_FILE="/tmp/convert2md_$$.log"
# Trap to clean up temp files on exit
trap 'rm -f "$TEMP_ERROR" "$LOG_FILE"' EXIT trap 'rm -f "$TEMP_ERROR" "$LOG_FILE"' EXIT
# Validate inputs
validate_inputs() { validate_inputs() {
[[ ! -d "$SOURCE_DIR" ]] && { [[ ! -d "$SOURCE_DIR" ]] && { echo "Error: Source directory '$SOURCE_DIR' does not exist." >&2; exit 1; }
echo "Error: Source directory '$SOURCE_DIR' does not exist." >&2 mkdir -p "$TARGET_DIR" || { echo "Error: Could not create target directory '$TARGET_DIR'." >&2; exit 1; }
exit 1 command -v rst2myst >/dev/null 2>&1 || { echo "Error: rst2myst not installed. Use 'pip install rst-to-myst'." >&2; exit 1; }
}
mkdir -p "$TARGET_DIR" || {
echo "Error: Could not create target directory '$TARGET_DIR'." >&2
exit 1
}
command -v rst2myst >/dev/null 2>&1 || {
echo "Error: rst2myst is not installed. Install with 'pip install rst-to-myst'." >&2
exit 1
}
} }
# Process RST files
process_rst_file() { process_rst_file() {
local rst_file="$1" local rst_file="$1"
local relative_path="${rst_file#$SOURCE_DIR/}" local relative_path="${rst_file#$SOURCE_DIR/}"
local md_file_name="${relative_path%.rst}.md" local md_file_name="${relative_path%.rst}.md"
local target_file="$TARGET_DIR/$md_file_name" local target_file="$TARGET_DIR/$md_file_name"
local target_dir=$(dirname "$target_file") local target_dir=$(dirname "$target_file")
mkdir -p "$target_dir" || { mkdir -p "$target_dir" || { echo "Error: Could not create '$target_dir' for '$rst_file'" >&2; return 1; }
echo "Error: Could not create directory '$target_dir' for '$rst_file'" >&2 if rst2myst stream --config config.yaml "$rst_file" > "$target_file" 2>>"$TEMP_ERROR"; then
return 1 # Replace 'rst-class' with 'container' and '.rst' with '.md' in content
} sed -i 's/rst-class/container/g; s/\.rst/.md/g' "$target_file" 2>>"$TEMP_ERROR" || {
if rst2myst stream "$rst_file" > "$target_file" 2>>"$TEMP_ERROR"; then echo "Error: Failed to modify content of '$target_file'" >&2
return 1
}
echo "Converted: $rst_file -> $target_file" | tee -a "$LOG_FILE" echo "Converted: $rst_file -> $target_file" | tee -a "$LOG_FILE"
echo "converted" >> "$TEMP_ERROR"
return 0 return 0
else else
echo "Failed to convert: $rst_file" >&2 echo "Failed to convert: $rst_file" >&2
cat "$TEMP_ERROR" >&2 cat "$TEMP_ERROR" >&2
echo "failed" >> "$TEMP_ERROR"
return 1 return 1
fi fi
} }
# Copy non-RST files
copy_non_rst_file() { copy_non_rst_file() {
local file="$1" local file="$1"
local relative_path="${file#$SOURCE_DIR/}" local relative_path="${file#$SOURCE_DIR/}"
local target_file="$TARGET_DIR/$relative_path" local target_file="$TARGET_DIR/$relative_path"
local target_dir=$(dirname "$target_file") local target_dir=$(dirname "$target_file")
mkdir -p "$target_dir" && cp -p "$file" "$target_file" 2>/dev/null && { mkdir -p "$target_dir" && cp -p "$file" "$target_file" 2>>"$TEMP_ERROR" && {
# Replace 'rst-class' with 'container' and '.rst' with '.md' in content
sed -i 's/rst-class/container/g; s/\.rst/.md/g' "$target_file" 2>>"$TEMP_ERROR" || {
echo "Error: Failed to modify content of '$target_file'" >&2
return 1
}
echo "Copied: $file -> $target_file" | tee -a "$LOG_FILE" echo "Copied: $file -> $target_file" | tee -a "$LOG_FILE"
return 0 return 0
} || { } || {
@ -71,46 +62,42 @@ main() {
validate_inputs validate_inputs
echo "Starting conversion process..." | tee "$LOG_FILE" echo "Starting conversion process..." | tee "$LOG_FILE"
# Count total RST files # Log all files found
readonly TOTAL_RST_FILES=$(find "$SOURCE_DIR" -type f -name "*.rst" | wc -l) mapfile -t RST_FILES < <(find "$SOURCE_DIR" -type f -name "*.rst" 2>>"$LOG_FILE")
echo "Found $TOTAL_RST_FILES RST files to process" | tee -a "$LOG_FILE" mapfile -t NON_RST_FILES < <(find "$SOURCE_DIR" -type f ! -name "*.rst" 2>>"$LOG_FILE")
echo "Found ${#RST_FILES[@]} RST files and ${#NON_RST_FILES[@]} non-RST files" | tee -a "$LOG_FILE"
printf '%s\n' "${RST_FILES[@]}" | sed 's/^/RST: /' >> "$LOG_FILE"
printf '%s\n' "${NON_RST_FILES[@]}" | sed 's/^/Non-RST: /' >> "$LOG_FILE"
local parallel_jobs=$(( $(nproc) / 2 )) # Use half the CPU cores to avoid overload local parallel_jobs=$(( $(nproc) / 2 ))
# Export functions for xargs
export -f process_rst_file copy_non_rst_file export -f process_rst_file copy_non_rst_file
export SOURCE_DIR TARGET_DIR TEMP_ERROR LOG_FILE export SOURCE_DIR TARGET_DIR TEMP_ERROR LOG_FILE
# Process RST files with limited parallelism # Process RST files
find "$SOURCE_DIR" -type f -name "*.rst" -print0 | xargs -0 -P "$parallel_jobs" -I {} bash -c 'process_rst_file "{}"' || { printf '%s\0' "${RST_FILES[@]}" | xargs -0 -P "$parallel_jobs" -I {} bash -c 'process_rst_file "{}"' || {
echo "Warning: Some RST processing failed. Check $LOG_FILE for details." >&2 echo "Warning: Some RST processing failed. Check $LOG_FILE." >&2
} }
# Process non-RST files with limited parallelism # Process non-RST files
find "$SOURCE_DIR" -type f ! -name "*.rst" -print0 | xargs -0 -P "$parallel_jobs" -I {} bash -c 'copy_non_rst_file "{}"' || { printf '%s\0' "${NON_RST_FILES[@]}" | xargs -0 -P "$parallel_jobs" -I {} bash -c 'copy_non_rst_file "{}"' || {
echo "Warning: Some file copies failed. Check $LOG_FILE for details." >&2 echo "Warning: Some file copies failed. Check $LOG_FILE." >&2
} }
# Count results from log
readonly SUCCESSFUL_CONVERSIONS=$(grep -c "^Converted:" "$LOG_FILE")
readonly FAILED_CONVERSIONS=$(grep -c "^Failed to convert:" "$LOG_FILE")
# Summary # Summary
echo "Conversion and copy process complete." | tee -a "$LOG_FILE" local successful=$(grep -c "^Converted:" "$LOG_FILE")
echo "Total RST files found: $TOTAL_RST_FILES" | tee -a "$LOG_FILE" local failed=$(grep -c "^Failed to convert:" "$LOG_FILE")
echo "RST files successfully converted: $SUCCESSFUL_CONVERSIONS" | tee -a "$LOG_FILE" local copied=$(grep -c "^Copied:" "$LOG_FILE")
echo "RST files failed to convert: $FAILED_CONVERSIONS" | tee -a "$LOG_FILE" echo "Conversion complete." | tee -a "$LOG_FILE"
echo "Non-RST files copied: $(grep -c "^Copied:" "$LOG_FILE")" | tee -a "$LOG_FILE" echo "RST files found: ${#RST_FILES[@]}" | tee -a "$LOG_FILE"
echo "RST files converted: $successful" | tee -a "$LOG_FILE"
echo "RST files failed: $failed" | tee -a "$LOG_FILE"
echo "Non-RST files copied: $copied" | tee -a "$LOG_FILE"
# Check if all files were processed if [[ ${#RST_FILES[@]} -ne $((successful + failed)) ]]; then
if [[ $((TOTAL_RST_FILES)) != $((SUCCESSFUL_CONVERSIONS + FAILED_CONVERSIONS)) ]]; then echo "Error: ${#RST_FILES[@]} RST files found, but only $((successful + failed)) processed!" >&2
echo "Warning: Some RST files might not have been processed!" >&2
exit 1 exit 1
fi fi
[[ $failed -gt 0 ]] && { echo "Note: $failed RST conversions failed. See $LOG_FILE." >&2; exit 1; }
[[ $FAILED_CONVERSIONS -gt 0 ]] && {
echo "Note: Some RST conversions failed. See $LOG_FILE for details." >&2
exit 1
}
} }
main "$@" main "$@"

View File

@ -111,4 +111,5 @@ boto3 ; python_version > '3.10'
paramiko ; python_version > '3.10' paramiko ; python_version > '3.10'
proxmoxer ; python_version > '3.10' proxmoxer ; python_version > '3.10'
requests ; python_version > '3.10' requests ; python_version > '3.10'
google_auth ; python_version > '3.10' google_auth ; python_version > '3.10'
esbonio