ldoc.ltp 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. > local iter = ldoc.modules.iter
  2. > local display_name = ldoc.display_name
  3. > local function trim_newline(s)
  4. > return (s:gsub("\n", "\r"))
  5. > end
  6. ---
  7. title: APISIX Plugin Development Docs
  8. ---
  9. <!--
  10. #
  11. # Licensed to the Apache Software Foundation (ASF) under one or more
  12. # contributor license agreements. See the NOTICE file distributed with
  13. # this work for additional information regarding copyright ownership.
  14. # The ASF licenses this file to You under the Apache License, Version 2.0
  15. # (the "License"); you may not use this file except in compliance with
  16. # the License. You may obtain a copy of the License at
  17. #
  18. # http://www.apache.org/licenses/LICENSE-2.0
  19. #
  20. # Unless required by applicable law or agreed to in writing, software
  21. # distributed under the License is distributed on an "AS IS" BASIS,
  22. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. # See the License for the specific language governing permissions and
  24. # limitations under the License.
  25. #
  26. -->
  27. ## $(ldoc.title)
  28. ### $(module.name)
  29. $(module.summary) $(module.description)
  30. >
  31. > for kind, items in module.kinds() do
  32. > for item in items() do
  33. #### $(trim_newline(display_name(item)))
  34. > if item.type == "function" then
  35. > if item.summary and item.summary ~= '' then
  36. **Summary**: $(item.summary)
  37. > end -- if item.summary
  38. > if item.description and item.description ~= '' then
  39. **Description**:
  40. ```text$(trim_newline(item.description))
  41. ```
  42. > end -- if item.description
  43. > end -- if item.type
  44. > if item.params and #item.params > 0 then
  45. > local subnames = module.kinds:type_of(item).subnames
  46. > if subnames then
  47. **$(subnames)**
  48. > end -- if subnames
  49. > -- print the parameters
  50. > for par in iter(item.params) do
  51. > local param = item:subparam(par)
  52. > for p in iter(param) do
  53. > local name = item:display_name_of(p)
  54. > local tp = item:type_of_param(p)
  55. * **$(name)**($(tp)):$(item.params.map[p])
  56. > if tp ~= '' then
  57. > end -- if tp
  58. >
  59. > end -- for p
  60. > end -- for par
  61. > end -- if item.params and #item.params > 0
  62. >
  63. > -- print the returns
  64. > if item.retgroups then
  65. > local groups = item.retgroups
  66. **Returns:**
  67. > for i, group in ldoc.ipairs(groups) do
  68. > for r in group:iter() do
  69. > local type, ctypes = item:return_type(r);
  70. * `$(type)`: $(r.text)
  71. > end -- for r in group:iter()
  72. > end -- for i,group
  73. > end -- if item.retgroups
  74. > if item.usage then
  75. **Usage**
  76. > for usage in item.usage:iter() do
  77. ```lua
  78. $(trim_newline(usage))
  79. ```
  80. > end -- for usage in item.usage:iter()
  81. > local usage = item.usage
  82. > end -- if item.usage
  83. > end -- end for item in items()
  84. > end -- for kinds, items