Skip to content

Commit

Permalink
hxltmcli (#24): --meta-archivum
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Oct 19, 2021
1 parent 45cbf2a commit 50b21f9
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
30 changes: 27 additions & 3 deletions bin/hxltmcli
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,11 @@ class HXLTMCLI: # pylint: disable=too-many-instance-attributes
)

parser.add_argument(
'--meta',
'--meta-archivum',
help='(Draft, not fully implemented) ' +
'Optional YAML metadata for advanced processing operations.',
# dest='fontem_linguam',
metavar='meta',
metavar='meta_archivum',
action='store',
# default='lat-Latn',
nargs='?'
Expand Down Expand Up @@ -1563,6 +1563,8 @@ class HXLTMArgumentum: # pylint: disable=too-many-instance-attributes
Argūmentum dēfīnītiōnem ad Vēnandum īnsectum
[lat-Latn]_
"""
meta_archivum: InitVar[str] = None
tmeta: InitVar[dict] = None
agendum_linguam: InitVar[List[Type['HXLTMLinguam']]] = []
auxilium_linguam: InitVar[List[Type['HXLTMLinguam']]] = []
fontem_linguam: InitVar[Type['HXLTMLinguam']] = None
Expand Down Expand Up @@ -1627,8 +1629,19 @@ class HXLTMArgumentum: # pylint: disable=too-many-instance-attributes
args_rem.objectivum_normam:
self.objectivum_normam = args_rem.objectivum_normam

if hasattr(args_rem, 'meta_archivum') and \
args_rem.meta_archivum:
# TODO: make a bit more structured this file load

file_ = open(args_rem.meta_archivum, mode='r')
# self.objectivum_formulam_crudum = file_.read()
self.tmeta = yaml.safe_load(file_)
file_.close()

if hasattr(args_rem, 'objectivum_formulam') and \
args_rem.objectivum_formulam:
# TODO: make a bit more structured this file load

# self.objectivum_formulam_archivum = \
# args_rem.objectivum_formulam
# Open a file: file
Expand Down Expand Up @@ -4503,9 +4516,20 @@ Salvi, {{ i }}! \
"""
globum = self.hxltm_asa.quod_globum_valorem()
summam = {}
argumentum = self.hxltm_asa.argumentum.v()
summam_tmeta = {}
summam_tmeta = {}

# print(globum.keys())

if hasattr(self.hxltm_asa.argumentum, 'tmeta') and \
self.hxltm_asa.argumentum.tmeta:
summam_tmeta['tmeta'] = self.hxltm_asa.argumentum.tmeta

# summam_tmeta = {
# 'argumentum': self.hxltm_asa.argumentum.v()
# }

if 'normam' in globum:
basim = self.ONTOLOGIA_NORMAM
ext = self.ontologia_normam_speciale
Expand All @@ -4532,7 +4556,7 @@ Salvi, {{ i }}! \
)
)

globum = {**globum, **summam}
globum = {**globum, **summam, **summam_tmeta, **argumentum}

return globum

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"__tmeta__": "{{ 'aaaa' }}",
"argumentum": {{ argumentum }},
"globum": {{ globum }},
"tmeta": {{ tmeta }},
}
11 changes: 11 additions & 0 deletions testum/hxltm/hxltm-exemplum-linguam.tmeta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# hxltm-exemplum-linguam.tmeta.yml
# HXLTM Datum: hxltm-exemplum-linguam.tm.hxl.csv

tmeta:
# _[eng-Latn]
# Global Vars for templating. This will add tho the ones from
# cor.hxltm.yml:normam:YourDataConventionHere
# [eng-Latn]_
globum:
tbx:
titulum: TBX-Basic Sample File
4 changes: 4 additions & 0 deletions testum/hxltm/manuale-testum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,8 @@ hxltmcli schemam-un-htcds.tm.hxl.csv --objectivum-formulam formulam/exemplum-lin
# To revert only one file that keeps changing even with same input
# git checkout -- testum/hxltm/resultatum/hxltm-exemplum-linguam.tmx

# hxltmcli hxltm-exemplum-linguam.tm.hxl.csv --meta-archivum hxltm-exemplum-linguam.tmeta.yml
# hxltmcli hxltm-exemplum-linguam.tm.hxl.csv --meta-archivum hxltm-exemplum-linguam.tmeta.yml --objectivum-formulam formulam/exemplum-linguam.🗣️.json
# hxltmcli hxltm-exemplum-linguam.tm.hxl.csv --meta-archivum hxltm-exemplum-linguam.tmeta.yml --objectivum-formulam formulam/exemplum-linguam-tmeta-testum.🗣️.json

exit 0

0 comments on commit 50b21f9

Please sign in to comment.