Skip to content

Commit

Permalink
Prepare SAF and CONFIGS for separation of mappings
Browse files Browse the repository at this point in the history
Signed-off-by: Rieks <RieksJ@users.noreply.github.com>
  • Loading branch information
RieksJ committed Apr 1, 2024
1 parent 21a1111 commit 11801a3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
51 changes: 42 additions & 9 deletions docs/saf.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#
# This is a Scope Administration File that can be used in conjunction with Terminology Engine v2: https://tno-terminology-design.github.io/tev2-specifications/docs/category/introduction-overview.
#
# The first section defines meta-data concerning the scope itself, both for technical use and human use.
# It shows where directories and files live that ar part of the scope, and also
# ways in which people can contribute, raise issues, see what's going on, discuss, etc.
# The first section defines meta-data concerning the scope itself. It shows,
# amongst other things, where directories and files live that ar part of the scope.
#
scope:
scopetag: tev2 # identifier that curators have determined for this terminology
Expand All @@ -16,12 +15,46 @@ scope:
navid: id # Name of the field in the front matter of a body file used by your static site generator in a URL, to uniquely identify that file (e.g., "id", "slug", "permalink"). If not specified, the filename of the body file will be used. |
license: LICENSE.md # file that contains the (default) licensing conditions. Full URL is `scopedir`/`license`
statuses: [ proposed, approved, deprecated ] # list of status tags that are defined for semantic units in this scope
issues: https://github.com/tno-terminology-design/tev2-specifications/issues # URL where issues can be raised and handled
curators: # contacting individual curators
- name: RieksJ
email: # we split up the email address to reduce the likelihood of the address being harvested for spamming
id: rieks.joosten
at: tno.nl
# The subsection of `scope` here below is not yet functional.
mappings:
formphrases:
# If one or more macros are specified here below, only they will be used by the MRGT.
# And in that case, all macros defined in the tools will be disregarded.
macros:
"{ss}": ["","s","'s","(s)"] # "act{ss}" --> "act", "acts", "act's", "act(s)"
"{ess}": ["","es","'s","(es)"] # "regex{es}" --> "regex", "regexes", "regex's", "regex(es"
"{yies}": ["y","y's","ies"] # "part{yies}" --> "party", "party's", "parties"
"{ying}": ["y","ying","ies","ied"] # "identif{ying}" --> "identify", "identifying", "identifies", "identified"
"{es}": ["e","es","ed","ing"] # "mangag{es}" --> "manage", "manages", "managed", "managing"
"{able}": ["able","ability"] # "cap{able}" --> "capable", "capability"
trrt:
# all interpreters/converters specified below are added to the set that the TRRT already has
# if an interpreter/converter is predefined, the specification below will override the predefined one.
interpreters: # note that backslashes in regexes need to be properly escaped. Also use single/double quotes with care.
default: '(?:(?<=[^`\\\\])|^)\\[(?=[^@\\n\\]]+\\]\\([^@)]*@[:a-z0-9_-]*\\))(?<showtext>[^@\\n\\]]+)\\]\\((?:(?:(?<type>[a-z0-9_-]*):)?)(?:(?<term>[^@\\n:#)]*?)?(?:#(?<trait>[^@\\n:#)]*))?)?@(?<scopetag>[a-z0-9_-]*)(?::(?<vsntag>[a-z0-9_-]*))?\\)'
alt: '(?:(?<=[^`\\\\])|^)\\[(?=[^@\\n\\]]+?@[:a-z0-9_-]*\\](?:\\([#:a-z0-9_-]+\\))?)(?<showtext>[^@\\n\\]]+?)@(?<scopetag>[a-z0-9_-]*)(?::(?<vsntag>[a-z0-9_-]*?))?\\](?:\\((?:(?:(?<type>[a-z0-9_-]+):)?)(?<term>[^@\\n:#)]*?)(?:#(?<trait>[^@\\n:#)]+?))?\\))?'
converters: # note that you do not inadvertently mix single and double quotes.
"html-with-notes":
'## [{{#if glossaryTerm}}{{noRefs glossaryTerm}}{{else}}{{capFirst term}}{{/if}}]({{localize navurl}})\n\n{{#if glossaryText}}{{glossaryText}}{{else}}no `glossaryText` was specified for this entry.{{/if}}\n\n{{#if glossaryNotes}}### Notes\n\n{{#each glossaryNotes}}- {{this}}\n{{/each}}\n{{/if}}'
"html-abbrs":
'{{#if glossaryAbbr}}## [{{glossaryAbbr}}]({{localize navurl}})\n\nSee: [{{#if glossaryTerm}}{{glossaryTerm}}{{else}}{{capFirst term}}{{/if}}]({{termid}}@)\n\n{{else}}{{log level="silent"}}{{/if}}'
"remove-termref-and-log-error":
"{{showtext}}{{log 'TRRT error converter:' err.dir '/' err.file '@' err.line ':' err.pos '[' ref.showtext ']' level='warn'}}"
# the converters here below are the same as defined in tev2-tools.
"markdown-link":
'[{{ref.showtext}}]({{entry.navurl}}{{#if ref.trait}}#{{ref.trait}}{{/if}})'
"html-link":
'<a href="{{entry.navurl}}{{#if ref.trait}}#{{ref.trait}}{{/if}}">{{ref.showtext}}</a>'
"html-hovertext-link":
'<a href="{{localize entry.navurl}}{{#if ref.trait}}#{{ref.trait}}{{/if}}" title="{{#if entry.hoverText}}{{entry.hoverText}}{{else}}{{#if entry.glossaryTerm}}{{entry.glossaryTerm}}{{else}}{{capFirst entry.term}}{{/if}}: {{noRefs entry.glossaryText type="markdown"}}{{/if}}">{{ref.showtext}}</a>'
"html-glossarytext-link":
'<a href="{{localize entry.navurl}}{{#if ref.trait}}#{{ref.trait}}{{/if}}" title="{{capFirst entry.term}}: {{noRefs entry.glossaryText type="markdown"}}">{{ref.showtext}}</a>'
hrgt:
# all interpreters/converters/sorters specified below are added to the set that the TRRT already has
# if an interpreter/converter/sorter is predefined, the specification below will override the predefined one.
interpreters: # note that backslashes in regexes need to be properly escaped.
converters:
sorters:
#
# The second section contains a mapping between scopetags that are used within the scope, and the associated scopedirs.
# This enables tools to find the SAF of these scopes, and from there all other directories, files etc.
Expand Down
11 changes: 8 additions & 3 deletions docs/terminology-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ output: . # (root) directory for output files to be written to
## Machine Readable Glossary Tool
mrgt:
vsntag: # versiontag of MRG to generate. Default: all MRGs
macros: # macros to be used for formPhrases
"{ss}": ["", "s", "'s", "(s)"]
"{yies}": ["y", "y's", "ies"]
# If one or more macros are specified here below, only they will be used by the MRGT.
# And in that case, all macros defined in the tools and/or in the SAF will be disregarded.
macros:

