@redpanda-data/docs-extensions-and-macros 4.8.0 → 4.9.0

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 (30) hide show
  1. package/bin/doc-tools.js +236 -54
  2. package/package.json +1 -1
  3. package/tools/property-extractor/Makefile +68 -50
  4. package/tools/property-extractor/cloud_config.py +594 -0
  5. package/tools/property-extractor/compare-properties.js +378 -0
  6. package/tools/property-extractor/generate-handlebars-docs.js +444 -0
  7. package/tools/property-extractor/helpers/and.js +10 -0
  8. package/tools/property-extractor/helpers/eq.js +9 -0
  9. package/tools/property-extractor/helpers/formatPropertyValue.js +128 -0
  10. package/tools/property-extractor/helpers/formatUnits.js +26 -0
  11. package/tools/property-extractor/helpers/index.js +13 -0
  12. package/tools/property-extractor/helpers/join.js +18 -0
  13. package/tools/property-extractor/helpers/ne.js +9 -0
  14. package/tools/property-extractor/helpers/not.js +8 -0
  15. package/tools/property-extractor/helpers/or.js +10 -0
  16. package/tools/property-extractor/helpers/renderPropertyExample.js +42 -0
  17. package/tools/property-extractor/package-lock.json +77 -0
  18. package/tools/property-extractor/package.json +6 -0
  19. package/tools/property-extractor/parser.py +27 -1
  20. package/tools/property-extractor/property_extractor.py +1428 -49
  21. package/tools/property-extractor/requirements.txt +2 -0
  22. package/tools/property-extractor/templates/deprecated-properties.hbs +25 -0
  23. package/tools/property-extractor/templates/deprecated-property.hbs +7 -0
  24. package/tools/property-extractor/templates/property-cloud.hbs +105 -0
  25. package/tools/property-extractor/templates/property-page.hbs +22 -0
  26. package/tools/property-extractor/templates/property.hbs +85 -0
  27. package/tools/property-extractor/templates/topic-property-cloud.hbs +97 -0
  28. package/tools/property-extractor/templates/topic-property.hbs +73 -0
  29. package/tools/property-extractor/transformers.py +178 -6
  30. package/tools/property-extractor/json-to-asciidoc/generate_docs.py +0 -491
