Open lauwers opened 4 months ago
I suggest that this could be resolved as follows:
‘‘‘yaml metadata: creation_date: 2024-04-14 date_updated: 2024-05-01 status: developmental
<!— SNIPPET_END --> `
Create a folder in the existing repo containing full, valid TOSCA documents. Bracket snippets with a matching start tag and an end tag using YAML comments e.g. ‘ tosca_definitions_version: tosca_2_0 # SNIPPET_BEGIN:TagOne metadata: creation_date: 2024-04-14 date_updated: 2024-05-01 status: developmental # SNIPPET_END‘
Create a tool which, at minimum, copies the specification file except where snippets are encoutered, in those blocks subsitute the TOSCA text enclosed by the matching tag found by a search of YAML files in the new folder (taking account of the language marker string in the HTML and the differences in format of the snippet markers. Diff could then be used to compare the temp file with the specification and patch or ed used to change the spec where it contains snippets which do not match the valid TOSCA.
This assumes snippets tags are unique, not nested and always closed. Tool enhancements could be added to check those assumptions.
Discussion: Have a common tool to handle this. Regarding Python: Jinja Syntax could be something (https://jinja.palletsprojects.com/en/3.1.x/templates/). And then create a function includeToscaSnippet(id)
.
'Have a common tool to handle this.' Yes I envision the tool also being maintained in this tosca-spec repo
'Jinja Syntax could be something (https://jinja.palletsprojects.com/en/3.1.x/templates/). ' Jinja would indeed be a standard way to markup the specification so a good thought. As far as I can think so far we would still need a custom tool to parse the TOSCA examples and create a file of value assignments which could be used by the jinja renderer.
I am currently enclosing examples in the spec with tags like this:
<!-- EDITOR_TAG{"type":"example","id":"s1","action":"start"} -->
<!-- EDITOR_TAG{"type":"example","id":"s1","action":"end"} -->
There are more than 150 of them, so too many to name individually. I will initally give the files in the examples directory names like s1,s1.. before attempting to consolidate them into fewer files.
You say "tags like this". I don't see any tags in your comment.
You say "tags like this". I don't see any tags in your comment.
Do you have edit rights? Most probably backticks were forgotten around the tags. It might be that when you edit the comment, you can insert them 😅.
Thanks. I corrected it.
Rather than using TOSCA code snippets in the examples, a recommendation was made to use complete TOSCA code that can be validated by a TOSCA parser.