]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
ari-stubs: Fix broken documentation anchors
authorGeorge Joseph <gjoseph@sangoma.com>
Tue, 5 Sep 2023 15:51:19 +0000 (09:51 -0600)
committerGeorge Joseph <gjoseph@sangoma.com>
Tue, 5 Sep 2023 15:55:52 +0000 (09:55 -0600)
All of the links that reference page anchors with capital letters in
the ids (#Something) have been changed to lower case to match the
anchors that are generated by mkdocs.

rest-api-templates/api.wiki.mustache
rest-api-templates/make_ari_stubs.py
rest-api-templates/models.wiki.mustache
rest-api-templates/swagger_model.py

index 343aa11b5c4951ebec08204b3636032f7c649ca5..ba96d99ad2cc888ddb416a48dcfdf692768c38cf 100644 (file)
@@ -5,7 +5,7 @@
 |:------ |:------------------------------------ |:------------ |:------- |
 {{#apis}}
 {{#operations}}
-| {{http_method}} | [{{wiki_path}}](#{{nickname}}) | {{#response_class}}{{#is_primitive}}{{name}}{{/is_primitive}}{{^is_primitive}}[{{wiki_name}}]({{wiki_prefix}}_Asterisk_REST_Data_Models#{{lc_singular_name}}){{/is_primitive}}{{/response_class}} | {{{summary}}} |
+| {{http_method}} | [{{wiki_path}}](#{{nickname}}) | {{#response_class}}{{#is_primitive}}{{name}}{{/is_primitive}}{{^is_primitive}}[{{wiki_name}}]({{wiki_prefix}}Asterisk_REST_Data_Models#{{lc_singular_name}}){{/is_primitive}}{{/response_class}} | {{{summary}}} |
 {{/operations}}
 {{/apis}}
 {{#apis}}
index a6c6a2452749de6b76c39b2b89a82b01dd46d864..644f81904194c70d1faca7df322e45bf2e4072ef 100755 (executable)
@@ -77,7 +77,7 @@ def main(argv):
 
     RESOURCES_TRANSFORMS = [
         Transform(rel('models.wiki.mustache'),
-                  '%s/_Asterisk_REST_Data_Models.md' % args.dest_dir),
+                  '%s/Asterisk_REST_Data_Models.md' % args.dest_dir),
         Transform(rel('ari.make.mustache'), 'res/ari.make'),
         Transform(rel('ari_model_validators.h.mustache'),
                   'res/ari/ari_model_validators.h'),
index fe70f08595b1b87015f442712904196d11c2f604..336b432f11d96bc0e13c93bd60d0ee2028973d3c 100644 (file)
@@ -6,8 +6,8 @@ title: Asterisk REST Data Models
 {{#api_declaration}}
 {{#models}}
 ## {{id}}
-{{#extends}}Base type: [{{extends}}](#{{extends}}){{/extends}}
-{{#has_subtypes}}Subtypes:{{#all_subtypes}} [{{id}}](#{{id}}){{/all_subtypes}}{{/has_subtypes}}
+{{#extends}}Base type: [{{extends}}](#{{extends_lc}}){{/extends}}
+{{#has_subtypes}}Subtypes:{{#all_subtypes}} [{{id}}](#{{id_lc}}){{/all_subtypes}}{{/has_subtypes}}
 ### Model
 ``` javascript title="{{id}}" linenums="1"
 {{{model_json}}}
index 57bce0cbfa15ac24769120d6de78a306e035de76..680be7fe300db4e8ccf8c583efb6ab1f31ddfde6 100644 (file)
@@ -501,6 +501,7 @@ class Model(Stringify):
 
     def __init__(self):
         self.id = None
+        self.id_lc = None
         self.subtypes = []
         self.__subtype_types = []
         self.notes = None
@@ -514,6 +515,7 @@ class Model(Stringify):
         validate_required_fields(model_json, self.required_fields, context)
         # The duplication of the model's id is required by the Swagger spec.
         self.id = model_json.get('id')
+        self.id_lc = self.id.lower() 
         if id != self.id:
             raise SwaggerError("Model id doesn't match name", context)
         self.subtypes = model_json.get('subTypes') or []
@@ -551,6 +553,9 @@ class Model(Stringify):
     def extends(self):
         return self.__extends_type and self.__extends_type.id
 
+    def extends_lc(self):
+        return self.__extends_type and self.__extends_type.id_lc
+
     def set_extends_type(self, extends_type):
         self.__extends_type = extends_type