## Human Readable Glossary Tool
hrgt:
interpreter: default # `default` (default), or regex
# The below is to be replaced with the converters as defined in the SAF:
# converter[1]: html-with-notes
# converter[2]: html-abbrs
converter[1]: "## [{{#if glossaryTerm}}{{noRefs glossaryTerm}}{{else}}{{capFirst term}}{{/if}}]({{localize navurl}})\n\n{{#if glossaryText}}{{glossaryText}}{{else}}no `glossaryText` was specified for this entry.{{/if}}\n\n{{#if glossaryNotes}}### Notes\n\n{{#each glossaryNotes}}- {{this}}\n{{/each}}\n{{/if}}"
converter[2]: "{{#if glossaryAbbr}}## [{{glossaryAbbr}}]({{localize navurl}})\n\nSee: [{{#if glossaryTerm}}{{glossaryTerm}}{{else}}{{capFirst term}}{{/if}}]({{termid}}@)\n\n{{else}}{{log level='silent'}}{{/if}}" # add HRG-entries for abbreviations (i.e. that have a non-empty `glossaryAbbr` field)
input: # glob pattern for files to be processed
Expand All @@ -25,6 +28,8 @@ hrgt:
trrt:
interpreter: default # `default`, `alt`, or regex
converter: html-hovertext-link # `markdown-link`, `html-link`, `html-hovertext-link`, `html-glossarytext-link`, mustache/handlebars template
# The below is to be replaced with the converters as defined in the SAF:
# converter[error]: remove-termref-and-log-error
converter[error]: "{{showtext}}{{log 'TRRT error converter:' err.dir '/' err.file '@' err.line ':' err.pos '[' ref.showtext ']' level='warn'}}"
input: # glob pattern for files to be processed
- "**/*.md"

0 comments on commit 11801a3

Please sign in to comment.