Skip to content

Commit

Permalink
configuration doc updates
Browse files Browse the repository at this point in the history
Signed-off-by: Rieks <[email protected]>
  • Loading branch information
RieksJ committed Feb 29, 2024
1 parent ce1f48b commit 5a4b88d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion docs/specs/files/90-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,15 @@ Parameters that are specific to the [hrgt](hrgt@) can be put in the YAML section
| `input: <glob-pattern>` | Y | Glob pattern string for files to be processed by the HRGT. |
| `interpreter: <regex> or <predeftype>` | n | Type of [MRGRef](@) interpreter, i.e., a [(PCRE) regex](https://www.debuggex.com/cheatsheet/regex/pcre), or a [predefined type](mrg-ref#predefined-mrgref-interpreters@) (`default`). |
| `converter: <template> or <predeftype>` | n | Type of [MRGRef](@) converter, i.e., a mustache/[handlebars](https://handlebarsjs.com/guide/#what-is-handlebars) template, or a [predefined type](hrgt#predefined-converters@) ( `markdown-table-row`, `markdown-section-2`, `markdown-section-3`). |
| `sorter: <template> or <predeftype>` | n | Value to use for sorting, i.e., a mustache/[handlebars](https://handlebarsjs.com/guide/#what-is-handlebars) template, or a [predefined type](hrgt#predefined-sorters@) ( `default`). |
| `converter[<n>]: <template> or <predeftype>` | n | Type of [MRGRef](@) converter, i.e., a mustache/[handlebars](https://handlebarsjs.com/guide/#what-is-handlebars) template, or a [predefined type](hrgt#predefined-converters@) ( `markdown-table-row`, `markdown-section-2`, `markdown-section-3`). |
| `converter[error]: <template> or <predeftype>` | n | Specifies the [converter](@) to be used to replace the [MRGRef](@) with in case the associated [MRG](@) file could not be found. |
| `sorter: <template> or <predeftype>` | n | Value to use for sorting, i.e., a mustache/[handlebars](https://handlebarsjs.com/guide/#what-is-handlebars) template, or a [predefined type](hrgt#predefined-sorters@) ( `default`). |
| `force: <bool>` | n | If `<bool>` is `true`, allow files in the output directory to be overwritten. If `<bool>` is `false` or unspecified, output files will not overwrite existing files. |

Multiple [converters](@) can be specified, as `converter[1]`, `converter[2]`, etc.
All [converters](@) that are specified will be executed for every [MRG entry](@)
in the [MRG](@) for which the [HRG](@) is created.

The `<action>` parameter can take the following values.

| `<action>` | Description |
Expand Down
10 changes: 9 additions & 1 deletion docs/specs/tools/22-hrgt.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ If a [configuration file](/docs/specs/files/configuration-file) used, the long v
| `-s`, `--scopedir <path>` | Y | Path of the scope directory where the SAF is located. |
| `-int`, `--interpreter <type> or <regex>` | n | Specifies the [interpreter](@) to be used to detect [MRGRefs](@). This can either be a predefined interpreter, or a [regex](@). |
| `-con[n]`, `--converter[n] <type> or <hexpr>`[^1] | n | Specifies the [converter](@) to be used to produce [HRG lists](@). This can either be a predefined converter, or a [handlebars expression](https://handlebarsjs.com/guide/#what-is-handlebars). See [HRGT Converters](#hrgt-converters) for details. |
| `-con[error]`, `--converter[error] <type> or <hexpr>` | n | Specifies the [converter](@) to be used to a [HRG list](@) entry in case of an error. This can either be a predefined converter, or a [handlebars expression](https://handlebarsjs.com/guide/#what-is-handlebars). See [HRGT Converters](#hrgt-converters) for details. |
| `-con[error]`, `--converter[error] <type> or <hexpr>` | n | Specifies the [converter](@) to be used to replace the [MRGRef](@) with in case the associated [MRG](@) file could not be found. |
| `-sort`, `--sort <type> or <hexpr>` | n | Specifies the value to be used to sort [HRG lists](@). This can either be a predefined value, or a [handlebars expression](https://handlebarsjs.com/guide/#what-is-handlebars). |
| `-f`, `--force` | n | Allow overwriting of existing files. |
| `-h`, `--help` | n | display help for command. |
Expand Down Expand Up @@ -147,6 +147,12 @@ where:
- `converter` (optional) specifies the [converter](@) to be used to produce the [HRG list](@). This can either be a predefined [converter](@), or a [handlebars expression](https://handlebarsjs.com/guide/#what-is-handlebars). See [HRG Converters](#hrgt-converters) for details.
- `sorter` (optional) specifies the [sorter](@) to be used for sorting the [HRG list](@). This can either be a predefined [sorter](@), or a [handlebars expression](https://handlebarsjs.com/guide/#what-is-handlebars). See [HRG Sorters](#predefined-sorters) for details.

:::warning
If you specify a converter as part of this syntax, that's the only one that will be used.<br/>
There is currently no provision for having multiple converters in this syntax<br/>
If you want multiple converters, you MUST use the commandline or a configuration file.
:::

For completeness, here is the [regex] that defines the `default` [interpreter](@) for the [HRGT](@).

~~~ regex
Expand All @@ -159,6 +165,8 @@ The purpose of the [HRGT](@) is to allow source texts to contain [MRGRefs](@) th

To do that, the [HRGT](@) uses the [interpreter](@) to locate subsequent [MRGRefs](@) in its input files, and for each of them, processes the [named capturing groups](@) that the [interpreter](@) populates. From this, it will attempt to find the [MRG](@) for which a corresponding [HRG](@) is to be generated. When found, it will walk through the [MRG entries](@) in that [MRG](@), and for each of them, populate [moustache variables](@) as specified in the [HRGT](@) [converter profile](@), and use the specified [converter](@) to produce the [HRG entries](@) that will be populating the [hrg-list](@). These [HRG entries](@) will be sorted according to the [sorter](@) that is specified.

Note that when the [HRGT](@) is provided with multiple [converters](@) (which is currently only available through the command-line or a [configuration file](/docs/specs/files/configuration-file))

#### Finding the [MRG](@) associated with an [MRGRef](@)

The [MRG](@) file associated with an [MRGRef](@) is found by resolving the [terminology identifier](@) that is specified in the [named capturing group](@) `hrg`, which leads to a valid [scopetag](@) and [versiontag](@).
Expand Down

0 comments on commit 5a4b88d

Please sign in to comment.