package services // Shims bridging the submission generator to the extracted docforge .docx // adapter (pkg/docforge/docx). Slice 1 of the docforge train // (t-paliad-349 / m/paliad#157) relocated the Markdown→OOXML walker, the // placeholder substitution engine, and the .dotm→.docx converter into // pkg/docforge/docx with no behaviour change. These type aliases and // forwarders keep every existing caller in internal/services and // internal/handlers compiling and behaving identically — the names, // signatures, and semantics are unchanged; only the implementation moved. // // Later slices retire these shims as the submission services are // refactored to call docforge directly through the neutral model and the // VariableResolver interface. import ( "mgit.msbls.de/m/paliad/pkg/docforge" "mgit.msbls.de/m/paliad/pkg/docforge/docx" ) // PlaceholderMap is the variable bag (dotted-key → substituted value), // built by SubmissionVarsService and consumed by the renderer. The // canonical type lives in the docforge root (the format-neutral // variable-bag contract). type PlaceholderMap = docforge.PlaceholderMap // MissingPlaceholderFn translates an unbound placeholder key into the // in-document marker token. type MissingPlaceholderFn = docforge.MissingPlaceholderFn // SubmissionRenderer renders a .docx template by substituting // {{placeholder}} tokens. Stateless; safe for concurrent use. type SubmissionRenderer = docx.SubmissionRenderer // HyperlinkAllocator hands the Markdown walker a rId for each external // URL it encounters in [label](url) inline links. type HyperlinkAllocator = docx.HyperlinkAllocator // NewSubmissionRenderer constructs the renderer. func NewSubmissionRenderer() *SubmissionRenderer { return docx.NewSubmissionRenderer() } // DefaultMissingMarker returns the standard missing-value marker for the // given UI language ("[KEIN WERT: ]" / "[NO VALUE: ]"). func DefaultMissingMarker(lang string) MissingPlaceholderFn { return docforge.DefaultMissingMarker(lang) } // RenderMarkdownToOOXML renders Markdown source into OOXML paragraph // elements using a single paragraph style. func RenderMarkdownToOOXML(md, paragraphStyle string) string { return docx.RenderMarkdownToOOXML(md, paragraphStyle) } // RenderMarkdownToOOXMLWithStyles is the full rich-prose entry point // (headings, lists, blockquote, inline hyperlinks via the allocator). func RenderMarkdownToOOXMLWithStyles(md string, stylemap map[string]string, links HyperlinkAllocator) string { return docx.RenderMarkdownToOOXMLWithStyles(md, stylemap, links) } // ConvertDotmToDocx rewrites a .dotm/.docm/.dotx zip into a clean .docx // zip. Idempotent on a zip that is already a plain .docx. func ConvertDotmToDocx(dotmBytes []byte) ([]byte, error) { return docx.ConvertDotmToDocx(dotmBytes) } // SanitiseSubmissionFileName cleans a string for use inside a download // filename (strips path separators / quotes, ASCII-folds DE umlauts). func SanitiseSubmissionFileName(s string) string { return docx.SanitiseSubmissionFileName(s) }