@h2nguyen/arc42-node-mcp-server 2.0.0 → 2.1.1
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.
- package/CHANGELOG.md +72 -0
- package/README.md +83 -6
- package/dist/templates/arc42-reference.d.ts +25 -7
- package/dist/templates/arc42-reference.d.ts.map +1 -1
- package/dist/templates/arc42-reference.js +96 -47
- package/dist/templates/arc42-reference.js.map +1 -1
- package/dist/templates/formats/asciidoc/index.d.ts +178 -0
- package/dist/templates/formats/asciidoc/index.d.ts.map +1 -0
- package/dist/templates/formats/asciidoc/index.js +225 -0
- package/dist/templates/formats/asciidoc/index.js.map +1 -0
- package/dist/templates/formats/index.d.ts +108 -0
- package/dist/templates/formats/index.d.ts.map +1 -0
- package/dist/templates/formats/index.js +149 -0
- package/dist/templates/formats/index.js.map +1 -0
- package/dist/templates/formats/markdown/index.d.ts +172 -0
- package/dist/templates/formats/markdown/index.d.ts.map +1 -0
- package/dist/templates/formats/markdown/index.js +211 -0
- package/dist/templates/formats/markdown/index.js.map +1 -0
- package/dist/templates/formats/output-format-factory.d.ts +125 -0
- package/dist/templates/formats/output-format-factory.d.ts.map +1 -0
- package/dist/templates/formats/output-format-factory.js +166 -0
- package/dist/templates/formats/output-format-factory.js.map +1 -0
- package/dist/templates/formats/output-format-registry.d.ts +114 -0
- package/dist/templates/formats/output-format-registry.d.ts.map +1 -0
- package/dist/templates/formats/output-format-registry.js +147 -0
- package/dist/templates/formats/output-format-registry.js.map +1 -0
- package/dist/templates/formats/output-format-strategy.d.ts +195 -0
- package/dist/templates/formats/output-format-strategy.d.ts.map +1 -0
- package/dist/templates/formats/output-format-strategy.js +69 -0
- package/dist/templates/formats/output-format-strategy.js.map +1 -0
- package/dist/templates/index.d.ts +9 -8
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +21 -10
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/locales/cz/index.d.ts +25 -3
- package/dist/templates/locales/cz/index.d.ts.map +1 -1
- package/dist/templates/locales/cz/index.js +34 -18
- package/dist/templates/locales/cz/index.js.map +1 -1
- package/dist/templates/locales/cz/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/cz/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/cz/templates-asciidoc.js +764 -0
- package/dist/templates/locales/cz/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/cz/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/cz/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/cz/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/cz/templates-markdown.js.map +1 -0
- package/dist/templates/locales/de/index.d.ts +14 -4
- package/dist/templates/locales/de/index.d.ts.map +1 -1
- package/dist/templates/locales/de/index.js +22 -25
- package/dist/templates/locales/de/index.js.map +1 -1
- package/dist/templates/locales/de/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/de/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/de/templates-asciidoc.js +814 -0
- package/dist/templates/locales/de/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/de/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/de/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/de/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/de/templates-markdown.js.map +1 -0
- package/dist/templates/locales/en/index.d.ts +14 -4
- package/dist/templates/locales/en/index.d.ts.map +1 -1
- package/dist/templates/locales/en/index.js +22 -25
- package/dist/templates/locales/en/index.js.map +1 -1
- package/dist/templates/locales/en/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/en/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/en/templates-asciidoc.js +764 -0
- package/dist/templates/locales/en/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/en/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/en/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/en/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/en/templates-markdown.js.map +1 -0
- package/dist/templates/locales/es/index.d.ts +15 -10
- package/dist/templates/locales/es/index.d.ts.map +1 -1
- package/dist/templates/locales/es/index.js +23 -31
- package/dist/templates/locales/es/index.js.map +1 -1
- package/dist/templates/locales/es/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/es/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/es/templates-asciidoc.js +764 -0
- package/dist/templates/locales/es/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/es/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/es/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/es/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/es/templates-markdown.js.map +1 -0
- package/dist/templates/locales/fr/index.d.ts +14 -9
- package/dist/templates/locales/fr/index.d.ts.map +1 -1
- package/dist/templates/locales/fr/index.js +22 -30
- package/dist/templates/locales/fr/index.js.map +1 -1
- package/dist/templates/locales/fr/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/fr/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/fr/templates-asciidoc.js +764 -0
- package/dist/templates/locales/fr/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/fr/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/fr/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/fr/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/fr/templates-markdown.js.map +1 -0
- package/dist/templates/locales/it/index.d.ts +14 -9
- package/dist/templates/locales/it/index.d.ts.map +1 -1
- package/dist/templates/locales/it/index.js +22 -30
- package/dist/templates/locales/it/index.js.map +1 -1
- package/dist/templates/locales/it/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/it/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/it/templates-asciidoc.js +764 -0
- package/dist/templates/locales/it/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/it/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/it/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/it/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/it/templates-markdown.js.map +1 -0
- package/dist/templates/locales/language-strategy-factory.d.ts +120 -0
- package/dist/templates/locales/language-strategy-factory.d.ts.map +1 -0
- package/dist/templates/locales/language-strategy-factory.js +127 -0
- package/dist/templates/locales/language-strategy-factory.js.map +1 -0
- package/dist/templates/locales/language-strategy.d.ts +16 -12
- package/dist/templates/locales/language-strategy.d.ts.map +1 -1
- package/dist/templates/locales/language-strategy.js.map +1 -1
- package/dist/templates/locales/nl/index.d.ts +14 -9
- package/dist/templates/locales/nl/index.d.ts.map +1 -1
- package/dist/templates/locales/nl/index.js +22 -30
- package/dist/templates/locales/nl/index.js.map +1 -1
- package/dist/templates/locales/nl/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/nl/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/nl/templates-asciidoc.js +764 -0
- package/dist/templates/locales/nl/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/nl/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/nl/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/nl/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/nl/templates-markdown.js.map +1 -0
- package/dist/templates/locales/pt/index.d.ts +14 -9
- package/dist/templates/locales/pt/index.d.ts.map +1 -1
- package/dist/templates/locales/pt/index.js +22 -30
- package/dist/templates/locales/pt/index.js.map +1 -1
- package/dist/templates/locales/pt/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/pt/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/pt/templates-asciidoc.js +764 -0
- package/dist/templates/locales/pt/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/pt/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/pt/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/pt/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/pt/templates-markdown.js.map +1 -0
- package/dist/templates/locales/ru/index.d.ts +19 -3
- package/dist/templates/locales/ru/index.d.ts.map +1 -1
- package/dist/templates/locales/ru/index.js +28 -24
- package/dist/templates/locales/ru/index.js.map +1 -1
- package/dist/templates/locales/ru/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/ru/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/ru/templates-asciidoc.js +996 -0
- package/dist/templates/locales/ru/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/ru/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/ru/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/ru/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/ru/templates-markdown.js.map +1 -0
- package/dist/templates/locales/template-provider.d.ts +22 -10
- package/dist/templates/locales/template-provider.d.ts.map +1 -1
- package/dist/templates/locales/template-provider.js +53 -14
- package/dist/templates/locales/template-provider.js.map +1 -1
- package/dist/templates/locales/ukr/index.d.ts +25 -3
- package/dist/templates/locales/ukr/index.d.ts.map +1 -1
- package/dist/templates/locales/ukr/index.js +34 -18
- package/dist/templates/locales/ukr/index.js.map +1 -1
- package/dist/templates/locales/ukr/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/ukr/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/ukr/templates-asciidoc.js +764 -0
- package/dist/templates/locales/ukr/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/ukr/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/ukr/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/ukr/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/ukr/templates-markdown.js.map +1 -0
- package/dist/templates/locales/zh/index.d.ts +25 -3
- package/dist/templates/locales/zh/index.d.ts.map +1 -1
- package/dist/templates/locales/zh/index.js +34 -18
- package/dist/templates/locales/zh/index.js.map +1 -1
- package/dist/templates/locales/zh/templates-asciidoc.d.ts +22 -0
- package/dist/templates/locales/zh/templates-asciidoc.d.ts.map +1 -0
- package/dist/templates/locales/zh/templates-asciidoc.js +764 -0
- package/dist/templates/locales/zh/templates-asciidoc.js.map +1 -0
- package/dist/templates/locales/zh/{templates.d.ts → templates-markdown.d.ts} +1 -1
- package/dist/templates/locales/zh/templates-markdown.d.ts.map +1 -0
- package/dist/templates/locales/zh/{templates.js → templates-markdown.js} +1 -1
- package/dist/templates/locales/zh/templates-markdown.js.map +1 -0
- package/dist/tools/arc42-init.d.ts +2 -1
- package/dist/tools/arc42-init.d.ts.map +1 -1
- package/dist/tools/arc42-init.js +154 -24
- package/dist/tools/arc42-init.js.map +1 -1
- package/dist/tools/arc42-status.d.ts.map +1 -1
- package/dist/tools/arc42-status.js +66 -10
- package/dist/tools/arc42-status.js.map +1 -1
- package/dist/tools/arc42-workflow-guide.d.ts +1 -0
- package/dist/tools/arc42-workflow-guide.d.ts.map +1 -1
- package/dist/tools/arc42-workflow-guide.js +16 -14
- package/dist/tools/arc42-workflow-guide.js.map +1 -1
- package/dist/tools/generate-template.d.ts +1 -0
- package/dist/tools/generate-template.d.ts.map +1 -1
- package/dist/tools/generate-template.js +16 -5
- package/dist/tools/generate-template.js.map +1 -1
- package/dist/tools/get-section.d.ts.map +1 -1
- package/dist/tools/get-section.js +28 -7
- package/dist/tools/get-section.js.map +1 -1
- package/dist/tools/update-section.d.ts +1 -1
- package/dist/tools/update-section.d.ts.map +1 -1
- package/dist/tools/update-section.js +71 -8
- package/dist/tools/update-section.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/templates/locales/cz/templates.d.ts.map +0 -1
- package/dist/templates/locales/cz/templates.js.map +0 -1
- package/dist/templates/locales/de/templates.d.ts.map +0 -1
- package/dist/templates/locales/de/templates.js.map +0 -1
- package/dist/templates/locales/en/templates.d.ts.map +0 -1
- package/dist/templates/locales/en/templates.js.map +0 -1
- package/dist/templates/locales/es/templates.d.ts.map +0 -1
- package/dist/templates/locales/es/templates.js.map +0 -1
- package/dist/templates/locales/fr/templates.d.ts.map +0 -1
- package/dist/templates/locales/fr/templates.js.map +0 -1
- package/dist/templates/locales/it/templates.d.ts.map +0 -1
- package/dist/templates/locales/it/templates.js.map +0 -1
- package/dist/templates/locales/nl/templates.d.ts.map +0 -1
- package/dist/templates/locales/nl/templates.js.map +0 -1
- package/dist/templates/locales/pt/templates.d.ts.map +0 -1
- package/dist/templates/locales/pt/templates.js.map +0 -1
- package/dist/templates/locales/ru/templates.d.ts.map +0 -1
- package/dist/templates/locales/ru/templates.js.map +0 -1
- package/dist/templates/locales/ukr/templates.d.ts.map +0 -1
- package/dist/templates/locales/ukr/templates.js.map +0 -1
- package/dist/templates/locales/zh/templates.d.ts.map +0 -1
- package/dist/templates/locales/zh/templates.js.map +0 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsciiDoc Format Strategy
|
|
3
|
+
*
|
|
4
|
+
* Implements the OutputFormatStrategy interface for AsciiDoc format.
|
|
5
|
+
* Generates valid AsciiDoc syntax compatible with Asciidoctor.
|
|
6
|
+
*
|
|
7
|
+
* @module templates/formats/asciidoc
|
|
8
|
+
*
|
|
9
|
+
* S.O.L.I.D Principles:
|
|
10
|
+
* - SRP (Single Responsibility Principle): Only handles AsciiDoc syntax generation
|
|
11
|
+
* - LSP (Liskov Substitution Principle): Can replace any OutputFormatStrategy
|
|
12
|
+
*
|
|
13
|
+
* Design Patterns:
|
|
14
|
+
* - Strategy Pattern: Interchangeable format implementation
|
|
15
|
+
*/
|
|
16
|
+
import type { OutputFormatStrategy, OutputFormatCode } from '../output-format-strategy.js';
|
|
17
|
+
/**
|
|
18
|
+
* AsciiDoc Format Strategy
|
|
19
|
+
*
|
|
20
|
+
* Generates content in AsciiDoc format compatible with Asciidoctor.
|
|
21
|
+
* This is the default format for new arc42 documentation projects.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const asciidoc = new AsciiDocFormatStrategy();
|
|
26
|
+
*
|
|
27
|
+
* asciidoc.formatHeading('Hello', 1); // '= Hello'
|
|
28
|
+
* asciidoc.formatBold('text'); // '*text*'
|
|
29
|
+
* asciidoc.formatCode('const x = 1;', 'typescript');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class AsciiDocFormatStrategy implements OutputFormatStrategy {
|
|
33
|
+
/**
|
|
34
|
+
* Format code identifier
|
|
35
|
+
*/
|
|
36
|
+
readonly code: OutputFormatCode;
|
|
37
|
+
/**
|
|
38
|
+
* Human-readable format name
|
|
39
|
+
*/
|
|
40
|
+
readonly name: string;
|
|
41
|
+
/**
|
|
42
|
+
* File extension for AsciiDoc files
|
|
43
|
+
*/
|
|
44
|
+
readonly fileExtension: string;
|
|
45
|
+
/**
|
|
46
|
+
* Format a heading at the specified level
|
|
47
|
+
*
|
|
48
|
+
* Uses = prefix notation (= Title, == Section, === Subsection).
|
|
49
|
+
*
|
|
50
|
+
* @param text - The heading text
|
|
51
|
+
* @param level - Heading level (1-6)
|
|
52
|
+
* @returns AsciiDoc heading (e.g., '== Heading')
|
|
53
|
+
*/
|
|
54
|
+
formatHeading(text: string, level: number): string;
|
|
55
|
+
/**
|
|
56
|
+
* Format text as bold
|
|
57
|
+
*
|
|
58
|
+
* @param text - The text to make bold
|
|
59
|
+
* @returns Bold text with * wrapper
|
|
60
|
+
*/
|
|
61
|
+
formatBold(text: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Format text as italic
|
|
64
|
+
*
|
|
65
|
+
* @param text - The text to make italic
|
|
66
|
+
* @returns Italic text with _ wrapper
|
|
67
|
+
*/
|
|
68
|
+
formatItalic(text: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Format a code block with optional language
|
|
71
|
+
*
|
|
72
|
+
* Uses [source,language] attribute with ---- delimiters.
|
|
73
|
+
*
|
|
74
|
+
* @param code - The code content
|
|
75
|
+
* @param language - Optional language identifier for syntax highlighting
|
|
76
|
+
* @returns AsciiDoc source block
|
|
77
|
+
*/
|
|
78
|
+
formatCode(code: string, language?: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Format inline code
|
|
81
|
+
*
|
|
82
|
+
* Uses backtick wrapper (same as Markdown for compatibility).
|
|
83
|
+
*
|
|
84
|
+
* @param text - The code text
|
|
85
|
+
* @returns Inline code with backtick wrapper
|
|
86
|
+
*/
|
|
87
|
+
formatInlineCode(text: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Format an unordered (bulleted) list
|
|
90
|
+
*
|
|
91
|
+
* Uses * prefix for each item.
|
|
92
|
+
*
|
|
93
|
+
* @param items - Array of list items
|
|
94
|
+
* @returns Formatted unordered list
|
|
95
|
+
*/
|
|
96
|
+
formatUnorderedList(items: string[]): string;
|
|
97
|
+
/**
|
|
98
|
+
* Format an ordered (numbered) list
|
|
99
|
+
*
|
|
100
|
+
* Uses . prefix for each item (AsciiDoc auto-numbers).
|
|
101
|
+
*
|
|
102
|
+
* @param items - Array of list items
|
|
103
|
+
* @returns Formatted ordered list
|
|
104
|
+
*/
|
|
105
|
+
formatOrderedList(items: string[]): string;
|
|
106
|
+
/**
|
|
107
|
+
* Format a hyperlink
|
|
108
|
+
*
|
|
109
|
+
* Uses link:url[text] syntax.
|
|
110
|
+
*
|
|
111
|
+
* @param text - Link display text
|
|
112
|
+
* @param url - Link URL
|
|
113
|
+
* @returns AsciiDoc link
|
|
114
|
+
*/
|
|
115
|
+
formatLink(text: string, url: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* Format an image
|
|
118
|
+
*
|
|
119
|
+
* Uses image::url[alt] syntax.
|
|
120
|
+
*
|
|
121
|
+
* @param alt - Alternative text for the image
|
|
122
|
+
* @param url - Image URL or path
|
|
123
|
+
* @returns AsciiDoc image macro
|
|
124
|
+
*/
|
|
125
|
+
formatImage(alt: string, url: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* Format a table
|
|
128
|
+
*
|
|
129
|
+
* Creates an AsciiDoc table with |=== delimiters.
|
|
130
|
+
*
|
|
131
|
+
* @param headers - Array of column headers
|
|
132
|
+
* @param rows - 2D array of row data
|
|
133
|
+
* @returns Formatted AsciiDoc table
|
|
134
|
+
*/
|
|
135
|
+
formatTable(headers: string[], rows: string[][]): string;
|
|
136
|
+
/**
|
|
137
|
+
* Format a blockquote
|
|
138
|
+
*
|
|
139
|
+
* Uses ____ block delimiters for quote blocks.
|
|
140
|
+
*
|
|
141
|
+
* @param text - The quote text (may contain newlines)
|
|
142
|
+
* @returns Formatted blockquote
|
|
143
|
+
*/
|
|
144
|
+
formatBlockquote(text: string): string;
|
|
145
|
+
/**
|
|
146
|
+
* Format a horizontal rule/divider
|
|
147
|
+
*
|
|
148
|
+
* @returns AsciiDoc thematic break
|
|
149
|
+
*/
|
|
150
|
+
formatHorizontalRule(): string;
|
|
151
|
+
/**
|
|
152
|
+
* Format an anchor/bookmark
|
|
153
|
+
*
|
|
154
|
+
* Uses [[id]] syntax for explicit anchors.
|
|
155
|
+
*
|
|
156
|
+
* @param id - The anchor identifier
|
|
157
|
+
* @returns AsciiDoc anchor
|
|
158
|
+
*/
|
|
159
|
+
formatAnchor(id: string): string;
|
|
160
|
+
/**
|
|
161
|
+
* Get the README filename for AsciiDoc
|
|
162
|
+
*
|
|
163
|
+
* @returns 'README.adoc'
|
|
164
|
+
*/
|
|
165
|
+
getReadmeFilename(): string;
|
|
166
|
+
/**
|
|
167
|
+
* Get the section filename with .adoc extension
|
|
168
|
+
*
|
|
169
|
+
* @param section - The section identifier
|
|
170
|
+
* @returns Section filename with .adoc extension
|
|
171
|
+
*/
|
|
172
|
+
getSectionFilename(section: string): string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Singleton instance of the AsciiDoc format strategy
|
|
176
|
+
*/
|
|
177
|
+
export declare const asciidocFormatStrategy: AsciiDocFormatStrategy;
|
|
178
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/formats/asciidoc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE3F;;;;;;;;;;;;;;GAcG;AACH,qBAAa,sBAAuB,YAAW,oBAAoB;IACjE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAc;IAE7C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAc;IAEnC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAW;IAEzC;;;;;;;;OAQG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAKlD;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIhC;;;;;OAKG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC;;;;;;;;OAQG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAKnD;;;;;;;OAOG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAItC;;;;;;;OAOG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAI5C;;;;;;;OAOG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAI1C;;;;;;;;OAQG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAI7C;;;;;;;;OAQG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAI7C;;;;;;;;OAQG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM;IA0BxD;;;;;;;OAOG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAItC;;;;OAIG;IACH,oBAAoB,IAAI,MAAM;IAI9B;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAIhC;;;;OAIG;IACH,iBAAiB,IAAI,MAAM;IAI3B;;;;;OAKG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAG5C;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,wBAA+B,CAAC"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsciiDoc Format Strategy
|
|
3
|
+
*
|
|
4
|
+
* Implements the OutputFormatStrategy interface for AsciiDoc format.
|
|
5
|
+
* Generates valid AsciiDoc syntax compatible with Asciidoctor.
|
|
6
|
+
*
|
|
7
|
+
* @module templates/formats/asciidoc
|
|
8
|
+
*
|
|
9
|
+
* S.O.L.I.D Principles:
|
|
10
|
+
* - SRP (Single Responsibility Principle): Only handles AsciiDoc syntax generation
|
|
11
|
+
* - LSP (Liskov Substitution Principle): Can replace any OutputFormatStrategy
|
|
12
|
+
*
|
|
13
|
+
* Design Patterns:
|
|
14
|
+
* - Strategy Pattern: Interchangeable format implementation
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* AsciiDoc Format Strategy
|
|
18
|
+
*
|
|
19
|
+
* Generates content in AsciiDoc format compatible with Asciidoctor.
|
|
20
|
+
* This is the default format for new arc42 documentation projects.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const asciidoc = new AsciiDocFormatStrategy();
|
|
25
|
+
*
|
|
26
|
+
* asciidoc.formatHeading('Hello', 1); // '= Hello'
|
|
27
|
+
* asciidoc.formatBold('text'); // '*text*'
|
|
28
|
+
* asciidoc.formatCode('const x = 1;', 'typescript');
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export class AsciiDocFormatStrategy {
|
|
32
|
+
/**
|
|
33
|
+
* Format code identifier
|
|
34
|
+
*/
|
|
35
|
+
code = 'asciidoc';
|
|
36
|
+
/**
|
|
37
|
+
* Human-readable format name
|
|
38
|
+
*/
|
|
39
|
+
name = 'AsciiDoc';
|
|
40
|
+
/**
|
|
41
|
+
* File extension for AsciiDoc files
|
|
42
|
+
*/
|
|
43
|
+
fileExtension = '.adoc';
|
|
44
|
+
/**
|
|
45
|
+
* Format a heading at the specified level
|
|
46
|
+
*
|
|
47
|
+
* Uses = prefix notation (= Title, == Section, === Subsection).
|
|
48
|
+
*
|
|
49
|
+
* @param text - The heading text
|
|
50
|
+
* @param level - Heading level (1-6)
|
|
51
|
+
* @returns AsciiDoc heading (e.g., '== Heading')
|
|
52
|
+
*/
|
|
53
|
+
formatHeading(text, level) {
|
|
54
|
+
const clampedLevel = Math.max(1, Math.min(6, level));
|
|
55
|
+
return '='.repeat(clampedLevel) + ' ' + text;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Format text as bold
|
|
59
|
+
*
|
|
60
|
+
* @param text - The text to make bold
|
|
61
|
+
* @returns Bold text with * wrapper
|
|
62
|
+
*/
|
|
63
|
+
formatBold(text) {
|
|
64
|
+
return `*${text}*`;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Format text as italic
|
|
68
|
+
*
|
|
69
|
+
* @param text - The text to make italic
|
|
70
|
+
* @returns Italic text with _ wrapper
|
|
71
|
+
*/
|
|
72
|
+
formatItalic(text) {
|
|
73
|
+
return `_${text}_`;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Format a code block with optional language
|
|
77
|
+
*
|
|
78
|
+
* Uses [source,language] attribute with ---- delimiters.
|
|
79
|
+
*
|
|
80
|
+
* @param code - The code content
|
|
81
|
+
* @param language - Optional language identifier for syntax highlighting
|
|
82
|
+
* @returns AsciiDoc source block
|
|
83
|
+
*/
|
|
84
|
+
formatCode(code, language) {
|
|
85
|
+
const sourceAttr = language ? `[source,${language}]` : '[source]';
|
|
86
|
+
return sourceAttr + '\n----\n' + code + '\n----';
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Format inline code
|
|
90
|
+
*
|
|
91
|
+
* Uses backtick wrapper (same as Markdown for compatibility).
|
|
92
|
+
*
|
|
93
|
+
* @param text - The code text
|
|
94
|
+
* @returns Inline code with backtick wrapper
|
|
95
|
+
*/
|
|
96
|
+
formatInlineCode(text) {
|
|
97
|
+
return '`' + text + '`';
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Format an unordered (bulleted) list
|
|
101
|
+
*
|
|
102
|
+
* Uses * prefix for each item.
|
|
103
|
+
*
|
|
104
|
+
* @param items - Array of list items
|
|
105
|
+
* @returns Formatted unordered list
|
|
106
|
+
*/
|
|
107
|
+
formatUnorderedList(items) {
|
|
108
|
+
return items.map(item => `* ${item}`).join('\n');
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Format an ordered (numbered) list
|
|
112
|
+
*
|
|
113
|
+
* Uses . prefix for each item (AsciiDoc auto-numbers).
|
|
114
|
+
*
|
|
115
|
+
* @param items - Array of list items
|
|
116
|
+
* @returns Formatted ordered list
|
|
117
|
+
*/
|
|
118
|
+
formatOrderedList(items) {
|
|
119
|
+
return items.map(item => `. ${item}`).join('\n');
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Format a hyperlink
|
|
123
|
+
*
|
|
124
|
+
* Uses link:url[text] syntax.
|
|
125
|
+
*
|
|
126
|
+
* @param text - Link display text
|
|
127
|
+
* @param url - Link URL
|
|
128
|
+
* @returns AsciiDoc link
|
|
129
|
+
*/
|
|
130
|
+
formatLink(text, url) {
|
|
131
|
+
return `link:${url}[${text}]`;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Format an image
|
|
135
|
+
*
|
|
136
|
+
* Uses image::url[alt] syntax.
|
|
137
|
+
*
|
|
138
|
+
* @param alt - Alternative text for the image
|
|
139
|
+
* @param url - Image URL or path
|
|
140
|
+
* @returns AsciiDoc image macro
|
|
141
|
+
*/
|
|
142
|
+
formatImage(alt, url) {
|
|
143
|
+
return `image::${url}[${alt}]`;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Format a table
|
|
147
|
+
*
|
|
148
|
+
* Creates an AsciiDoc table with |=== delimiters.
|
|
149
|
+
*
|
|
150
|
+
* @param headers - Array of column headers
|
|
151
|
+
* @param rows - 2D array of row data
|
|
152
|
+
* @returns Formatted AsciiDoc table
|
|
153
|
+
*/
|
|
154
|
+
formatTable(headers, rows) {
|
|
155
|
+
if (headers.length === 0) {
|
|
156
|
+
return '';
|
|
157
|
+
}
|
|
158
|
+
const lines = [];
|
|
159
|
+
// Table start
|
|
160
|
+
lines.push('[cols="' + headers.map(() => '1').join(',') + '", options="header"]');
|
|
161
|
+
lines.push('|===');
|
|
162
|
+
// Header row
|
|
163
|
+
lines.push(headers.map(h => `| ${h}`).join(' '));
|
|
164
|
+
// Data rows
|
|
165
|
+
for (const row of rows) {
|
|
166
|
+
lines.push('');
|
|
167
|
+
lines.push(row.map(cell => `| ${cell}`).join(' '));
|
|
168
|
+
}
|
|
169
|
+
// Table end
|
|
170
|
+
lines.push('|===');
|
|
171
|
+
return lines.join('\n');
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Format a blockquote
|
|
175
|
+
*
|
|
176
|
+
* Uses ____ block delimiters for quote blocks.
|
|
177
|
+
*
|
|
178
|
+
* @param text - The quote text (may contain newlines)
|
|
179
|
+
* @returns Formatted blockquote
|
|
180
|
+
*/
|
|
181
|
+
formatBlockquote(text) {
|
|
182
|
+
return '[quote]\n____\n' + text + '\n____';
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Format a horizontal rule/divider
|
|
186
|
+
*
|
|
187
|
+
* @returns AsciiDoc thematic break
|
|
188
|
+
*/
|
|
189
|
+
formatHorizontalRule() {
|
|
190
|
+
return "'''";
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Format an anchor/bookmark
|
|
194
|
+
*
|
|
195
|
+
* Uses [[id]] syntax for explicit anchors.
|
|
196
|
+
*
|
|
197
|
+
* @param id - The anchor identifier
|
|
198
|
+
* @returns AsciiDoc anchor
|
|
199
|
+
*/
|
|
200
|
+
formatAnchor(id) {
|
|
201
|
+
return `[[${id}]]`;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get the README filename for AsciiDoc
|
|
205
|
+
*
|
|
206
|
+
* @returns 'README.adoc'
|
|
207
|
+
*/
|
|
208
|
+
getReadmeFilename() {
|
|
209
|
+
return 'README.adoc';
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get the section filename with .adoc extension
|
|
213
|
+
*
|
|
214
|
+
* @param section - The section identifier
|
|
215
|
+
* @returns Section filename with .adoc extension
|
|
216
|
+
*/
|
|
217
|
+
getSectionFilename(section) {
|
|
218
|
+
return `${section}.adoc`;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Singleton instance of the AsciiDoc format strategy
|
|
223
|
+
*/
|
|
224
|
+
export const asciidocFormatStrategy = new AsciiDocFormatStrategy();
|
|
225
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/templates/formats/asciidoc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,sBAAsB;IACjC;;OAEG;IACM,IAAI,GAAqB,UAAU,CAA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AI,GAAG,QAAQ,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACH,oBAAoB;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;OAOG;IACH,YAAY,CAAC,EAAU;QACrB,OAAO,KAAK,EAAE,IAAI,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACH,iBAAiB;QACf,OAAO,aAAa,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,kBAAkB,CAAC,OAAe;QAChC,OAAO,GAAG,OAAO,OAAO,CAAC;IAC3B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Formats Module
|
|
3
|
+
*
|
|
4
|
+
* Barrel file for output format support. Exports all format-related
|
|
5
|
+
* types, strategies, registry, and factory.
|
|
6
|
+
*
|
|
7
|
+
* @module templates/formats
|
|
8
|
+
*
|
|
9
|
+
* This module provides:
|
|
10
|
+
* - OutputFormatStrategy interface and types
|
|
11
|
+
* - OutputFormatRegistry for format storage
|
|
12
|
+
* - OutputFormatFactory for format creation
|
|
13
|
+
* - Pre-configured singleton instances
|
|
14
|
+
* - Markdown and AsciiDoc format strategies
|
|
15
|
+
*/
|
|
16
|
+
export type { OutputFormatStrategy, OutputFormatCode } from './output-format-strategy.js';
|
|
17
|
+
export { SUPPORTED_OUTPUT_FORMAT_CODES, OUTPUT_FORMAT_ALIASES, DEFAULT_OUTPUT_FORMAT, isOutputFormatCode, normalizeOutputFormatCode } from './output-format-strategy.js';
|
|
18
|
+
export { OutputFormatRegistry } from './output-format-registry.js';
|
|
19
|
+
export { OutputFormatFactory } from './output-format-factory.js';
|
|
20
|
+
export { MarkdownFormatStrategy, markdownFormatStrategy } from './markdown/index.js';
|
|
21
|
+
export { AsciiDocFormatStrategy, asciidocFormatStrategy } from './asciidoc/index.js';
|
|
22
|
+
import { OutputFormatRegistry } from './output-format-registry.js';
|
|
23
|
+
import { OutputFormatFactory } from './output-format-factory.js';
|
|
24
|
+
/**
|
|
25
|
+
* Global output format registry
|
|
26
|
+
*
|
|
27
|
+
* Pre-configured with Markdown and AsciiDoc strategies.
|
|
28
|
+
*/
|
|
29
|
+
export declare const outputFormatRegistry: OutputFormatRegistry;
|
|
30
|
+
/**
|
|
31
|
+
* Global output format factory
|
|
32
|
+
*
|
|
33
|
+
* Pre-configured with the global registry.
|
|
34
|
+
* Provides format creation with normalization and fallback support.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { outputFormatFactory } from './templates/formats/index.js';
|
|
39
|
+
*
|
|
40
|
+
* // Get the default format (AsciiDoc)
|
|
41
|
+
* const defaultFormat = outputFormatFactory.getDefault();
|
|
42
|
+
*
|
|
43
|
+
* // Create a specific format
|
|
44
|
+
* const markdown = outputFormatFactory.create('md');
|
|
45
|
+
*
|
|
46
|
+
* // Create with fallback for unknown formats
|
|
47
|
+
* const format = outputFormatFactory.createWithFallback('unknown'); // Returns AsciiDoc
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare const outputFormatFactory: OutputFormatFactory;
|
|
51
|
+
import type { OutputFormatCode } from './output-format-strategy.js';
|
|
52
|
+
/**
|
|
53
|
+
* Get an output format strategy by code
|
|
54
|
+
*
|
|
55
|
+
* Convenience function that uses the global factory.
|
|
56
|
+
*
|
|
57
|
+
* @param code - The format code (case-insensitive, supports aliases)
|
|
58
|
+
* @returns The output format strategy
|
|
59
|
+
* @throws Error if the format is not registered
|
|
60
|
+
*/
|
|
61
|
+
export declare function getOutputFormatStrategy(code: string): import("./output-format-strategy.js").OutputFormatStrategy;
|
|
62
|
+
/**
|
|
63
|
+
* Get an output format strategy with fallback to default
|
|
64
|
+
*
|
|
65
|
+
* Convenience function that uses the global factory.
|
|
66
|
+
*
|
|
67
|
+
* @param code - The format code (case-insensitive, supports aliases)
|
|
68
|
+
* @returns The output format strategy (requested or default AsciiDoc)
|
|
69
|
+
*/
|
|
70
|
+
export declare function getOutputFormatStrategyWithFallback(code: string): import("./output-format-strategy.js").OutputFormatStrategy;
|
|
71
|
+
/**
|
|
72
|
+
* Get the default output format strategy (AsciiDoc)
|
|
73
|
+
*
|
|
74
|
+
* Convenience function that uses the global factory.
|
|
75
|
+
*
|
|
76
|
+
* @returns The default (AsciiDoc) format strategy
|
|
77
|
+
*/
|
|
78
|
+
export declare function getDefaultOutputFormatStrategy(): import("./output-format-strategy.js").OutputFormatStrategy;
|
|
79
|
+
/**
|
|
80
|
+
* Check if an output format is supported
|
|
81
|
+
*
|
|
82
|
+
* Convenience function that uses the global factory.
|
|
83
|
+
*
|
|
84
|
+
* @param code - The format code to check
|
|
85
|
+
* @returns True if the format is supported
|
|
86
|
+
*/
|
|
87
|
+
export declare function isOutputFormatSupported(code: string): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Get all supported output format codes
|
|
90
|
+
*
|
|
91
|
+
* @returns Array of supported format codes
|
|
92
|
+
*/
|
|
93
|
+
export declare function getSupportedOutputFormatCodes(): OutputFormatCode[];
|
|
94
|
+
/**
|
|
95
|
+
* Detect the output format from a file extension
|
|
96
|
+
*
|
|
97
|
+
* @param extension - The file extension (with or without leading dot)
|
|
98
|
+
* @returns The detected format code, or undefined if not recognized
|
|
99
|
+
*/
|
|
100
|
+
export declare function detectOutputFormatFromExtension(extension: string): OutputFormatCode | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Detect the output format from a filename
|
|
103
|
+
*
|
|
104
|
+
* @param filename - The filename to analyze
|
|
105
|
+
* @returns The detected format code, or undefined if not recognized
|
|
106
|
+
*/
|
|
107
|
+
export declare function detectOutputFormatFromFilename(filename: string): OutputFormatCode | undefined;
|
|
108
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/formats/index.ts"],"names":[],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C,QAAQ,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAQ7F"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Formats Module
|
|
3
|
+
*
|
|
4
|
+
* Barrel file for output format support. Exports all format-related
|
|
5
|
+
* types, strategies, registry, and factory.
|
|
6
|
+
*
|
|
7
|
+
* @module templates/formats
|
|
8
|
+
*
|
|
9
|
+
* This module provides:
|
|
10
|
+
* - OutputFormatStrategy interface and types
|
|
11
|
+
* - OutputFormatRegistry for format storage
|
|
12
|
+
* - OutputFormatFactory for format creation
|
|
13
|
+
* - Pre-configured singleton instances
|
|
14
|
+
* - Markdown and AsciiDoc format strategies
|
|
15
|
+
*/
|
|
16
|
+
export { SUPPORTED_OUTPUT_FORMAT_CODES, OUTPUT_FORMAT_ALIASES, DEFAULT_OUTPUT_FORMAT, isOutputFormatCode, normalizeOutputFormatCode } from './output-format-strategy.js';
|
|
17
|
+
// ============================================
|
|
18
|
+
// Registry
|
|
19
|
+
// ============================================
|
|
20
|
+
export { OutputFormatRegistry } from './output-format-registry.js';
|
|
21
|
+
// ============================================
|
|
22
|
+
// Factory
|
|
23
|
+
// ============================================
|
|
24
|
+
export { OutputFormatFactory } from './output-format-factory.js';
|
|
25
|
+
// ============================================
|
|
26
|
+
// Format Strategies
|
|
27
|
+
// ============================================
|
|
28
|
+
export { MarkdownFormatStrategy, markdownFormatStrategy } from './markdown/index.js';
|
|
29
|
+
export { AsciiDocFormatStrategy, asciidocFormatStrategy } from './asciidoc/index.js';
|
|
30
|
+
// ============================================
|
|
31
|
+
// Pre-configured Singletons
|
|
32
|
+
// ============================================
|
|
33
|
+
import { OutputFormatRegistry } from './output-format-registry.js';
|
|
34
|
+
import { OutputFormatFactory } from './output-format-factory.js';
|
|
35
|
+
import { markdownFormatStrategy } from './markdown/index.js';
|
|
36
|
+
import { asciidocFormatStrategy } from './asciidoc/index.js';
|
|
37
|
+
/**
|
|
38
|
+
* Global output format registry
|
|
39
|
+
*
|
|
40
|
+
* Pre-configured with Markdown and AsciiDoc strategies.
|
|
41
|
+
*/
|
|
42
|
+
export const outputFormatRegistry = new OutputFormatRegistry()
|
|
43
|
+
.register(markdownFormatStrategy)
|
|
44
|
+
.register(asciidocFormatStrategy);
|
|
45
|
+
/**
|
|
46
|
+
* Global output format factory
|
|
47
|
+
*
|
|
48
|
+
* Pre-configured with the global registry.
|
|
49
|
+
* Provides format creation with normalization and fallback support.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* import { outputFormatFactory } from './templates/formats/index.js';
|
|
54
|
+
*
|
|
55
|
+
* // Get the default format (AsciiDoc)
|
|
56
|
+
* const defaultFormat = outputFormatFactory.getDefault();
|
|
57
|
+
*
|
|
58
|
+
* // Create a specific format
|
|
59
|
+
* const markdown = outputFormatFactory.create('md');
|
|
60
|
+
*
|
|
61
|
+
* // Create with fallback for unknown formats
|
|
62
|
+
* const format = outputFormatFactory.createWithFallback('unknown'); // Returns AsciiDoc
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export const outputFormatFactory = new OutputFormatFactory(outputFormatRegistry);
|
|
66
|
+
/**
|
|
67
|
+
* Get an output format strategy by code
|
|
68
|
+
*
|
|
69
|
+
* Convenience function that uses the global factory.
|
|
70
|
+
*
|
|
71
|
+
* @param code - The format code (case-insensitive, supports aliases)
|
|
72
|
+
* @returns The output format strategy
|
|
73
|
+
* @throws Error if the format is not registered
|
|
74
|
+
*/
|
|
75
|
+
export function getOutputFormatStrategy(code) {
|
|
76
|
+
return outputFormatFactory.create(code);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get an output format strategy with fallback to default
|
|
80
|
+
*
|
|
81
|
+
* Convenience function that uses the global factory.
|
|
82
|
+
*
|
|
83
|
+
* @param code - The format code (case-insensitive, supports aliases)
|
|
84
|
+
* @returns The output format strategy (requested or default AsciiDoc)
|
|
85
|
+
*/
|
|
86
|
+
export function getOutputFormatStrategyWithFallback(code) {
|
|
87
|
+
return outputFormatFactory.createWithFallback(code);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get the default output format strategy (AsciiDoc)
|
|
91
|
+
*
|
|
92
|
+
* Convenience function that uses the global factory.
|
|
93
|
+
*
|
|
94
|
+
* @returns The default (AsciiDoc) format strategy
|
|
95
|
+
*/
|
|
96
|
+
export function getDefaultOutputFormatStrategy() {
|
|
97
|
+
return outputFormatFactory.getDefault();
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Check if an output format is supported
|
|
101
|
+
*
|
|
102
|
+
* Convenience function that uses the global factory.
|
|
103
|
+
*
|
|
104
|
+
* @param code - The format code to check
|
|
105
|
+
* @returns True if the format is supported
|
|
106
|
+
*/
|
|
107
|
+
export function isOutputFormatSupported(code) {
|
|
108
|
+
return outputFormatFactory.isSupported(code);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get all supported output format codes
|
|
112
|
+
*
|
|
113
|
+
* @returns Array of supported format codes
|
|
114
|
+
*/
|
|
115
|
+
export function getSupportedOutputFormatCodes() {
|
|
116
|
+
return outputFormatFactory.getAvailableCodes();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Detect the output format from a file extension
|
|
120
|
+
*
|
|
121
|
+
* @param extension - The file extension (with or without leading dot)
|
|
122
|
+
* @returns The detected format code, or undefined if not recognized
|
|
123
|
+
*/
|
|
124
|
+
export function detectOutputFormatFromExtension(extension) {
|
|
125
|
+
const ext = extension.startsWith('.') ? extension : '.' + extension;
|
|
126
|
+
const normalizedExt = ext.toLowerCase();
|
|
127
|
+
if (normalizedExt === '.md' || normalizedExt === '.markdown') {
|
|
128
|
+
return 'markdown';
|
|
129
|
+
}
|
|
130
|
+
if (normalizedExt === '.adoc' || normalizedExt === '.asciidoc' || normalizedExt === '.asc') {
|
|
131
|
+
return 'asciidoc';
|
|
132
|
+
}
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Detect the output format from a filename
|
|
137
|
+
*
|
|
138
|
+
* @param filename - The filename to analyze
|
|
139
|
+
* @returns The detected format code, or undefined if not recognized
|
|
140
|
+
*/
|
|
141
|
+
export function detectOutputFormatFromFilename(filename) {
|
|
142
|
+
const lastDot = filename.lastIndexOf('.');
|
|
143
|
+
if (lastDot === -1) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
const extension = filename.substring(lastDot);
|
|
147
|
+
return detectOutputFormatFromExtension(extension);
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/formats/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAWH,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,6BAA6B,CAAC;AAErC,+CAA+C;AAC/C,WAAW;AACX,+CAA+C;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,+CAA+C;AAC/C,UAAU;AACV,+CAA+C;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,+CAA+C;AAC/C,oBAAoB;AACpB,+CAA+C;AAE/C,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAErF,+CAA+C;AAC/C,4BAA4B;AAC5B,+CAA+C;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,s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