-
Notifications
You must be signed in to change notification settings - Fork 7
Storybook-Theming: Evaluation of TAL-Theming #407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@zmsdev : ZMS/Products/zms/skins/storybook/schema/infobox2.json Lines 1 to 10 in cd8e3c3
|
ZMS-Schema Extraction from HTML/TAL-Design-TemplatesGoal: 'Single source of Truth'Web-design is generated with/by the content model. So, to allow the web-designer to define/maintain the design-data AND the connected model (which again creates GUI) a logical bridge is needed for transferring the HTML-implicit model into the CMS. Basic Idea: data-schema-* attributesThe idea is simple: Designer creates an HTML template (in the file system) for each content object-class as before (with storybook, figma etc.). A ZMS-compliant data schema is extracted from this HTML data using a Py shell script. Currently the result is a JSON file. Alternatives to data-attributesHTML has the following “standards” for schema definition:
JSON-LD is the most precise and separates the content model into the script tag; however, this would result in redundant data maintenance. Declaring the CMS-content-model by data-schema-* attributesAll relevant ZMS model attributes are declared by
If the content-model shall create HTML-attributes there may occur one or many of them for each HTML-element, so the naming convention for the data-attribute declaration has to be more specific:
Screenshot: Automatic schema creation from HMTL-template The Py script
|
|
@drfho Maybe we should think in terms of a Such a Python module should handle the shown extraction of Additionally it should provide these attributes (subset of allowed data types) to the existing The the well established bi-directional syncing from filesystem into ZMS and vice versa using -> IMHO the existing development and deployment workflows should remain untouched as much as possible -> Maybe the |
|
@cmeier76 Thank you very much for the inspiration. [1] fully agree not touching the well established repo-sync/deploy. The StorybookConnector might be a kind of preproessor, but does not directly interfere with repomanager. [2] Because the ZMS/Products/zms/skins/storybook/infobox.zpt Lines 26 to 35 in 995abb5
|
Creating YAML-based Schema-Data@zmsdev: as a prototype I added a function for creating the metaobj-schema as yaml-format ZMS/Products/zms/skins/storybook/create_schema.py Lines 121 to 134 in 3761f09
There might be substancial advantage of the YAML-format using the Literal Block Scalar ZMS/Products/zms/skins/storybook/schema/infobox/init.yaml Lines 51 to 56 in 3761f09
To utilize ZMS/Products/zms/repositoryutil.py Lines 67 to 75 in 60e4a67
... e.g. like this: def get_class(py):
if re.search(r'^\s*class:', py, re.M):
# YAML-style class definition
import yaml
d = yaml.safe_load(py)
return d['class']
else:
id = re.findall('class (.*?):', py)[0]
if sys.version_info >= (3, 13):
py = py + "\nglobal c\nc = " + id
exec(py, globals=globals(), locals=locals())
return eval("c", globals=globals(), locals=locals())
else:
exec(py)
return eval(id)The functions ZMS/Products/zms/repositoryutil.py Lines 100 to 104 in 60e4a67
... e.g. like this: try:
c = get_class(py)
if hasattr(c, '__dict__'):
# MappingProxyType from Python-style class definition
d = c.__dict__
else:
# Dict from YAML-style class definition
d = c
except:
d['revision'] = standard.writeError(self,"[remoteFiles.traverse]: can't analyze filepath=%s"%filepath) |
@drfho To achieve this, IMHO sync between existing There may be a helper user interface in zmi of the ZMSMetaobjManager:
|
Hint: still at work (list/dict-values)
Python-based Schema CodeRef: #407 (comment) ZMS/Products/zms/skins/storybook/create_schema.py Lines 133 to 158 in 68c4666
Result: ZMS/Products/zms/skins/storybook/schema/infobox/__init__.py Lines 1 to 65 in 68c4666
|
Hint: bidirectional sync shall be possible, task1: remove data-schema-attrs while rendering ZMS-content, task2: is yaml the better format for merging ZMS & design code status?



It is intended to create a basic set of TAL files that can be utilized in Storybook for constructing frontend designs.
Ref: https://github.com/idasm-unibe-ch/unibe-cms/issues/971