diff --git a/README.rst b/README.rst index 82772483..ac2b1b36 100644 --- a/README.rst +++ b/README.rst @@ -28,8 +28,6 @@ Structure of this repository - ``scripts``: scripts to generate formatted versions of the documentation, typically HTML. - ``specification``: the specification split up into sections. -- ``templating``: the templates and templating system used to - generate the spec. .. _OpenAPI: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md .. _JSON Schema: http://json-schema.org/ diff --git a/scripts/continuserv/main.go b/scripts/continuserv/main.go index e077bde5..a6117714 100644 --- a/scripts/continuserv/main.go +++ b/scripts/continuserv/main.go @@ -52,7 +52,7 @@ func main() { walker := makeWalker(dir, w) paths := []string{"api", "changelogs", "event-schemas", "scripts", - "specification", "templating"} + "specification"} for _, p := range paths { filepath.Walk(path.Join(dir, p), walker) diff --git a/scripts/dump-swagger.py b/scripts/dump-swagger.py index bab13d89..110c4446 100755 --- a/scripts/dump-swagger.py +++ b/scripts/dump-swagger.py @@ -30,7 +30,7 @@ import yaml scripts_dir = os.path.dirname(os.path.abspath(__file__)) -templating_dir = os.path.join(os.path.dirname(scripts_dir), "templating") +templating_dir = os.path.join(scripts_dir, "templating") api_dir = os.path.join(os.path.dirname(scripts_dir), "api") sys.path.insert(0, templating_dir) diff --git a/scripts/gendoc.py b/scripts/gendoc.py index 05d7908e..857f0298 100755 --- a/scripts/gendoc.py +++ b/scripts/gendoc.py @@ -273,7 +273,7 @@ def addAnchors(path): def run_through_template(input_files, set_verbose, substitutions): args = [ - 'python', 'build.py', + 'python', script_dir+'/templating/build.py', "-o", tmp_dir, "-i", "matrix_templates", ] @@ -288,10 +288,7 @@ def run_through_template(input_files, set_verbose, substitutions): log("EXEC: %s" % " ".join(args)) log(" ==== build.py output ==== ") - subprocess.check_call( - args, - cwd=os.path.join(docs_dir, "templating"), - ) + subprocess.check_call(args) """ Extract and resolve groups for the given target in the given targets listing. diff --git a/templating/README.md b/scripts/templating/README.md similarity index 100% rename from templating/README.md rename to scripts/templating/README.md diff --git a/templating/batesian/__init__.py b/scripts/templating/batesian/__init__.py similarity index 100% rename from templating/batesian/__init__.py rename to scripts/templating/batesian/__init__.py diff --git a/templating/batesian/sections.py b/scripts/templating/batesian/sections.py similarity index 100% rename from templating/batesian/sections.py rename to scripts/templating/batesian/sections.py diff --git a/templating/batesian/units.py b/scripts/templating/batesian/units.py similarity index 100% rename from templating/batesian/units.py rename to scripts/templating/batesian/units.py diff --git a/templating/build.py b/scripts/templating/build.py similarity index 100% rename from templating/build.py rename to scripts/templating/build.py diff --git a/templating/matrix_templates/__init__.py b/scripts/templating/matrix_templates/__init__.py similarity index 100% rename from templating/matrix_templates/__init__.py rename to scripts/templating/matrix_templates/__init__.py diff --git a/templating/matrix_templates/sections.py b/scripts/templating/matrix_templates/sections.py similarity index 100% rename from templating/matrix_templates/sections.py rename to scripts/templating/matrix_templates/sections.py diff --git a/templating/matrix_templates/templates/apis.tmpl b/scripts/templating/matrix_templates/templates/apis.tmpl similarity index 100% rename from templating/matrix_templates/templates/apis.tmpl rename to scripts/templating/matrix_templates/templates/apis.tmpl diff --git a/templating/matrix_templates/templates/common-event-fields.tmpl b/scripts/templating/matrix_templates/templates/common-event-fields.tmpl similarity index 100% rename from templating/matrix_templates/templates/common-event-fields.tmpl rename to scripts/templating/matrix_templates/templates/common-event-fields.tmpl diff --git a/templating/matrix_templates/templates/events.tmpl b/scripts/templating/matrix_templates/templates/events.tmpl similarity index 100% rename from templating/matrix_templates/templates/events.tmpl rename to scripts/templating/matrix_templates/templates/events.tmpl diff --git a/templating/matrix_templates/templates/http-api.tmpl b/scripts/templating/matrix_templates/templates/http-api.tmpl similarity index 100% rename from templating/matrix_templates/templates/http-api.tmpl rename to scripts/templating/matrix_templates/templates/http-api.tmpl diff --git a/templating/matrix_templates/templates/msgtypes.tmpl b/scripts/templating/matrix_templates/templates/msgtypes.tmpl similarity index 100% rename from templating/matrix_templates/templates/msgtypes.tmpl rename to scripts/templating/matrix_templates/templates/msgtypes.tmpl diff --git a/templating/matrix_templates/templates/tables.tmpl b/scripts/templating/matrix_templates/templates/tables.tmpl similarity index 100% rename from templating/matrix_templates/templates/tables.tmpl rename to scripts/templating/matrix_templates/templates/tables.tmpl diff --git a/templating/matrix_templates/units.py b/scripts/templating/matrix_templates/units.py similarity index 97% rename from templating/matrix_templates/units.py rename to scripts/templating/matrix_templates/units.py index dfcb6c82..6eb58096 100644 --- a/templating/matrix_templates/units.py +++ b/scripts/templating/matrix_templates/units.py @@ -25,23 +25,27 @@ from collections import OrderedDict import logging import json import os +import os.path import re import subprocess import sys import urllib import yaml +matrix_doc_dir=reduce(lambda acc,_: os.path.dirname(acc), + range(1, 5), os.path.abspath(__file__)) + HTTP_APIS = { - "../api/application-service": "as", - "../api/client-server": "cs", - "../api/identity": "is", - "../api/push-gateway": "push", + os.path.join(matrix_doc_dir, "api/application-service"): "as", + os.path.join(matrix_doc_dir, "api/client-server"): "cs", + os.path.join(matrix_doc_dir, "api/identity"): "is", + os.path.join(matrix_doc_dir, "api/push-gateway"): "push", } -EVENT_EXAMPLES = "../event-schemas/examples" -EVENT_SCHEMA = "../event-schemas/schema" -CORE_EVENT_SCHEMA = "../event-schemas/schema/core-event-schema" -CHANGELOG_DIR = "../changelogs" -TARGETS = "../specification/targets.yaml" +EVENT_EXAMPLES = os.path.join(matrix_doc_dir, "event-schemas/examples") +EVENT_SCHEMA = os.path.join(matrix_doc_dir, "event-schemas/schema") +CORE_EVENT_SCHEMA = os.path.join(matrix_doc_dir, "event-schemas/schema/core-event-schema") +CHANGELOG_DIR = os.path.join(matrix_doc_dir, "changelogs") +TARGETS = os.path.join(matrix_doc_dir, "specification/targets.yaml") ROOM_EVENT = "core-event-schema/room_event.yaml" STATE_EVENT = "core-event-schema/state_event.yaml"