@@ -0,0 +1,42 @@
1
+ const handlebars = require('handlebars');
2
+
3
+ /**
4
+ * Renders an example for a property based on its format
5
+ * @param {Object} property - The property object containing example data
6
+ * @returns {handlebars.SafeString} Formatted example block
7
+ */
8
+ module.exports = function renderPropertyExample(property) {
9
+ if (!property.example) {
10
+ return new handlebars.SafeString('');
11
+ }
12
+
13
+ let exampleContent = '';
14
+
15
+ // Handle different example formats
16
+ if (typeof property.example === 'string') {
17
+ // Check if it's already a complete AsciiDoc example
18
+ if (property.example.includes('.Example') || property.example.includes('[,yaml]')) {
19
+ exampleContent = property.example;
20
+ } else {
21
+ // Simple string example - wrap it
22
+ exampleContent = `.Example\n[,yaml]\n----\n${property.name}: ${property.example}\n----`;
23
+ }
24
+ } else if (Array.isArray(property.example)) {
25
+ // Multiline array example
26
+ exampleContent = property.example.join('\n');
27
+ } else if (typeof property.example === 'object' && property.example.title) {
28
+ // Structured example with title and content
29
+ exampleContent = `.${property.example.title}\n`;
30
+ if (property.example.description) {
31
+ exampleContent += `${property.example.description}\n\n`;
32
+ }
33
+ if (property.example.config) {
34
+ exampleContent += `[,yaml]\n----\n${JSON.stringify(property.example.config, null, 2)}\n----`;
35
+ }
36
+ } else {
37
+ // Fallback: JSON stringify the example
38
+ exampleContent = `.Example\n[,yaml]\n----\n${property.name}: ${JSON.stringify(property.example, null, 2)}\n----`;
39
+ }
40
+
41
+ return new handlebars.SafeString('\n' + exampleContent + '\n');
42
+ };
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "property-extractor",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "dependencies": {
9
+ "handlebars": "^4.7.8"
10
+ }
11
+ },
12
+ "node_modules/handlebars": {
13
+ "version": "4.7.8",
14
+ "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz",
15
+ "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==",
16
+ "license": "MIT",
17
+ "dependencies": {
18
+ "minimist": "^1.2.5",
19
+ "neo-async": "^2.6.2",
20
+ "source-map": "^0.6.1",
21
+ "wordwrap": "^1.0.0"
22
+ },
23
+ "bin": {
24
+ "handlebars": "bin/handlebars"
25
+ },
26
+ "engines": {
27
+ "node": ">=0.4.7"
28
+ },
29
+ "optionalDependencies": {
30
+ "uglify-js": "^3.1.4"
31
+ }
32
+ },
33
+ "node_modules/minimist": {
34
+ "version": "1.2.8",
35
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
36
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
37
+ "license": "MIT",
38
+ "funding": {
39
+ "url": "https://github.com/sponsors/ljharb"
40
+ }
41
+ },
42
+ "node_modules/neo-async": {
43
+ "version": "2.6.2",
44
+ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
45
+ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
46
+ "license": "MIT"
47
+ },
48
+ "node_modules/source-map": {
49
+ "version": "0.6.1",
50
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
51
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
52
+ "license": "BSD-3-Clause",
53
+ "engines": {
54
+ "node": ">=0.10.0"
55
+ }
56
+ },
57
+ "node_modules/uglify-js": {
58
+ "version": "3.19.3",
59
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz",
60
+ "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==",
61
+ "license": "BSD-2-Clause",
62
+ "optional": true,
63
+ "bin": {
64
+ "uglifyjs": "bin/uglifyjs"
65
+ },
66
+ "engines": {
67
+ "node": ">=0.8.0"
68
+ }
69
+ },
70
+ "node_modules/wordwrap": {
71
+ "version": "1.0.0",
72
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
73
+ "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==",
74
+ "license": "MIT"
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "private": true,
3
+ "dependencies": {
4
+ "handlebars": "^4.7.8"
5
+ }
6
+ }
@@ -14,11 +14,37 @@ HEADER_QUERY = """
14
14
  ) @declaration
15
15
  """
16
16
 
17
+ # Tree-sitter query for extracting C++ property constructor arguments and enterprise values
18
+ #
19
+ # - Enhanced to capture all expression types including:
20
+ # * call_expression: Handles function calls like model::kafka_audit_logging_topic()
21
+ # * template_instantiation: Handles template syntax like std::vector<ss::sstring>{...}
22
+ # * concatenated_string: Handles C++ string concatenation with +
23
+ # * qualified_identifier: Handles namespaced identifiers like model::partition_autobalancing_mode::continuous
24
+ # * (_) @argument: Fallback to capture any other expression types
25
+ #
26
+ # This ensures enterprise values are captured in their complete form for proper
27
+ # processing by the process_enterprise_value function.
17
28
  SOURCE_QUERY = """
18
29
  (field_initializer_list
19
30
  (field_initializer
20
31
  (field_identifier) @field
21
- (argument_list (_) @argument)? @arguments
32
+ (argument_list
33
+ [
34
+ (call_expression) @argument
35
+ (initializer_list) @argument
36
+ (template_instantiation) @argument
37
+ (concatenated_string) @argument
38
+ (string_literal) @argument
39
+ (raw_string_literal) @argument
40
+ (identifier) @argument
41
+ (qualified_identifier) @argument
42
+ (number_literal) @argument
43
+ (true) @argument
44
+ (false) @argument
45
+ (_) @argument
46
+ ]
47
+ )? @arguments
22
48
  ) @field
23
49
  )
24
50
  """