@xpack/doxygen2docusaurus 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/bin/doxygen2docusaurus.js +45 -0
  4. package/dist/cli/main.d.ts +10 -0
  5. package/dist/cli/main.d.ts.map +1 -0
  6. package/dist/cli/main.js +66 -0
  7. package/dist/cli/main.js.map +1 -0
  8. package/dist/docusaurus/cli-options.d.ts +98 -0
  9. package/dist/docusaurus/cli-options.d.ts.map +1 -0
  10. package/dist/docusaurus/cli-options.js +212 -0
  11. package/dist/docusaurus/cli-options.js.map +1 -0
  12. package/dist/docusaurus/generator.d.ts +22 -0
  13. package/dist/docusaurus/generator.d.ts.map +1 -0
  14. package/dist/docusaurus/generator.js +461 -0
  15. package/dist/docusaurus/generator.js.map +1 -0
  16. package/dist/docusaurus/renderers/descriptiontype.d.ts +63 -0
  17. package/dist/docusaurus/renderers/descriptiontype.d.ts.map +1 -0
  18. package/dist/docusaurus/renderers/descriptiontype.js +674 -0
  19. package/dist/docusaurus/renderers/descriptiontype.js.map +1 -0
  20. package/dist/docusaurus/renderers/docinternalstype.d.ts +21 -0
  21. package/dist/docusaurus/renderers/docinternalstype.d.ts.map +1 -0
  22. package/dist/docusaurus/renderers/docinternalstype.js +159 -0
  23. package/dist/docusaurus/renderers/docinternalstype.js.map +1 -0
  24. package/dist/docusaurus/renderers/doclisttype.d.ts +6 -0
  25. package/dist/docusaurus/renderers/doclisttype.d.ts.map +1 -0
  26. package/dist/docusaurus/renderers/doclisttype.js +86 -0
  27. package/dist/docusaurus/renderers/doclisttype.js.map +1 -0
  28. package/dist/docusaurus/renderers/doctabletype.d.ts +15 -0
  29. package/dist/docusaurus/renderers/doctabletype.d.ts.map +1 -0
  30. package/dist/docusaurus/renderers/doctabletype.js +98 -0
  31. package/dist/docusaurus/renderers/doctabletype.js.map +1 -0
  32. package/dist/docusaurus/renderers/doctitletype.d.ts +6 -0
  33. package/dist/docusaurus/renderers/doctitletype.d.ts.map +1 -0
  34. package/dist/docusaurus/renderers/doctitletype.js +38 -0
  35. package/dist/docusaurus/renderers/doctitletype.js.map +1 -0
  36. package/dist/docusaurus/renderers/docvariablelisttype.d.ts +9 -0
  37. package/dist/docusaurus/renderers/docvariablelisttype.d.ts.map +1 -0
  38. package/dist/docusaurus/renderers/docvariablelisttype.js +57 -0
  39. package/dist/docusaurus/renderers/docvariablelisttype.js.map +1 -0
  40. package/dist/docusaurus/renderers/docxrefsecttype.d.ts +6 -0
  41. package/dist/docusaurus/renderers/docxrefsecttype.d.ts.map +1 -0
  42. package/dist/docusaurus/renderers/docxrefsecttype.js +44 -0
  43. package/dist/docusaurus/renderers/docxrefsecttype.js.map +1 -0
  44. package/dist/docusaurus/renderers/element-renderer-base.d.ts +12 -0
  45. package/dist/docusaurus/renderers/element-renderer-base.d.ts.map +1 -0
  46. package/dist/docusaurus/renderers/element-renderer-base.js +25 -0
  47. package/dist/docusaurus/renderers/element-renderer-base.js.map +1 -0
  48. package/dist/docusaurus/renderers/inctype.d.ts +6 -0
  49. package/dist/docusaurus/renderers/inctype.d.ts.map +1 -0
  50. package/dist/docusaurus/renderers/inctype.js +42 -0
  51. package/dist/docusaurus/renderers/inctype.js.map +1 -0
  52. package/dist/docusaurus/renderers/linkedtexttype.d.ts +6 -0
  53. package/dist/docusaurus/renderers/linkedtexttype.d.ts.map +1 -0
  54. package/dist/docusaurus/renderers/linkedtexttype.js +32 -0
  55. package/dist/docusaurus/renderers/linkedtexttype.js.map +1 -0
  56. package/dist/docusaurus/renderers/listingtype.d.ts +10 -0
  57. package/dist/docusaurus/renderers/listingtype.d.ts.map +1 -0
  58. package/dist/docusaurus/renderers/listingtype.js +121 -0
  59. package/dist/docusaurus/renderers/listingtype.js.map +1 -0
  60. package/dist/docusaurus/renderers/paramtype.d.ts +6 -0
  61. package/dist/docusaurus/renderers/paramtype.d.ts.map +1 -0
  62. package/dist/docusaurus/renderers/paramtype.js +63 -0
  63. package/dist/docusaurus/renderers/paramtype.js.map +1 -0
  64. package/dist/docusaurus/renderers/referencetype.d.ts +6 -0
  65. package/dist/docusaurus/renderers/referencetype.d.ts.map +1 -0
  66. package/dist/docusaurus/renderers/referencetype.js +42 -0
  67. package/dist/docusaurus/renderers/referencetype.js.map +1 -0
  68. package/dist/docusaurus/renderers/reftexttype.d.ts +6 -0
  69. package/dist/docusaurus/renderers/reftexttype.d.ts.map +1 -0
  70. package/dist/docusaurus/renderers/reftexttype.js +41 -0
  71. package/dist/docusaurus/renderers/reftexttype.js.map +1 -0
  72. package/dist/docusaurus/renderers/reftype.d.ts +6 -0
  73. package/dist/docusaurus/renderers/reftype.d.ts.map +1 -0
  74. package/dist/docusaurus/renderers/reftype.js +38 -0
  75. package/dist/docusaurus/renderers/reftype.js.map +1 -0
  76. package/dist/docusaurus/renderers/renderers.d.ts +33 -0
  77. package/dist/docusaurus/renderers/renderers.d.ts.map +1 -0
  78. package/dist/docusaurus/renderers/renderers.js +303 -0
  79. package/dist/docusaurus/renderers/renderers.js.map +1 -0
  80. package/dist/docusaurus/renderers/substringtype.d.ts +6 -0
  81. package/dist/docusaurus/renderers/substringtype.d.ts.map +1 -0
  82. package/dist/docusaurus/renderers/substringtype.js +24 -0
  83. package/dist/docusaurus/renderers/substringtype.js.map +1 -0
  84. package/dist/docusaurus/renderers/tableofcontentstype.d.ts +6 -0
  85. package/dist/docusaurus/renderers/tableofcontentstype.d.ts.map +1 -0
  86. package/dist/docusaurus/renderers/tableofcontentstype.js +41 -0
  87. package/dist/docusaurus/renderers/tableofcontentstype.js.map +1 -0
  88. package/dist/docusaurus/types.d.ts +53 -0
  89. package/dist/docusaurus/types.d.ts.map +1 -0
  90. package/dist/docusaurus/types.js +13 -0
  91. package/dist/docusaurus/types.js.map +1 -0
  92. package/dist/docusaurus/utils.d.ts +16 -0
  93. package/dist/docusaurus/utils.d.ts.map +1 -0
  94. package/dist/docusaurus/utils.js +169 -0
  95. package/dist/docusaurus/utils.js.map +1 -0
  96. package/dist/docusaurus/view-model/classes-vm.d.ts +35 -0
  97. package/dist/docusaurus/view-model/classes-vm.d.ts.map +1 -0
  98. package/dist/docusaurus/view-model/classes-vm.js +707 -0
  99. package/dist/docusaurus/view-model/classes-vm.js.map +1 -0
  100. package/dist/docusaurus/view-model/collection-base.d.ts +28 -0
  101. package/dist/docusaurus/view-model/collection-base.d.ts.map +1 -0
  102. package/dist/docusaurus/view-model/collection-base.js +155 -0
  103. package/dist/docusaurus/view-model/collection-base.js.map +1 -0
  104. package/dist/docusaurus/view-model/compound-base-vm.d.ts +112 -0
  105. package/dist/docusaurus/view-model/compound-base-vm.d.ts.map +1 -0
  106. package/dist/docusaurus/view-model/compound-base-vm.js +829 -0
  107. package/dist/docusaurus/view-model/compound-base-vm.js.map +1 -0
  108. package/dist/docusaurus/view-model/description-anchors.d.ts +17 -0
  109. package/dist/docusaurus/view-model/description-anchors.d.ts.map +1 -0
  110. package/dist/docusaurus/view-model/description-anchors.js +37 -0
  111. package/dist/docusaurus/view-model/description-anchors.js.map +1 -0
  112. package/dist/docusaurus/view-model/files-and-folders-vm.d.ts +45 -0
  113. package/dist/docusaurus/view-model/files-and-folders-vm.d.ts.map +1 -0
  114. package/dist/docusaurus/view-model/files-and-folders-vm.js +749 -0
  115. package/dist/docusaurus/view-model/files-and-folders-vm.js.map +1 -0
  116. package/dist/docusaurus/view-model/groups-vm.d.ts +20 -0
  117. package/dist/docusaurus/view-model/groups-vm.d.ts.map +1 -0
  118. package/dist/docusaurus/view-model/groups-vm.js +297 -0
  119. package/dist/docusaurus/view-model/groups-vm.js.map +1 -0
  120. package/dist/docusaurus/view-model/members-vm.d.ts +81 -0
  121. package/dist/docusaurus/view-model/members-vm.d.ts.map +1 -0
  122. package/dist/docusaurus/view-model/members-vm.js +1017 -0
  123. package/dist/docusaurus/view-model/members-vm.js.map +1 -0
  124. package/dist/docusaurus/view-model/namespaces-vm.d.ts +24 -0
  125. package/dist/docusaurus/view-model/namespaces-vm.d.ts.map +1 -0
  126. package/dist/docusaurus/view-model/namespaces-vm.js +527 -0
  127. package/dist/docusaurus/view-model/namespaces-vm.js.map +1 -0
  128. package/dist/docusaurus/view-model/options.d.ts +8 -0
  129. package/dist/docusaurus/view-model/options.d.ts.map +1 -0
  130. package/dist/docusaurus/view-model/options.js +42 -0
  131. package/dist/docusaurus/view-model/options.js.map +1 -0
  132. package/dist/docusaurus/view-model/pages-vm.d.ts +18 -0
  133. package/dist/docusaurus/view-model/pages-vm.d.ts.map +1 -0
  134. package/dist/docusaurus/view-model/pages-vm.js +160 -0
  135. package/dist/docusaurus/view-model/pages-vm.js.map +1 -0
  136. package/dist/docusaurus/view-model/tree-entries-vm.d.ts +44 -0
  137. package/dist/docusaurus/view-model/tree-entries-vm.d.ts.map +1 -0
  138. package/dist/docusaurus/view-model/tree-entries-vm.js +139 -0
  139. package/dist/docusaurus/view-model/tree-entries-vm.js.map +1 -0
  140. package/dist/docusaurus/view-model/view-model.d.ts +34 -0
  141. package/dist/docusaurus/view-model/view-model.d.ts.map +1 -0
  142. package/dist/docusaurus/view-model/view-model.js +284 -0
  143. package/dist/docusaurus/view-model/view-model.js.map +1 -0
  144. package/dist/docusaurus/workspace.d.ts +65 -0
  145. package/dist/docusaurus/workspace.d.ts.map +1 -0
  146. package/dist/docusaurus/workspace.js +350 -0
  147. package/dist/docusaurus/workspace.js.map +1 -0
  148. package/dist/doxygen/data-model/compounds/compounddef-dm.d.ts +97 -0
  149. package/dist/doxygen/data-model/compounds/compounddef-dm.d.ts.map +1 -0
  150. package/dist/doxygen/data-model/compounds/compounddef-dm.js +498 -0
  151. package/dist/doxygen/data-model/compounds/compounddef-dm.js.map +1 -0
  152. package/dist/doxygen/data-model/compounds/compoundreftype-dm.d.ts +27 -0
  153. package/dist/doxygen/data-model/compounds/compoundreftype-dm.d.ts.map +1 -0
  154. package/dist/doxygen/data-model/compounds/compoundreftype-dm.js +91 -0
  155. package/dist/doxygen/data-model/compounds/compoundreftype-dm.js.map +1 -0
  156. package/dist/doxygen/data-model/compounds/descriptiontype-dm.d.ts +1214 -0
  157. package/dist/doxygen/data-model/compounds/descriptiontype-dm.d.ts.map +1 -0
  158. package/dist/doxygen/data-model/compounds/descriptiontype-dm.js +5995 -0
  159. package/dist/doxygen/data-model/compounds/descriptiontype-dm.js.map +1 -0
  160. package/dist/doxygen/data-model/compounds/docvarlistentrytype-dm.d.ts +22 -0
  161. package/dist/doxygen/data-model/compounds/docvarlistentrytype-dm.d.ts.map +1 -0
  162. package/dist/doxygen/data-model/compounds/docvarlistentrytype-dm.js +136 -0
  163. package/dist/doxygen/data-model/compounds/docvarlistentrytype-dm.js.map +1 -0
  164. package/dist/doxygen/data-model/compounds/doxygentype-dm.d.ts +14 -0
  165. package/dist/doxygen/data-model/compounds/doxygentype-dm.d.ts.map +1 -0
  166. package/dist/doxygen/data-model/compounds/doxygentype-dm.js +87 -0
  167. package/dist/doxygen/data-model/compounds/doxygentype-dm.js.map +1 -0
  168. package/dist/doxygen/data-model/compounds/enumvaluetype-dm.d.ts +23 -0
  169. package/dist/doxygen/data-model/compounds/enumvaluetype-dm.d.ts.map +1 -0
  170. package/dist/doxygen/data-model/compounds/enumvaluetype-dm.js +104 -0
  171. package/dist/doxygen/data-model/compounds/enumvaluetype-dm.js.map +1 -0
  172. package/dist/doxygen/data-model/compounds/inctype-dm.d.ts +24 -0
  173. package/dist/doxygen/data-model/compounds/inctype-dm.d.ts.map +1 -0
  174. package/dist/doxygen/data-model/compounds/inctype-dm.js +84 -0
  175. package/dist/doxygen/data-model/compounds/inctype-dm.js.map +1 -0
  176. package/dist/doxygen/data-model/compounds/linkedtexttype-dm.d.ts +33 -0
  177. package/dist/doxygen/data-model/compounds/linkedtexttype-dm.d.ts.map +1 -0
  178. package/dist/doxygen/data-model/compounds/linkedtexttype-dm.js +102 -0
  179. package/dist/doxygen/data-model/compounds/linkedtexttype-dm.js.map +1 -0
  180. package/dist/doxygen/data-model/compounds/listofallmemberstype-dm.d.ts +17 -0
  181. package/dist/doxygen/data-model/compounds/listofallmemberstype-dm.d.ts.map +1 -0
  182. package/dist/doxygen/data-model/compounds/listofallmemberstype-dm.js +69 -0
  183. package/dist/doxygen/data-model/compounds/listofallmemberstype-dm.js.map +1 -0
  184. package/dist/doxygen/data-model/compounds/locationtype-dm.d.ts +24 -0
  185. package/dist/doxygen/data-model/compounds/locationtype-dm.d.ts.map +1 -0
  186. package/dist/doxygen/data-model/compounds/locationtype-dm.js +109 -0
  187. package/dist/doxygen/data-model/compounds/locationtype-dm.js.map +1 -0
  188. package/dist/doxygen/data-model/compounds/memberdeftype-dm.d.ts +67 -0
  189. package/dist/doxygen/data-model/compounds/memberdeftype-dm.d.ts.map +1 -0
  190. package/dist/doxygen/data-model/compounds/memberdeftype-dm.js +253 -0
  191. package/dist/doxygen/data-model/compounds/memberdeftype-dm.js.map +1 -0
  192. package/dist/doxygen/data-model/compounds/memberreftype-dm.d.ts +21 -0
  193. package/dist/doxygen/data-model/compounds/memberreftype-dm.d.ts.map +1 -0
  194. package/dist/doxygen/data-model/compounds/memberreftype-dm.js +105 -0
  195. package/dist/doxygen/data-model/compounds/memberreftype-dm.js.map +1 -0
  196. package/dist/doxygen/data-model/compounds/membertype-dm.d.ts +17 -0
  197. package/dist/doxygen/data-model/compounds/membertype-dm.d.ts.map +1 -0
  198. package/dist/doxygen/data-model/compounds/membertype-dm.js +87 -0
  199. package/dist/doxygen/data-model/compounds/membertype-dm.js.map +1 -0
  200. package/dist/doxygen/data-model/compounds/paramtype-dm.d.ts +25 -0
  201. package/dist/doxygen/data-model/compounds/paramtype-dm.d.ts.map +1 -0
  202. package/dist/doxygen/data-model/compounds/paramtype-dm.js +115 -0
  203. package/dist/doxygen/data-model/compounds/paramtype-dm.js.map +1 -0
  204. package/dist/doxygen/data-model/compounds/referencetype-dm.d.ts +26 -0
  205. package/dist/doxygen/data-model/compounds/referencetype-dm.d.ts.map +1 -0
  206. package/dist/doxygen/data-model/compounds/referencetype-dm.js +93 -0
  207. package/dist/doxygen/data-model/compounds/referencetype-dm.js.map +1 -0
  208. package/dist/doxygen/data-model/compounds/reftexttype-dm.d.ts +15 -0
  209. package/dist/doxygen/data-model/compounds/reftexttype-dm.d.ts.map +1 -0
  210. package/dist/doxygen/data-model/compounds/reftexttype-dm.js +80 -0
  211. package/dist/doxygen/data-model/compounds/reftexttype-dm.js.map +1 -0
  212. package/dist/doxygen/data-model/compounds/reftype-dm.d.ts +55 -0
  213. package/dist/doxygen/data-model/compounds/reftype-dm.d.ts.map +1 -0
  214. package/dist/doxygen/data-model/compounds/reftype-dm.js +152 -0
  215. package/dist/doxygen/data-model/compounds/reftype-dm.js.map +1 -0
  216. package/dist/doxygen/data-model/compounds/reimplementtype-dm.d.ts +20 -0
  217. package/dist/doxygen/data-model/compounds/reimplementtype-dm.d.ts.map +1 -0
  218. package/dist/doxygen/data-model/compounds/reimplementtype-dm.js +77 -0
  219. package/dist/doxygen/data-model/compounds/reimplementtype-dm.js.map +1 -0
  220. package/dist/doxygen/data-model/compounds/sectiondeftype-dm.d.ts +34 -0
  221. package/dist/doxygen/data-model/compounds/sectiondeftype-dm.d.ts.map +1 -0
  222. package/dist/doxygen/data-model/compounds/sectiondeftype-dm.js +139 -0
  223. package/dist/doxygen/data-model/compounds/sectiondeftype-dm.js.map +1 -0
  224. package/dist/doxygen/data-model/compounds/tableofcontentstype-dm.d.ts +46 -0
  225. package/dist/doxygen/data-model/compounds/tableofcontentstype-dm.d.ts.map +1 -0
  226. package/dist/doxygen/data-model/compounds/tableofcontentstype-dm.js +235 -0
  227. package/dist/doxygen/data-model/compounds/tableofcontentstype-dm.js.map +1 -0
  228. package/dist/doxygen/data-model/compounds/templateparamlisttype-dm.d.ts +17 -0
  229. package/dist/doxygen/data-model/compounds/templateparamlisttype-dm.d.ts.map +1 -0
  230. package/dist/doxygen/data-model/compounds/templateparamlisttype-dm.js +69 -0
  231. package/dist/doxygen/data-model/compounds/templateparamlisttype-dm.js.map +1 -0
  232. package/dist/doxygen/data-model/data-model.d.ts +91 -0
  233. package/dist/doxygen/data-model/data-model.d.ts.map +1 -0
  234. package/dist/doxygen/data-model/data-model.js +245 -0
  235. package/dist/doxygen/data-model/data-model.js.map +1 -0
  236. package/dist/doxygen/data-model/doxyfile/doxyfileoptiontype-dm.d.ts +21 -0
  237. package/dist/doxygen/data-model/doxyfile/doxyfileoptiontype-dm.d.ts.map +1 -0
  238. package/dist/doxygen/data-model/doxyfile/doxyfileoptiontype-dm.js +95 -0
  239. package/dist/doxygen/data-model/doxyfile/doxyfileoptiontype-dm.js.map +1 -0
  240. package/dist/doxygen/data-model/doxyfile/doxyfiletype-dm.d.ts +20 -0
  241. package/dist/doxygen/data-model/doxyfile/doxyfiletype-dm.d.ts.map +1 -0
  242. package/dist/doxygen/data-model/doxyfile/doxyfiletype-dm.js +92 -0
  243. package/dist/doxygen/data-model/doxyfile/doxyfiletype-dm.js.map +1 -0
  244. package/dist/doxygen/data-model/doxygen-xml-parser.d.ts +261 -0
  245. package/dist/doxygen/data-model/doxygen-xml-parser.d.ts.map +1 -0
  246. package/dist/doxygen/data-model/doxygen-xml-parser.js +459 -0
  247. package/dist/doxygen/data-model/doxygen-xml-parser.js.map +1 -0
  248. package/dist/doxygen/data-model/index/indexcompoundtype-dm.d.ts +21 -0
  249. package/dist/doxygen/data-model/index/indexcompoundtype-dm.d.ts.map +1 -0
  250. package/dist/doxygen/data-model/index/indexcompoundtype-dm.js +96 -0
  251. package/dist/doxygen/data-model/index/indexcompoundtype-dm.js.map +1 -0
  252. package/dist/doxygen/data-model/index/indexdoxygentype-dm.d.ts +20 -0
  253. package/dist/doxygen/data-model/index/indexdoxygentype-dm.d.ts.map +1 -0
  254. package/dist/doxygen/data-model/index/indexdoxygentype-dm.js +93 -0
  255. package/dist/doxygen/data-model/index/indexdoxygentype-dm.js.map +1 -0
  256. package/dist/doxygen/data-model/index/indexmembertype-dm.d.ts +19 -0
  257. package/dist/doxygen/data-model/index/indexmembertype-dm.d.ts.map +1 -0
  258. package/dist/doxygen/data-model/index/indexmembertype-dm.js +89 -0
  259. package/dist/doxygen/data-model/index/indexmembertype-dm.js.map +1 -0
  260. package/dist/doxygen/data-model/types.d.ts +44 -0
  261. package/dist/doxygen/data-model/types.d.ts.map +1 -0
  262. package/dist/doxygen/data-model/types.js +24 -0
  263. package/dist/doxygen/data-model/types.js.map +1 -0
  264. package/dist/index.d.ts +43 -0
  265. package/dist/index.d.ts.map +1 -0
  266. package/dist/index.js +69 -0
  267. package/dist/index.js.map +1 -0
  268. package/dist/tsconfig.tsbuildinfo +1 -0
  269. package/package.json +99 -0
  270. package/template/css/custom.css +908 -0
  271. package/template/img/README.md +3 -0
  272. package/template/img/document-svgrepo-com.svg +5 -0
  273. package/template/img/folder-svgrepo-com.svg +5 -0
