@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,749 @@
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 { CompoundBase } from './compound-base-vm.js';
15
+ import { CollectionBase } from './collection-base.js';
16
+ import { flattenPath, sanitizeHierarchicalPath } from '../utils.js';
17
+ import { FileTreeEntry } from './tree-entries-vm.js';
18
+ import { Class } from './classes-vm.js';
19
+ import { Namespace } from './namespaces-vm.js';
20
+ // ----------------------------------------------------------------------------
21
+ export class FilesAndFolders extends CollectionBase {
22
+ // compoundsById: Map<string, File | Folder>
23
+ compoundFoldersById;
24
+ compoundFilesById;
25
+ topLevelFolders = [];
26
+ topLevelFiles = [];
27
+ // folders: Folders
28
+ // --------------------------------------------------------------------------
29
+ constructor(workspace) {
30
+ super(workspace);
31
+ // this.compoundsById = new Map()
32
+ this.compoundFoldersById = new Map();
33
+ this.compoundFilesById = new Map();
34
+ }
35
+ // --------------------------------------------------------------------------
36
+ addChild(compoundDef) {
37
+ if (compoundDef.kind === 'file') {
38
+ const file = new File(this, compoundDef);
39
+ this.collectionCompoundsById.set(file.id, file);
40
+ this.compoundFilesById.set(file.id, file);
41
+ return file;
42
+ }
43
+ else if (compoundDef.kind === 'dir') {
44
+ const folder = new Folder(this, compoundDef);
45
+ this.collectionCompoundsById.set(folder.id, folder);
46
+ this.compoundFoldersById.set(folder.id, folder);
47
+ return folder;
48
+ }
49
+ else {
50
+ throw new Error(`kind ${compoundDef.kind} not implemented in ${this.constructor.name}`);
51
+ }
52
+ }
53
+ // --------------------------------------------------------------------------
54
+ createCompoundsHierarchies() {
55
+ // Recreate files and folders hierarchies.
56
+ // console.log(this.compoundsById.size)
57
+ for (const [, folder] of this.compoundFoldersById) {
58
+ for (const childFolderId of folder.childrenFolderIds) {
59
+ const childFolder = this.compoundFoldersById.get(childFolderId);
60
+ assert(childFolder !== undefined);
61
+ if (this.workspace.options.debug) {
62
+ console.log('childFolderId', childFolderId, childFolder.compoundName, 'has parent', folder.parent?.id ?? '(no parent id)', folder.compoundName);
63
+ }
64
+ childFolder.parent = folder;
65
+ folder.children.push(childFolder);
66
+ }
67
+ for (const childFileId of folder.childrenFileIds) {
68
+ const childFile = this.compoundFilesById.get(childFileId);
69
+ if (childFile !== undefined) {
70
+ if (this.workspace.options.debug) {
71
+ console.log('childFileId', childFileId, childFile.compoundName, 'has parent', folder.parent?.id ?? '(no parent id)', folder.compoundName);
72
+ }
73
+ childFile.parent = folder;
74
+ folder.children.push(childFile);
75
+ }
76
+ else {
77
+ console.warn(childFileId, 'not a child of', folder.id);
78
+ }
79
+ }
80
+ }
81
+ for (const [fileId, file] of this.compoundFilesById) {
82
+ this.workspace.viewModel.compoundsById.set(fileId, file);
83
+ }
84
+ for (const [folderId, folder] of this.compoundFoldersById) {
85
+ if (folder.parent === undefined) {
86
+ if (this.workspace.options.debug) {
87
+ console.log('topFolderId:', folderId);
88
+ }
89
+ this.topLevelFolders.push(folder);
90
+ }
91
+ }
92
+ for (const [fileId, file] of this.compoundFilesById) {
93
+ if (file.parent === undefined) {
94
+ if (this.workspace.options.debug) {
95
+ console.log('topFileId:', fileId);
96
+ }
97
+ this.topLevelFiles.push(file);
98
+ }
99
+ const { locationFilePath } = file;
100
+ assert(locationFilePath !== undefined);
101
+ this.workspace.filesByPath.set(locationFilePath, file);
102
+ if (this.workspace.options.debug) {
103
+ // console.log('filesByPath.set', path, file)
104
+ console.log('filesByPath.set', locationFilePath);
105
+ }
106
+ }
107
+ for (const [, folder] of this.compoundFoldersById) {
108
+ let parentPath = '';
109
+ if (folder.parent !== undefined) {
110
+ if (folder.parent instanceof Folder) {
111
+ parentPath = `${this.getRelativePathRecursively(folder.parent)}/`;
112
+ }
113
+ }
114
+ // console.log(folder.compoundName)
115
+ folder.relativePath = `${parentPath}${folder.compoundName}`;
116
+ const sanitizedPath = sanitizeHierarchicalPath(folder.relativePath);
117
+ folder.relativePermalink = `folders/${sanitizedPath}`;
118
+ folder.sidebarId = `folders/${flattenPath(sanitizedPath)}`;
119
+ // console.log('0', folder.id)
120
+ // console.log('1', folder.compoundName)
121
+ // console.log('2', folder.relativePermalink)
122
+ // console.log('3', folder.docusaurusId)
123
+ // console.log('4', folder.sidebarLabel)
124
+ // console.log('5', folder.indexName)
125
+ // console.log()
126
+ }
127
+ // Cannot be done in each object, since it needs the hierarchy.
128
+ for (const [, file] of this.compoundFilesById) {
129
+ let parentPath = '';
130
+ if (file.parent !== undefined) {
131
+ if (file.parent instanceof Folder) {
132
+ parentPath = `${this.getRelativePathRecursively(file.parent)}/`;
133
+ }
134
+ }
135
+ // console.log(file.compoundName)
136
+ file.relativePath = `${parentPath}${file.compoundName}`;
137
+ const sanitizedPath = sanitizeHierarchicalPath(file.relativePath);
138
+ file.relativePermalink = `files/${sanitizedPath}`;
139
+ file.sidebarId = `files/${flattenPath(sanitizedPath)}`;
140
+ // console.log('0', file.id)
141
+ // console.log('1', file.compoundName)
142
+ // console.log('2', file.relativePermalink)
143
+ // console.log('3', file.docusaurusId)
144
+ // console.log('4', file.sidebarLabel)
145
+ // console.log('5', file.indexName)
146
+ // console.log()
147
+ }
148
+ }
149
+ getRelativePathRecursively(folder) {
150
+ let parentPath = '';
151
+ if (folder.parent !== undefined) {
152
+ if (folder.parent instanceof Folder) {
153
+ parentPath = `${this.getRelativePathRecursively(folder.parent)}/`;
154
+ }
155
+ }
156
+ return `${parentPath}${folder.compoundName}`;
157
+ }
158
+ // --------------------------------------------------------------------------
159
+ addSidebarItems(sidebarCategory) {
160
+ const indicesSet = this.workspace.indicesMaps.get('files');
161
+ if (indicesSet === undefined) {
162
+ return;
163
+ }
164
+ // Add folders & files to the sidebar.
165
+ // Top level folders & files are added below a Files category
166
+ const filesCategory = {
167
+ type: 'category',
168
+ label: 'Files',
169
+ link: {
170
+ type: 'doc',
171
+ id: `${this.workspace.sidebarBaseId}indices/files/index`,
172
+ },
173
+ collapsed: true,
174
+ items: [
175
+ {
176
+ type: 'category',
177
+ label: 'Hierarchy',
178
+ collapsed: true,
179
+ items: [],
180
+ },
181
+ ],
182
+ };
183
+ for (const folder of this.topLevelFolders) {
184
+ const item = this.createFolderSidebarItemRecursively(folder);
185
+ if (item !== undefined) {
186
+ ;
187
+ filesCategory.items[0].items.push(item);
188
+ }
189
+ }
190
+ for (const file of this.topLevelFiles) {
191
+ const item = this.createFileSidebarItem(file);
192
+ if (item !== undefined) {
193
+ ;
194
+ filesCategory.items[0].items.push(item);
195
+ }
196
+ }
197
+ if (indicesSet.has('all')) {
198
+ filesCategory.items.push({
199
+ type: 'doc',
200
+ label: 'All',
201
+ id: `${this.workspace.sidebarBaseId}indices/files/all`,
202
+ });
203
+ }
204
+ if (indicesSet.has('classes')) {
205
+ filesCategory.items.push({
206
+ type: 'doc',
207
+ label: 'Classes',
208
+ id: `${this.workspace.sidebarBaseId}indices/files/classes`,
209
+ });
210
+ }
211
+ if (indicesSet.has('namespaces')) {
212
+ filesCategory.items.push({
213
+ type: 'doc',
214
+ label: 'Namespaces',
215
+ id: `${this.workspace.sidebarBaseId}indices/files/namespaces`,
216
+ });
217
+ }
218
+ if (indicesSet.has('functions')) {
219
+ filesCategory.items.push({
220
+ type: 'doc',
221
+ label: 'Functions',
222
+ id: `${this.workspace.sidebarBaseId}indices/files/functions`,
223
+ });
224
+ }
225
+ if (indicesSet.has('variables')) {
226
+ filesCategory.items.push({
227
+ type: 'doc',
228
+ label: 'Variables',
229
+ id: `${this.workspace.sidebarBaseId}indices/files/variables`,
230
+ });
231
+ }
232
+ if (indicesSet.has('typedefs')) {
233
+ filesCategory.items.push({
234
+ type: 'doc',
235
+ label: 'Typedefs',
236
+ id: `${this.workspace.sidebarBaseId}indices/files/typedefs`,
237
+ });
238
+ }
239
+ if (indicesSet.has('enums')) {
240
+ filesCategory.items.push({
241
+ type: 'doc',
242
+ label: 'Enums',
243
+ id: `${this.workspace.sidebarBaseId}indices/files/enums`,
244
+ });
245
+ }
246
+ if (indicesSet.has('enumvalues')) {
247
+ filesCategory.items.push({
248
+ type: 'doc',
249
+ label: 'Enum Values',
250
+ id: `${this.workspace.sidebarBaseId}indices/files/enumvalues`,
251
+ });
252
+ }
253
+ if (indicesSet.has('defines')) {
254
+ filesCategory.items.push({
255
+ type: 'doc',
256
+ label: 'Macro Definitions',
257
+ id: `${this.workspace.sidebarBaseId}indices/files/defines`,
258
+ });
259
+ }
260
+ sidebarCategory.items.push(filesCategory);
261
+ }
262
+ createFolderSidebarItemRecursively(folder) {
263
+ if (folder.sidebarLabel === undefined || folder.sidebarId == undefined) {
264
+ return undefined;
265
+ }
266
+ const categoryItem = {
267
+ type: 'category',
268
+ label: folder.sidebarLabel,
269
+ link: {
270
+ type: 'doc',
271
+ id: `${this.workspace.sidebarBaseId}${folder.sidebarId}`,
272
+ },
273
+ className: 'doxyEllipsis',
274
+ collapsed: true,
275
+ items: [],
276
+ };
277
+ for (const fileOrFolder of folder.children) {
278
+ if (fileOrFolder instanceof Folder) {
279
+ const item = this.createFolderSidebarItemRecursively(fileOrFolder);
280
+ if (item !== undefined) {
281
+ categoryItem.items.push(item);
282
+ }
283
+ }
284
+ }
285
+ for (const fileOrFolder of folder.children) {
286
+ if (fileOrFolder instanceof File) {
287
+ const item = this.createFileSidebarItem(fileOrFolder);
288
+ if (item !== undefined) {
289
+ categoryItem.items.push(item);
290
+ }
291
+ }
292
+ }
293
+ return categoryItem;
294
+ }
295
+ createFileSidebarItem(file) {
296
+ if (file.sidebarLabel === undefined || file.sidebarId === undefined) {
297
+ return undefined;
298
+ }
299
+ const docItem = {
300
+ type: 'doc',
301
+ label: file.sidebarLabel,
302
+ className: 'doxyEllipsis',
303
+ id: `${this.workspace.sidebarBaseId}${file.sidebarId}`,
304
+ };
305
+ return docItem;
306
+ }
307
+ // --------------------------------------------------------------------------
308
+ createMenuItems() {
309
+ const menuItem = {
310
+ label: 'Files',
311
+ to: `${this.workspace.menuBaseUrl}files/`,
312
+ };
313
+ return [menuItem];
314
+ }
315
+ // --------------------------------------------------------------------------
316
+ async generateIndexDotMdFile() {
317
+ if (this.topLevelFolders.length === 0 && this.topLevelFiles.length === 0) {
318
+ return;
319
+ }
320
+ const filePath = `${this.workspace.outputFolderPath}indices/files/index.md`;
321
+ const permalink = 'files';
322
+ const frontMatter = {
323
+ title: 'Files & Folders',
324
+ slug: `${this.workspace.slugBaseUrl}${permalink}`,
325
+ // description: '...', // TODO
326
+ custom_edit_url: null,
327
+ keywords: ['doxygen', 'files', 'folders', 'reference'],
328
+ };
329
+ const contentLines = [];
330
+ for (const folder of this.topLevelFolders) {
331
+ contentLines.push(...this.generateIndexMdFileRecursively(folder, 0));
332
+ }
333
+ for (const file of this.topLevelFiles) {
334
+ contentLines.push(...this.generateFileIndexMd(file, 0));
335
+ }
336
+ if (contentLines.length === 0) {
337
+ return;
338
+ }
339
+ const lines = [];
340
+ lines.push('The files & folders that contributed content to this site are:');
341
+ lines.push(...this.workspace.renderTreeTableToHtmlLines({ contentLines }));
342
+ if (this.workspace.options.verbose) {
343
+ console.log(`Writing files index file ${filePath}...`);
344
+ }
345
+ await this.workspace.writeOutputMdFile({
346
+ filePath,
347
+ frontMatter,
348
+ bodyLines: lines,
349
+ });
350
+ }
351
+ generateIndexMdFileRecursively(folder, depth) {
352
+ // console.log(util.inspect(folder, { compact: false, depth: 999 }))
353
+ const lines = [];
354
+ const label = this.workspace.renderString(folder.compoundName, 'html');
355
+ const permalink = this.workspace.getPagePermalink(folder.id);
356
+ if (permalink === undefined || permalink.length === 0) {
357
+ // console.log(namespace)
358
+ return [];
359
+ }
360
+ let description = '';
361
+ if (folder.briefDescriptionHtmlString !== undefined &&
362
+ folder.briefDescriptionHtmlString.length > 0) {
363
+ description = folder.briefDescriptionHtmlString.replace(/[.]$/, '');
364
+ }
365
+ lines.push('');
366
+ lines.push(...this.workspace.renderTreeTableRowToHtmlLines({
367
+ itemIconClass: 'doxyIconFolder',
368
+ itemLabel: label,
369
+ itemLink: permalink,
370
+ depth,
371
+ description,
372
+ }));
373
+ if (folder.children.length > 0) {
374
+ for (const childFileOrFolder of folder.children) {
375
+ if (childFileOrFolder instanceof Folder) {
376
+ lines.push(...this.generateIndexMdFileRecursively(childFileOrFolder, depth + 1));
377
+ }
378
+ }
379
+ for (const childFileOrFolder of folder.children) {
380
+ if (childFileOrFolder instanceof File) {
381
+ lines.push(...this.generateFileIndexMd(childFileOrFolder, depth + 1));
382
+ }
383
+ }
384
+ }
385
+ return lines;
386
+ }
387
+ generateFileIndexMd(file, depth) {
388
+ // console.log(util.inspect(file, { compact: false, depth: 999 }))
389
+ const lines = [];
390
+ const label = this.workspace.renderString(file.compoundName, 'html');
391
+ const permalink = this.workspace.getPagePermalink(file.id, true);
392
+ if (permalink === undefined || permalink.length === 0) {
393
+ return [];
394
+ }
395
+ let description = '';
396
+ if (file.briefDescriptionHtmlString !== undefined &&
397
+ file.briefDescriptionHtmlString.length > 0) {
398
+ description = file.briefDescriptionHtmlString.replace(/[.]$/, '');
399
+ }
400
+ lines.push('');
401
+ lines.push(...this.workspace.renderTreeTableRowToHtmlLines({
402
+ itemIconClass: 'doxyIconFile',
403
+ itemLabel: label,
404
+ itemLink: permalink,
405
+ depth,
406
+ description,
407
+ }));
408
+ return lines;
409
+ }
410
+ isVisibleInSidebar() {
411
+ for (const [, compound] of this.collectionCompoundsById) {
412
+ if (compound instanceof File && compound.hasAnyContent()) {
413
+ return true;
414
+ }
415
+ else if (compound instanceof Folder && compound.children.length > 0) {
416
+ return true;
417
+ }
418
+ }
419
+ console.log('none');
420
+ return false;
421
+ }
422
+ async generatePerInitialsIndexMdFiles() {
423
+ if (this.topLevelFiles.length === 0) {
424
+ return;
425
+ }
426
+ const allUnorderedEntriesMap = new Map();
427
+ for (const [, compound] of this.collectionCompoundsById) {
428
+ if (!(compound instanceof File)) {
429
+ continue;
430
+ }
431
+ if (compound.innerCompounds !== undefined) {
432
+ // console.log(
433
+ // compound.indexName,
434
+ // Array.from(compound.innerCompounds.keys())
435
+ // )
436
+ const classCompoundDef = compound.innerCompounds.get('innerClasses');
437
+ if (classCompoundDef?.innerClasses !== undefined) {
438
+ for (const innerClass of classCompoundDef.innerClasses) {
439
+ // console.log(innerClass.refid)
440
+ const compoundClass = this.workspace.viewModel.compoundsById.get(innerClass.refid);
441
+ if (compoundClass instanceof Class) {
442
+ const classEntry = new FileTreeEntry(compoundClass, compound);
443
+ allUnorderedEntriesMap.set(classEntry.id, classEntry);
444
+ }
445
+ }
446
+ }
447
+ const namespaceCompoundDef = compound.innerCompounds.get('innerNamespaces');
448
+ if (namespaceCompoundDef?.innerNamespaces !== undefined) {
449
+ for (const innerNamespace of namespaceCompoundDef.innerNamespaces) {
450
+ // console.log(innerNamespace.refid)
451
+ const compoundNamespace = this.workspace.viewModel.compoundsById.get(innerNamespace.refid);
452
+ if (compoundNamespace instanceof Namespace) {
453
+ const namespaceEntry = new FileTreeEntry(compoundNamespace, compound);
454
+ allUnorderedEntriesMap.set(namespaceEntry.id, namespaceEntry);
455
+ }
456
+ }
457
+ }
458
+ }
459
+ for (const section of compound.sections) {
460
+ for (const member of section.definitionMembers) {
461
+ const memberEntry = new FileTreeEntry(member, compound);
462
+ allUnorderedEntriesMap.set(memberEntry.id, memberEntry);
463
+ if (member.enumValues !== undefined) {
464
+ for (const enumValue of member.enumValues) {
465
+ const enumValueEntry = new FileTreeEntry(enumValue, compound);
466
+ allUnorderedEntriesMap.set(enumValueEntry.id, enumValueEntry);
467
+ }
468
+ }
469
+ }
470
+ }
471
+ }
472
+ // ------------------------------------------------------------------------
473
+ await this.generateIndexFile({
474
+ group: 'files',
475
+ fileKind: 'all',
476
+ title: 'Files Definitions Index',
477
+ description: 'The definitions part of the files are:',
478
+ map: allUnorderedEntriesMap,
479
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
480
+ filter: (kind) => true,
481
+ });
482
+ await this.generateIndexFile({
483
+ group: 'files',
484
+ fileKind: 'classes',
485
+ title: 'Files Classes Index',
486
+ description: 'The classes, structs, unions defined in the project are:',
487
+ map: allUnorderedEntriesMap,
488
+ filter: (kind) => kind === 'class' || kind === 'struct' || kind === 'union',
489
+ });
490
+ await this.generateIndexFile({
491
+ group: 'files',
492
+ fileKind: 'namespaces',
493
+ title: 'Files Namespaces Index',
494
+ description: 'The namespaces defined in the project are:',
495
+ map: allUnorderedEntriesMap,
496
+ filter: (kind) => kind === 'namespace',
497
+ });
498
+ await this.generateIndexFile({
499
+ group: 'files',
500
+ fileKind: 'functions',
501
+ title: 'Files Functions Index',
502
+ description: 'The functions defined in the project are:',
503
+ map: allUnorderedEntriesMap,
504
+ filter: (kind) => kind === 'function',
505
+ });
506
+ await this.generateIndexFile({
507
+ group: 'files',
508
+ fileKind: 'variables',
509
+ title: 'Files Variables Index',
510
+ description: 'The variables defined in the project are:',
511
+ map: allUnorderedEntriesMap,
512
+ filter: (kind) => kind === 'variable',
513
+ });
514
+ await this.generateIndexFile({
515
+ group: 'files',
516
+ fileKind: 'typedefs',
517
+ title: 'Files Type Definitions Index',
518
+ description: 'The typedefs defined in the project are:',
519
+ map: allUnorderedEntriesMap,
520
+ filter: (kind) => kind === 'typedef',
521
+ });
522
+ await this.generateIndexFile({
523
+ group: 'files',
524
+ fileKind: 'enums',
525
+ title: 'Files Enums Index',
526
+ description: 'The enums defined in the project are:',
527
+ map: allUnorderedEntriesMap,
528
+ filter: (kind) => kind === 'enum',
529
+ });
530
+ await this.generateIndexFile({
531
+ group: 'files',
532
+ fileKind: 'enumvalues',
533
+ title: 'Files Enum Values Index',
534
+ description: 'The enum values defined in the project are:',
535
+ map: allUnorderedEntriesMap,
536
+ filter: (kind) => kind === 'enumvalue',
537
+ });
538
+ await this.generateIndexFile({
539
+ group: 'files',
540
+ fileKind: 'defines',
541
+ title: 'Files Macro Definitions Index',
542
+ description: 'The macros defined in the project are:',
543
+ map: allUnorderedEntriesMap,
544
+ filter: (kind) => kind === 'define',
545
+ });
546
+ }
547
+ }
548
+ // ----------------------------------------------------------------------------
549
+ export class Folder extends CompoundBase {
550
+ childrenFileIds = [];
551
+ childrenFolderIds = [];
552
+ relativePath = '';
553
+ // --------------------------------------------------------------------------
554
+ constructor(collection, compoundDef) {
555
+ super(collection, compoundDef);
556
+ // console.log('folder:', util.inspect(compoundDef))
557
+ // console.log('folder:', compoundDef.compoundName)
558
+ if (Array.isArray(compoundDef.innerDirs)) {
559
+ for (const ref of compoundDef.innerDirs) {
560
+ // console.log(
561
+ // 'component', compoundDef.id, 'has child folder', ref.refid
562
+ // )
563
+ this.childrenIds.push(ref.refid);
564
+ this.childrenFolderIds.push(ref.refid);
565
+ }
566
+ }
567
+ if (Array.isArray(compoundDef.innerFiles)) {
568
+ for (const ref of compoundDef.innerFiles) {
569
+ // console.log('component', compoundDef.id, 'has child file', ref.refid)
570
+ this.childrenIds.push(ref.refid);
571
+ this.childrenFileIds.push(ref.refid);
572
+ }
573
+ }
574
+ const { compoundName } = compoundDef;
575
+ this.sidebarLabel = compoundName;
576
+ this.indexName = compoundName;
577
+ this.treeEntryName = compoundName;
578
+ this.pageTitle = `\`${this.sidebarLabel}\` Folder`;
579
+ this.createSections();
580
+ }
581
+ hasChildren() {
582
+ for (const child of this.children) {
583
+ if (child instanceof File) {
584
+ return true;
585
+ }
586
+ else if (child instanceof Folder && child.hasChildren()) {
587
+ return true;
588
+ }
589
+ }
590
+ return false;
591
+ }
592
+ hasAnyContent() {
593
+ // console.log('checking', this.compoundName)
594
+ if (this.hasChildren()) {
595
+ // console.log('has content children', this)
596
+ return true;
597
+ }
598
+ // if (!super.hasAnyContent()) {
599
+ // console.log('has no content', this)
600
+ // }
601
+ return super.hasAnyContent();
602
+ }
603
+ // --------------------------------------------------------------------------
604
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
605
+ renderToLines(frontMatter) {
606
+ const lines = [];
607
+ const descriptionTodo = `@dir ${this.collection.workspace.renderString(this.relativePath, 'html')}`;
608
+ // The Description header is always shown.
609
+ const morePermalink = '#details';
610
+ lines.push(this.renderBriefDescriptionToHtmlString({
611
+ briefDescriptionHtmlString: this.briefDescriptionHtmlString,
612
+ todo: descriptionTodo,
613
+ morePermalink,
614
+ }));
615
+ lines.push(...this.renderInnerIndicesToLines({
616
+ suffixes: ['Dirs', 'Files'],
617
+ }));
618
+ lines.push(...this.renderSectionIndicesToLines());
619
+ lines.push(...this.renderDetailedDescriptionToHtmlLines({
620
+ briefDescriptionHtmlString: this.briefDescriptionHtmlString,
621
+ detailedDescriptionHtmlLines: this.detailedDescriptionHtmlLines,
622
+ todo: descriptionTodo,
623
+ showHeader: true,
624
+ showBrief: !this.hasSect1InDescription,
625
+ }));
626
+ lines.push(...this.renderSectionsToLines());
627
+ return lines;
628
+ }
629
+ initializeLate() {
630
+ super.initializeLate();
631
+ // console.log(this)
632
+ if (!this.hasAnyContent()) {
633
+ if (this.collection.workspace.options.debug) {
634
+ console.log(this.kind, this.compoundName, 'has no content, not shown');
635
+ }
636
+ this.sidebarId = undefined;
637
+ this.sidebarLabel = undefined;
638
+ this.relativePermalink = undefined;
639
+ }
640
+ }
641
+ }
642
+ // ----------------------------------------------------------------------------
643
+ export class File extends CompoundBase {
644
+ relativePath = '';
645
+ listingLineNumbers = new Set();
646
+ // Shortcut, use data model objects.
647
+ programListing;
648
+ constructor(collection, compoundDef) {
649
+ super(collection, compoundDef);
650
+ // console.log('file:', compoundDef.compoundName)
651
+ // The compoundName is the actual file name, without path.
652
+ const { compoundName } = compoundDef;
653
+ assert(compoundName.length > 0);
654
+ this.sidebarLabel = compoundName;
655
+ this.indexName = compoundName;
656
+ this.treeEntryName = compoundName;
657
+ this.pageTitle = `\`${this.sidebarLabel}\` File`;
658
+ this.createSections();
659
+ }
660
+ initializeLate() {
661
+ super.initializeLate();
662
+ const compoundDef = this._private._compoundDef;
663
+ assert(compoundDef !== undefined);
664
+ const { programListing } = compoundDef;
665
+ this.programListing = programListing;
666
+ if (this.collection.workspace.options.renderProgramListing) {
667
+ // Keep track of line number, since not all lines referred exist and
668
+ // this might result in broken links.
669
+ if (this.programListing?.codelines !== undefined) {
670
+ for (const codeline of this.programListing.codelines) {
671
+ if (codeline.lineno !== undefined) {
672
+ this.listingLineNumbers.add(codeline.lineno.valueOf());
673
+ }
674
+ }
675
+ }
676
+ }
677
+ // console.log(this)
678
+ if (!this.hasAnyContent()) {
679
+ if (this.collection.workspace.options.debug) {
680
+ console.log(this.kind, this.compoundName, 'has no content, not shown');
681
+ }
682
+ this.sidebarId = undefined;
683
+ this.sidebarLabel = undefined;
684
+ this.relativePermalink = undefined;
685
+ }
686
+ }
687
+ hasAnyContent() {
688
+ // console.log('checking', this.compoundName)
689
+ if (this.childrenIds.length > 0) {
690
+ // console.log('has content childrenIds', this)
691
+ return true;
692
+ }
693
+ if (this.children.length > 0) {
694
+ // console.log('has content children.length', this)
695
+ return true;
696
+ }
697
+ if (this.innerCompounds !== undefined) {
698
+ // console.log('has content innerCompounds', this)
699
+ return true;
700
+ }
701
+ if (this.includes !== undefined) {
702
+ // console.log('has content includes', this)
703
+ return true;
704
+ }
705
+ // if (this.collection.workspace.options.renderProgramListing) {
706
+ // if (this.programListing !== undefined) {
707
+ // return true
708
+ // }
709
+ // }
710
+ return super.hasAnyContent();
711
+ }
712
+ // --------------------------------------------------------------------------
713
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
714
+ renderToLines(frontMatter) {
715
+ const lines = [];
716
+ const descriptionTodo = `@file ${this.collection.workspace.renderString(this.relativePath, 'html')}`;
717
+ // The Description header is always shown.
718
+ const morePermalink = '#details';
719
+ lines.push(this.renderBriefDescriptionToHtmlString({
720
+ briefDescriptionHtmlString: this.briefDescriptionHtmlString,
721
+ todo: descriptionTodo,
722
+ morePermalink,
723
+ }));
724
+ lines.push(...this.renderIncludesIndexToLines());
725
+ lines.push(...this.renderInnerIndicesToLines({
726
+ suffixes: ['Namespaces', 'Classes'],
727
+ }));
728
+ lines.push(...this.renderSectionIndicesToLines());
729
+ lines.push(...this.renderDetailedDescriptionToHtmlLines({
730
+ briefDescriptionHtmlString: this.briefDescriptionHtmlString,
731
+ detailedDescriptionHtmlLines: this.detailedDescriptionHtmlLines,
732
+ todo: descriptionTodo,
733
+ showHeader: true,
734
+ showBrief: !this.hasSect1InDescription,
735
+ }));
736
+ lines.push(...this.renderSectionsToLines());
737
+ if (this.programListing !== undefined &&
738
+ this.collection.workspace.options.renderProgramListing) {
739
+ lines.push('');
740
+ lines.push('## File Listing');
741
+ lines.push('');
742
+ lines.push('The file content with the documentation metadata removed is:');
743
+ lines.push(...this.collection.workspace.renderElementToLines(this.programListing, 'html'));
744
+ }
745
+ return lines;
746
+ }
747
+ }
748
+ // ----------------------------------------------------------------------------
749
+ //# sourceMappingURL=files-and-folders-vm.js.map