From 435cbb61bad65bcef7fa13d47d5b5789e7106846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Fri, 24 Jun 2022 14:06:39 +0200 Subject: [PATCH] Add zone definitions into the view grammar I cannot see a reasonable way to achieve this without the hack in this commit. --- doc/arm/_ext/iscconf.py | 4 ++-- doc/arm/_ext/mergegrammar.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/arm/_ext/iscconf.py b/doc/arm/_ext/iscconf.py index c4252c4202..022d303de0 100644 --- a/doc/arm/_ext/iscconf.py +++ b/doc/arm/_ext/iscconf.py @@ -133,14 +133,14 @@ def domain_factory(domainname, domainlabel, todolist, grammar): return ".".join(path[1:]) def format_paths(self, paths): - zone_types = [] + zone_types = set() nozone_paths = [] for path in paths: try: zone_idx = path.index("zone") zone_type_txt = path[zone_idx + 1] assert zone_type_txt.startswith("type "), zone_type_txt - zone_types.append(zone_type_txt[len("type ") :]) + zone_types.add(zone_type_txt[len("type ") :]) except (ValueError, IndexError): nozone_paths.append(path) condensed_paths = nozone_paths[:] diff --git a/doc/arm/_ext/mergegrammar.py b/doc/arm/_ext/mergegrammar.py index d339da1645..75146f7dc4 100644 --- a/doc/arm/_ext/mergegrammar.py +++ b/doc/arm/_ext/mergegrammar.py @@ -46,6 +46,10 @@ def combine(): assert rest rest.update(zones) + # this is a terrible hack + # but cfg_test cannot print zone grammars inside view + rest["view"]["_mapbody"].update(zones) + return rest