@@ -0,0 +1,829 @@
1
+ /*
2
+ * This file is part of the xPack project (http://xpack.github.io).
3
+ * Copyright (c) 2025 Liviu Ionescu. All rights reserved.
4
+ *
5
+ * Permission to use, copy, modify, and/or distribute this software
6
+ * for any purpose is hereby granted, under the terms of the MIT license.
7
+ *
8
+ * If a copy of the license was not distributed with this file, it can
9
+ * be obtained from https://opensource.org/licenses/MIT.
10
+ */
11
+ // ----------------------------------------------------------------------------
12
+ // import * as util from 'node:util'
13
+ import assert from 'node:assert';
14
+ import path from 'node:path';
15
+ import { ParaDataModel } from '../../doxygen/data-model/compounds/descriptiontype-dm.js';
16
+ import { joinWithLast, sanitizeAnonymousNamespace } from '../utils.js';
17
+ import { Section } from './members-vm.js';
18
+ import { RefTextDataModel } from '../../doxygen/data-model/compounds/reftexttype-dm.js';
19
+ import { SectionDefByKindDataModel, } from '../../doxygen/data-model/compounds/sectiondeftype-dm.js';
20
+ // ----------------------------------------------------------------------------
21
+ export class CompoundBase {
22
+ kind = '';
23
+ compoundName = '';
24
+ id = '';
25
+ // The collection this compound is part of.
26
+ collection;
27
+ titleHtmlString;
28
+ locationFilePath;
29
+ // --------------------------------------------------------------------------
30
+ // Not used for classes, see Class.baseClasses.
31
+ parent;
32
+ // Set in 2 steps, first the Ids and then, when all objects are in,
33
+ // the references.
34
+ // Folder objects use separate arrays for files and folders children.
35
+ childrenIds = [];
36
+ children = [];
37
+ /**
38
+ * @brief Short name, to fit the limited space in the sidebar.
39
+ *
40
+ * If undefined, the compound must not
41
+ * be referred in the sidebar.
42
+ */
43
+ sidebarLabel;
44
+ /**
45
+ * @brief Relative path to the output folder.
46
+ *
47
+ * Starts with plural kind.
48
+ *
49
+ * If undefined, the compound must not
50
+ * be referred in the sidebar.
51
+ */
52
+ sidebarId;
53
+ /**
54
+ * @brief The part below outputFolderPath.
55
+ *
56
+ * No leading slash.
57
+ *
58
+ * If undefined, the MD file for the compound must not be generated.
59
+ */
60
+ relativePermalink;
61
+ /** The name shown in the index section. */
62
+ indexName = '';
63
+ /**
64
+ * @brief
65
+ * The named used in the tree entry rendered in the top index pages.
66
+ */
67
+ treeEntryName = '';
68
+ /** The name shown in the page title. */
69
+ pageTitle = '';
70
+ briefDescriptionHtmlString;
71
+ detailedDescriptionHtmlLines;
72
+ hasSect1InDescription = false;
73
+ locationLines;
74
+ sections = [];
75
+ locationSet = new Set();
76
+ // Shortcut
77
+ includes;
78
+ innerCompounds;
79
+ _private = {};
80
+ // --------------------------------------------------------------------------
81
+ constructor(collection, compoundDef) {
82
+ this._private._compoundDef = compoundDef;
83
+ this.collection = collection;
84
+ const { kind, compoundName, id } = compoundDef;
85
+ this.kind = kind;
86
+ this.compoundName = sanitizeAnonymousNamespace(compoundName);
87
+ this.id = id;
88
+ if (compoundDef.title !== undefined) {
89
+ this.titleHtmlString = this.collection.workspace.renderString(compoundDef.title, 'html');
90
+ }
91
+ if (compoundDef.location?.file !== undefined) {
92
+ const { file } = compoundDef.location;
93
+ this.locationFilePath = file;
94
+ }
95
+ }
96
+ createSections(classUnqualifiedName) {
97
+ const reorderedSectionDefs = this.reorderSectionDefs(classUnqualifiedName);
98
+ if (reorderedSectionDefs !== undefined) {
99
+ const sections = [];
100
+ for (const sectionDef of reorderedSectionDefs) {
101
+ sections.push(new Section(this, sectionDef));
102
+ }
103
+ this.sections = sections.sort((a, b) => a.getSectionOrderByKind() - b.getSectionOrderByKind());
104
+ }
105
+ }
106
+ reorderSectionDefs(classUnqualifiedName) {
107
+ const sectionDefs = this._private._compoundDef?.sectionDefs;
108
+ if (sectionDefs === undefined) {
109
+ return undefined;
110
+ }
111
+ const resultSectionDefs = [];
112
+ const sectionDefsByKind = new Map();
113
+ for (const sectionDef of sectionDefs) {
114
+ if (sectionDef.kind === 'user-defined' &&
115
+ sectionDef.header !== undefined) {
116
+ resultSectionDefs.push(sectionDef);
117
+ continue;
118
+ }
119
+ if (sectionDef.memberDefs !== undefined) {
120
+ for (const memberDef of sectionDef.memberDefs) {
121
+ const adjustedSectionKind = this.adjustSectionKind(sectionDef, memberDef, classUnqualifiedName);
122
+ let mapSectionDef = sectionDefsByKind.get(adjustedSectionKind);
123
+ if (mapSectionDef === undefined) {
124
+ mapSectionDef = new SectionDefByKindDataModel(adjustedSectionKind);
125
+ sectionDefsByKind.set(adjustedSectionKind, mapSectionDef);
126
+ }
127
+ mapSectionDef.memberDefs ??= [];
128
+ mapSectionDef.memberDefs.push(memberDef);
129
+ }
130
+ }
131
+ if (sectionDef.members !== undefined) {
132
+ for (const member of sectionDef.members) {
133
+ const adjustedSectionKind = this.adjustSectionKind(sectionDef, member, classUnqualifiedName);
134
+ let mapSectionDef = sectionDefsByKind.get(adjustedSectionKind);
135
+ if (mapSectionDef === undefined) {
136
+ mapSectionDef = new SectionDefByKindDataModel(adjustedSectionKind);
137
+ sectionDefsByKind.set(adjustedSectionKind, mapSectionDef);
138
+ }
139
+ mapSectionDef.members ??= [];
140
+ mapSectionDef.members.push(member);
141
+ }
142
+ }
143
+ }
144
+ resultSectionDefs.push(...sectionDefsByKind.values());
145
+ return resultSectionDefs;
146
+ }
147
+ // <xsd:simpleType name="DoxMemberKind">
148
+ // <xsd:restriction base="xsd:string">
149
+ // <xsd:enumeration value="define" />
150
+ // <xsd:enumeration value="property" />
151
+ // <xsd:enumeration value="event" />
152
+ // <xsd:enumeration value="variable" />
153
+ // <xsd:enumeration value="typedef" />
154
+ // <xsd:enumeration value="enum" />
155
+ // <xsd:enumeration value="function" />
156
+ // <xsd:enumeration value="signal" />
157
+ // <xsd:enumeration value="prototype" />
158
+ // <xsd:enumeration value="friend" />
159
+ // <xsd:enumeration value="dcop" />
160
+ // <xsd:enumeration value="slot" />
161
+ // <xsd:enumeration value="interface" />
162
+ // <xsd:enumeration value="service" />
163
+ // </xsd:restriction>
164
+ // </xsd:simpleType>
165
+ adjustSectionKind(sectionDef, memberBase, classUnqualifiedName) {
166
+ // In general, adjust to member kind.
167
+ let adjustedSectionKind = memberBase.kind;
168
+ switch (memberBase.kind) {
169
+ case 'function':
170
+ // If public/protected/private, preserve the prefix.
171
+ if (this.isOperator(memberBase.name)) {
172
+ adjustedSectionKind = sectionDef.computeAdjustedKind('operator');
173
+ }
174
+ else if (classUnqualifiedName !== undefined) {
175
+ if (memberBase.name === classUnqualifiedName) {
176
+ adjustedSectionKind = sectionDef.computeAdjustedKind('constructorr');
177
+ }
178
+ else if (memberBase.name.replace('~', '') === classUnqualifiedName) {
179
+ adjustedSectionKind = sectionDef.computeAdjustedKind('destructor');
180
+ }
181
+ else {
182
+ adjustedSectionKind = sectionDef.computeAdjustedKind('func', 'function');
183
+ }
184
+ }
185
+ else {
186
+ adjustedSectionKind = sectionDef.computeAdjustedKind('func', 'function');
187
+ }
188
+ break;
189
+ case 'variable':
190
+ adjustedSectionKind = sectionDef.computeAdjustedKind('attrib', 'variable');
191
+ break;
192
+ case 'typedef':
193
+ adjustedSectionKind = sectionDef.computeAdjustedKind('type', 'typedef');
194
+ break;
195
+ case 'slot':
196
+ adjustedSectionKind = sectionDef.computeAdjustedKind('slot');
197
+ break;
198
+ // case 'define':
199
+ // case 'property':
200
+ // case 'event':
201
+ // case 'enum':
202
+ // case 'signal':
203
+ // case 'prototype':
204
+ // case 'friend':
205
+ // case 'dcop':
206
+ // case 'interface':
207
+ // case 'service':
208
+ default: {
209
+ // Adjust to member kind.
210
+ const { kind } = memberBase;
211
+ adjustedSectionKind = kind;
212
+ break;
213
+ }
214
+ }
215
+ // console.log('adjustedSectionKind:', memberBase.kind, adjustedSectionKind)
216
+ return adjustedSectionKind;
217
+ }
218
+ initializeLate() {
219
+ const { workspace } = this.collection;
220
+ const compoundDef = this._private._compoundDef;
221
+ assert(compoundDef !== undefined);
222
+ if (compoundDef.briefDescription !== undefined) {
223
+ // console.log(compoundDef.briefDescription)
224
+ assert(compoundDef.briefDescription.children !== undefined);
225
+ if (compoundDef.briefDescription.children.length > 1) {
226
+ assert(compoundDef.briefDescription.children[1] instanceof ParaDataModel);
227
+ this.briefDescriptionHtmlString = workspace
228
+ .renderElementsArrayToString(compoundDef.briefDescription.children[1].children, 'html')
229
+ .trim();
230
+ }
231
+ else {
232
+ this.briefDescriptionHtmlString = workspace
233
+ .renderElementToString(compoundDef.briefDescription, 'html')
234
+ .trim();
235
+ }
236
+ }
237
+ if (compoundDef.detailedDescription !== undefined) {
238
+ // console.log(compoundDef.detailedDescription)
239
+ this.detailedDescriptionHtmlLines = workspace.renderElementToLines(compoundDef.detailedDescription, 'html');
240
+ }
241
+ if (this.kind === 'page') {
242
+ // The location for pages is not usable.
243
+ }
244
+ else if (this.kind === 'dir') {
245
+ // The location for folders is not used.
246
+ }
247
+ else {
248
+ if (compoundDef.location !== undefined) {
249
+ this.locationLines = this.renderLocationToLines(compoundDef.location);
250
+ }
251
+ }
252
+ if (compoundDef.sectionDefs !== undefined) {
253
+ for (const sectionDef of compoundDef.sectionDefs) {
254
+ if (sectionDef.memberDefs !== undefined) {
255
+ for (const memberDef of sectionDef.memberDefs) {
256
+ if (memberDef.location !== undefined) {
257
+ const { file } = memberDef.location;
258
+ this.locationSet.add(file);
259
+ if (memberDef.location.bodyfile !== undefined) {
260
+ this.locationSet.add(memberDef.location.bodyfile);
261
+ }
262
+ }
263
+ }
264
+ }
265
+ }
266
+ }
267
+ const { includes } = compoundDef;
268
+ if (includes !== undefined) {
269
+ this.includes = includes;
270
+ }
271
+ for (const innerKey of Object.keys(compoundDef)) {
272
+ if (innerKey.startsWith('inner') &&
273
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
274
+ compoundDef[innerKey] !== undefined) {
275
+ this.innerCompounds ??= new Map();
276
+ this.innerCompounds.set(innerKey, compoundDef);
277
+ }
278
+ }
279
+ }
280
+ isOperator(name) {
281
+ // Two word operators, like
282
+ if (name.startsWith('operator') &&
283
+ ' =!<>+-*/%&|^~,"(['.includes(name.charAt(8))) {
284
+ return true;
285
+ }
286
+ return false;
287
+ }
288
+ // --------------------------------------------------------------------------
289
+ renderBriefDescriptionToHtmlString({ briefDescriptionHtmlString, todo = '', morePermalink, }) {
290
+ let text = '';
291
+ if (!this.collection.workspace.options.suggestToDoDescriptions) {
292
+ todo = '';
293
+ }
294
+ if (briefDescriptionHtmlString === undefined && todo.length === 0) {
295
+ return '';
296
+ }
297
+ if (briefDescriptionHtmlString !== undefined &&
298
+ briefDescriptionHtmlString.length > 0) {
299
+ text += '<p>';
300
+ text += briefDescriptionHtmlString;
301
+ if (morePermalink !== undefined && morePermalink.length > 0) {
302
+ text += ` <a href="${morePermalink}">`;
303
+ text += 'More...';
304
+ text += '</a>';
305
+ }
306
+ text += '</p>';
307
+ }
308
+ else if (todo.length > 0) {
309
+ text += `TODO: add <code>@brief</code> to <code>${todo}</code>`;
310
+ }
311
+ return text;
312
+ }
313
+ renderDetailedDescriptionToHtmlLines({ briefDescriptionHtmlString, detailedDescriptionHtmlLines, todo = '', showHeader, showBrief = false, }) {
314
+ const lines = [];
315
+ if (!this.collection.workspace.options.suggestToDoDescriptions) {
316
+ todo = '';
317
+ }
318
+ // const workspace = this.collection.workspace
319
+ if (showHeader) {
320
+ if ((detailedDescriptionHtmlLines !== undefined &&
321
+ detailedDescriptionHtmlLines.length > 0) ||
322
+ todo.length > 0 ||
323
+ (showBrief &&
324
+ briefDescriptionHtmlString !== undefined &&
325
+ briefDescriptionHtmlString.length > 0)) {
326
+ lines.push('');
327
+ lines.push('## Description {#details}');
328
+ }
329
+ }
330
+ if (showBrief) {
331
+ if (showHeader) {
332
+ lines.push('');
333
+ }
334
+ if (briefDescriptionHtmlString !== undefined &&
335
+ briefDescriptionHtmlString.length > 0) {
336
+ // lines.push(`<p>${briefDescriptionNoParaString}</p>`)
337
+ lines.push(`<p>${briefDescriptionHtmlString}</p>`);
338
+ }
339
+ else if (todo.length > 0) {
340
+ lines.push(`TODO: add <code>@brief</code> to <code>${todo}</code>`);
341
+ }
342
+ }
343
+ // console.log(
344
+ // util.inspect(detailedDescriptionLines, { compact: false, depth: 999 })
345
+ // )
346
+ if (detailedDescriptionHtmlLines !== undefined &&
347
+ detailedDescriptionHtmlLines.length > 0) {
348
+ lines.push('');
349
+ lines.push(...detailedDescriptionHtmlLines);
350
+ }
351
+ else if (todo.length > 0) {
352
+ lines.push('');
353
+ lines.push(`TODO: add <code>@details</code> to <code>${todo}</code>`);
354
+ }
355
+ return lines;
356
+ }
357
+ // --------------------------------------------------------------------------
358
+ hasInnerIndices() {
359
+ return this.innerCompounds !== undefined && this.innerCompounds.size > 0;
360
+ }
361
+ renderInnerIndicesToLines({ suffixes = [], }) {
362
+ const lines = [];
363
+ if (this.innerCompounds === undefined) {
364
+ return [];
365
+ }
366
+ for (const innerKey of Object.keys(this.innerCompounds)) {
367
+ if (innerKey.startsWith('inner')) {
368
+ const suffix = innerKey.substring(5);
369
+ if (!suffixes.includes(suffix)) {
370
+ console.warn(innerKey, 'not processed for', this.compoundName, 'in renderInnerIndicesToLines');
371
+ continue;
372
+ }
373
+ }
374
+ }
375
+ const { workspace } = this.collection;
376
+ for (const suffix of suffixes) {
377
+ const innerKey = `inner${suffix}`;
378
+ const innerCompound = this.innerCompounds.get(innerKey);
379
+ if (innerCompound === undefined) {
380
+ continue;
381
+ }
382
+ const innerObjects =
383
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
384
+ innerCompound[innerKey];
385
+ if (innerObjects === undefined || innerObjects.length === 0) {
386
+ continue;
387
+ }
388
+ lines.push('');
389
+ lines.push(`## ${suffix === 'Dirs'
390
+ ? 'Folders'
391
+ : suffix === 'Groups'
392
+ ? 'Topics'
393
+ : suffix} Index`);
394
+ lines.push('');
395
+ lines.push('<table class="doxyMembersIndex">');
396
+ for (const innerObject of innerObjects) {
397
+ // console.log(
398
+ // util.inspect(innerObject, { compact: false, depth: 999 })
399
+ // )
400
+ const innerDataObject = workspace.viewModel.compoundsById.get(innerObject.refid);
401
+ if (innerDataObject !== undefined) {
402
+ const { kind } = innerDataObject;
403
+ const itemType = kind === 'dir' ? 'folder' : kind === 'group' ? '&nbsp;' : kind;
404
+ const permalink = workspace.getPagePermalink(innerObject.refid);
405
+ // Debatable. The compound name has the full namespace,
406
+ // the index has the template signature.
407
+ const name = this.collection.workspace.renderString(innerDataObject.indexName, 'html');
408
+ let itemName = '';
409
+ if (permalink !== undefined && permalink.length > 0) {
410
+ itemName = `<a href="${permalink}">${name}</a>`;
411
+ }
412
+ else {
413
+ itemName = name;
414
+ }
415
+ const childrenLines = [];
416
+ const morePermalink = innerDataObject.detailedDescriptionHtmlLines !== undefined &&
417
+ permalink !== undefined
418
+ ? `${permalink}/#details`
419
+ : undefined;
420
+ if (innerDataObject.briefDescriptionHtmlString !== undefined &&
421
+ innerDataObject.briefDescriptionHtmlString.length > 0) {
422
+ childrenLines.push(this.renderBriefDescriptionToHtmlString({
423
+ briefDescriptionHtmlString: innerDataObject.briefDescriptionHtmlString,
424
+ morePermalink,
425
+ }));
426
+ }
427
+ lines.push('');
428
+ lines.push(...this.collection.workspace.renderMembersIndexItemToHtmlLines({
429
+ type: itemType,
430
+ name: itemName,
431
+ childrenLines,
432
+ }));
433
+ }
434
+ else {
435
+ lines.push('');
436
+ const itemType = 'class';
437
+ const { text: itemName } = innerObject;
438
+ lines.push(...this.collection.workspace.renderMembersIndexItemToHtmlLines({
439
+ type: itemType,
440
+ name: itemName,
441
+ childrenLines: [],
442
+ }));
443
+ if (this.collection.workspace.options.debug) {
444
+ console.warn(innerObject);
445
+ }
446
+ if (this.collection.workspace.options.verbose) {
447
+ console.warn('Object definition not found, rendered summarily in ' +
448
+ 'renderInnerIndicesToLines()');
449
+ }
450
+ }
451
+ }
452
+ lines.push('');
453
+ lines.push('</table>');
454
+ }
455
+ return lines;
456
+ }
457
+ hasSections() {
458
+ return this.sections.length > 0;
459
+ }
460
+ renderSectionIndicesToLines() {
461
+ const lines = [];
462
+ for (const section of this.sections) {
463
+ // console.log(sectionDef)
464
+ lines.push(...section.renderIndexToLines());
465
+ }
466
+ return lines;
467
+ }
468
+ // --------------------------------------------------------------------------
469
+ renderIncludesIndexToLines() {
470
+ const lines = [];
471
+ const { workspace } = this.collection;
472
+ if (this.includes !== undefined) {
473
+ const includeLines = workspace.renderElementsArrayToLines(this.includes, 'html');
474
+ lines.push('');
475
+ lines.push('## Included Headers');
476
+ lines.push('');
477
+ lines.push(`<div class="doxyIncludesList">${includeLines[0]}`);
478
+ for (const includeLine of includeLines.slice(1)) {
479
+ lines.push(includeLine);
480
+ }
481
+ lines.push('</div>');
482
+ }
483
+ return lines;
484
+ }
485
+ // --------------------------------------------------------------------------
486
+ renderSectionsToLines() {
487
+ const lines = [];
488
+ for (const section of this.sections) {
489
+ lines.push(...section.renderToLines());
490
+ }
491
+ return lines;
492
+ }
493
+ renderLocationToLines(location) {
494
+ const lines = [];
495
+ let text = '';
496
+ const { workspace } = this.collection;
497
+ if (location !== undefined) {
498
+ // console.log('location.file:', location.file)
499
+ if (location.file.includes('[')) {
500
+ // Ignore cases like `[generated]`, encountered in llvm.
501
+ return lines;
502
+ }
503
+ // console.log(
504
+ // 'renderLocationToLines', this.kind, this.compoundName, this.id
505
+ // )
506
+ const file = workspace.filesByPath.get(location.file);
507
+ if (file !== undefined) {
508
+ const permalink = workspace.getPagePermalink(file.id);
509
+ if (location.bodyfile !== undefined &&
510
+ location.file !== location.bodyfile) {
511
+ text += '<p>';
512
+ text += 'Declaration ';
513
+ if (location.line !== undefined) {
514
+ text += 'at line ';
515
+ const paddedLine = location.line.toString().padStart(5, '0');
516
+ const lineAttribute = `l${paddedLine}`;
517
+ if (permalink !== undefined &&
518
+ permalink.length > 0 &&
519
+ file.listingLineNumbers.has(location.line.valueOf())) {
520
+ text +=
521
+ `<a href="${permalink}/#${lineAttribute}">` +
522
+ workspace.renderString(location.line.toString(), 'html') +
523
+ `</a>`;
524
+ }
525
+ else {
526
+ text += location.line.toString();
527
+ }
528
+ text += ' of file ';
529
+ }
530
+ else {
531
+ text += ' in file ';
532
+ }
533
+ const locationFile = workspace.renderString(path.basename(location.file), 'html');
534
+ if (permalink !== undefined && permalink.length > 0) {
535
+ text += `<a href="${permalink}">${locationFile}</a>`;
536
+ }
537
+ else {
538
+ text += locationFile;
539
+ }
540
+ const definitionFile = workspace.filesByPath.get(location.bodyfile);
541
+ if (definitionFile !== undefined) {
542
+ const definitionPermalink = workspace.getPagePermalink(definitionFile.id);
543
+ text += ', definition ';
544
+ if (location.bodystart !== undefined) {
545
+ text += 'at line ';
546
+ const lineStart = `l${location.bodystart
547
+ .toString()
548
+ .padStart(5, '0')}`;
549
+ if (definitionPermalink !== undefined &&
550
+ definitionPermalink.length > 0 &&
551
+ definitionFile.listingLineNumbers.has(location.bodystart.valueOf())) {
552
+ const bodyStart = workspace.renderString(location.bodystart.toString(), 'html');
553
+ text +=
554
+ `<a href="${definitionPermalink}/#${lineStart}">` +
555
+ bodyStart +
556
+ '</a>';
557
+ }
558
+ else {
559
+ text += location.bodystart.toString();
560
+ }
561
+ text += ' of file ';
562
+ }
563
+ else {
564
+ text += ' in file ';
565
+ }
566
+ const locationBodyFile = workspace.renderString(path.basename(location.bodyfile), 'html');
567
+ if (definitionPermalink !== undefined &&
568
+ definitionPermalink.length > 0) {
569
+ text += `<a href="${definitionPermalink}">${locationBodyFile}</a>`;
570
+ }
571
+ else {
572
+ text += locationBodyFile;
573
+ }
574
+ }
575
+ else {
576
+ if (this.collection.workspace.options.verbose) {
577
+ console.warn('File', location.bodyfile, 'not a location.');
578
+ }
579
+ }
580
+ text += '.';
581
+ text += '</p>';
582
+ text += '\n';
583
+ }
584
+ else {
585
+ text += '<p>';
586
+ text += 'Definition ';
587
+ if (location.line !== undefined) {
588
+ text += 'at line ';
589
+ const paddedLine = location.line.toString().padStart(5, '0');
590
+ const lineAttribute = `l${paddedLine}`;
591
+ if (permalink !== undefined &&
592
+ permalink.length > 0 &&
593
+ file.listingLineNumbers.has(location.line.valueOf())) {
594
+ const lineStr = location.line.toString();
595
+ const lineHtml = workspace.renderString(lineStr, 'html');
596
+ text += `<a href="${permalink}/#${lineAttribute}">${lineHtml}</a>`;
597
+ }
598
+ else {
599
+ text += location.line.toString();
600
+ }
601
+ text += ' of file ';
602
+ }
603
+ else {
604
+ text += ' in file ';
605
+ }
606
+ const locationFile = workspace.renderString(path.basename(location.file), 'html');
607
+ if (permalink !== undefined && permalink.length > 0) {
608
+ text += `<a href="${permalink}">${locationFile}</a>`;
609
+ }
610
+ else {
611
+ text += locationFile;
612
+ }
613
+ text += '.';
614
+ text += '</p>';
615
+ text += '\n';
616
+ }
617
+ }
618
+ else {
619
+ if (this.collection.workspace.options.verbose) {
620
+ console.warn('File', location.file, 'not a known location.');
621
+ }
622
+ }
623
+ }
624
+ if (text.length > 0) {
625
+ lines.push('');
626
+ lines.push(text);
627
+ }
628
+ return lines;
629
+ }
630
+ renderGeneratedFromToLines() {
631
+ const lines = [];
632
+ if (this.locationSet.size > 0) {
633
+ lines.push('');
634
+ lines.push('<hr/>');
635
+ lines.push('');
636
+ lines.push(`The documentation for this ${this.kind} was generated from the ` +
637
+ `following file${this.locationSet.size > 1 ? 's' : ''}:`);
638
+ lines.push('');
639
+ lines.push('<ul>');
640
+ const { workspace } = this.collection;
641
+ const sortedFiles = [...this.locationSet].sort((a, b) => a.localeCompare(b));
642
+ for (const fileName of sortedFiles) {
643
+ // console.log('search', fileName)
644
+ const fileNameEscaped = workspace.renderString(path.basename(fileName), 'html');
645
+ const file = workspace.filesByPath.get(fileName);
646
+ if (file !== undefined) {
647
+ const permalink = workspace.getPagePermalink(file.id);
648
+ if (permalink !== undefined && permalink.length > 0) {
649
+ lines.push(`<li><a href="${permalink}">${fileNameEscaped}</a></li>`);
650
+ }
651
+ else {
652
+ lines.push(`<li>${fileNameEscaped}</li>`);
653
+ }
654
+ }
655
+ else {
656
+ lines.push(`<li>${fileNameEscaped}</li>`);
657
+ }
658
+ }
659
+ lines.push('</ul>');
660
+ }
661
+ return lines;
662
+ }
663
+ renderReferencesToHtmlString(references) {
664
+ let text = '';
665
+ if (references === undefined || references.length === 0) {
666
+ return '';
667
+ }
668
+ const { workspace } = this.collection;
669
+ const referenceLines = [];
670
+ for (const reference of references) {
671
+ referenceLines.push(workspace.renderElementToString(reference, 'html'));
672
+ }
673
+ text += '<p>';
674
+ if (referenceLines.length === 1) {
675
+ text += 'Reference ';
676
+ }
677
+ else {
678
+ text += 'References ';
679
+ }
680
+ text += joinWithLast(referenceLines, ', ', ' and ');
681
+ text += '.';
682
+ text += '</p>';
683
+ text += '\n';
684
+ return text;
685
+ }
686
+ renderReferencedByToHtmlString(referencedBy) {
687
+ let text = '';
688
+ if (referencedBy === undefined || referencedBy.length === 0) {
689
+ return '';
690
+ }
691
+ const { workspace } = this.collection;
692
+ const referenceLines = [];
693
+ for (const reference of referencedBy) {
694
+ referenceLines.push(workspace.renderElementToString(reference, 'html'));
695
+ }
696
+ text += '<p>';
697
+ text += 'Referenced by ';
698
+ text += joinWithLast(referenceLines, ', ', ' and ');
699
+ text += '.';
700
+ text += '</p>';
701
+ text += '\n';
702
+ return text;
703
+ }
704
+ // --------------------------------------------------------------------------
705
+ /**
706
+ * Return an array of types, like `class T`, or `class U = T`, or `N T::* MP`
707
+ * @param templateParamList
708
+ * @returns
709
+ */
710
+ collectTemplateParameters({ templateParamList, withDefaults = false, }) {
711
+ if (templateParamList?.params === undefined) {
712
+ return [];
713
+ }
714
+ const templateParameters = [];
715
+ for (const param of templateParamList.params) {
716
+ // console.log(util.inspect(param, { compact: false, depth: 999 }))
717
+ assert(param.type !== undefined);
718
+ let paramString = '';
719
+ assert(param.type.children !== undefined);
720
+ for (const child of param.type.children) {
721
+ if (typeof child === 'string') {
722
+ paramString += child;
723
+ }
724
+ else if (child instanceof RefTextDataModel) {
725
+ paramString += child.text;
726
+ }
727
+ }
728
+ if (param.declname !== undefined) {
729
+ paramString += ` ${param.declname}`;
730
+ }
731
+ if (withDefaults) {
732
+ if (param.defval !== undefined) {
733
+ const defval = param.defval;
734
+ paramString += ' = ';
735
+ assert(defval.children !== undefined);
736
+ for (const child of defval.children) {
737
+ if (typeof child === 'string') {
738
+ paramString += child;
739
+ }
740
+ else if (child instanceof RefTextDataModel) {
741
+ paramString += child.text;
742
+ }
743
+ }
744
+ }
745
+ }
746
+ templateParameters.push(paramString);
747
+ }
748
+ return templateParameters;
749
+ }
750
+ isTemplate(templateParamList) {
751
+ return (templateParamList?.params ?? []).length > 0;
752
+ }
753
+ collectTemplateParameterNames(templateParamList) {
754
+ if (templateParamList.params === undefined) {
755
+ return [];
756
+ }
757
+ const templateParameterNames = [];
758
+ for (const param of templateParamList.params) {
759
+ // console.log(util.inspect(param, { compact: false, depth: 999 }))
760
+ assert(param.type !== undefined);
761
+ let paramString = '';
762
+ // declname? defname? order?
763
+ if (param.declname !== undefined) {
764
+ paramString += param.declname;
765
+ }
766
+ else {
767
+ assert(param.type.children !== undefined);
768
+ for (const child of param.type.children) {
769
+ if (typeof child === 'string') {
770
+ // Extract the parameter name, passed as `class T`.
771
+ paramString += child;
772
+ }
773
+ else if (child instanceof RefTextDataModel) {
774
+ paramString += child.text;
775
+ }
776
+ }
777
+ }
778
+ const paramName = paramString
779
+ .replaceAll(/class /g, '')
780
+ .replaceAll(/typename /g, '');
781
+ templateParameterNames.push(paramName);
782
+ }
783
+ return templateParameterNames;
784
+ }
785
+ renderTemplateParametersToString({ templateParamList, withDefaults = false, }) {
786
+ let text = '';
787
+ if (templateParamList?.params !== undefined) {
788
+ const templateParameters = this.collectTemplateParameters({
789
+ templateParamList,
790
+ withDefaults,
791
+ });
792
+ if (templateParameters.length > 0) {
793
+ text += `<${templateParameters.join(', ')}>`;
794
+ }
795
+ }
796
+ return text;
797
+ }
798
+ renderTemplateParameterNamesToString(templateParamList) {
799
+ let text = '';
800
+ if (templateParamList?.params !== undefined) {
801
+ const templateParameterNames = this.collectTemplateParameterNames(templateParamList);
802
+ if (templateParameterNames.length > 0) {
803
+ text += `<${templateParameterNames.join(', ')}>`;
804
+ }
805
+ }
806
+ return text;
807
+ }
808
+ // --------------------------------------------------------------------------
809
+ // Override it
810
+ hasAnyContent() {
811
+ if (this.briefDescriptionHtmlString !== undefined &&
812
+ this.briefDescriptionHtmlString.length > 0) {
813
+ // console.log('has content brief', this.compoundName)
814
+ return true;
815
+ }
816
+ if (this.detailedDescriptionHtmlLines !== undefined &&
817
+ this.detailedDescriptionHtmlLines.length > 0) {
818
+ // console.log('has content details', this.compoundName)
819
+ return true;
820
+ }
821
+ if (this.sections.length > 0) {
822
+ // console.log('has content sections.length', this)
823
+ return true;
824
+ }
825
+ return false;
826
+ }
827
+ }
828
+ // ----------------------------------------------------------------------------
829
+ //# sourceMappingURL=compound-base-vm.js.map