SuperAPI AI Directory

template-add

General & other

View repository

Updated 10-15 21:48

About this skill

/template-add — Adding a template

Creates a template of the specified type and registers it in the object's root XML.

Usage

/template-add <ObjectName> <TemplateName> <TemplateType>
Parameter Required Default Description
ObjectName yes — Object name
TemplateName yes — Template name
TemplateType yes — Type: HTML, Text, SpreadsheetDocument, BinaryData, DataCompositionSchema
Synonym no = TemplateName Template synonym
Lang no ru Page language code — only for the HTML type. A repeated call with a different language adds a page to the existing template
SrcDir no src Path to the folder of the object type (Reports, DataProcessors, Catalogs, Documents...), inside which lies <ObjectName>.xml. Default src is suitable for directories with external data processors/reports lying next to it
-SetMainSKD no — Force set MainDataCompositionSchema

Command

powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/add-template.ps1" -ObjectName "<ObjectName>" -TemplateName "<TemplateName>" -TemplateType "<TemplateType>" [-Synonym "<Synonym>"] [-Lang "<Lang>"] [-SrcDir "<SrcDir>"] [-SetMainSKD]

Example

Add the main DCS to the report in the extension:

powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/add-template.ps1" -ObjectName "ОтчётПродажи" -TemplateName "ОсновнаяСхемаКомпоновкиДанных" -TemplateType "DataCompositionSchema" -SrcDir "src/cfe/МоёРасширение/Reports"

Type mapping

The user can specify the type in free form. Determine the required one by context:

User writes TemplateType Extension Content
HTML HTMLDocument Template/<lang>.html Empty HTML document
Text, text document, text TextDocument .txt Empty file
SpreadsheetDocument, spreadsheet document, MXL SpreadsheetDocument .xml Minimal spreadsheet
BinaryData, binary data BinaryData .bin Empty file
DataCompositionSchema, DCS, composition schema DataCompositionSchema .xml Minimal DCS schema

Naming convention

For templates of print forms (type SpreadsheetDocument) apply the prefix ПФ_MXL_:

Context Name format Example
Print form (external data processor of the PrintForm kind, or the user explicitly says "print form") ПФ_MXL_<КраткоеИмя> ПФ_MXL_М11, ПФ_MXL_СчётФактура, ПФ_MXL_КонвертDL
Other templates (data loading, auxiliary, settings) Without prefix МакетЗагрузки, НастройкиПечати

If the user specified a layout name without a prefix, but the context is a printed form, add the prefix ПФ_MXL_ automatically and report it.

MainDataCompositionSchema (auto)

When adding a layout of type DataCompositionSchema к ExternalReport or Report:

  • If MainDataCompositionSchema is empty — it is automatically filled with a reference to the layout
  • Use --SetMainSKD to overwrite the existing value

What is created

<SrcDir>/<ObjectName>/Templates/
├── <TemplateName>.xml              # Метаданные макета (1 UUID)
└── <TemplateName>/
    └── Ext/
        ├── Template.<ext>          # Содержимое макета
        └── Template/<lang>.html    # HTML: содержимое (Template.xml — дескриптор)

What is modified

  • <SrcDir>/<ObjectName>.xml — added <Template> to the end of ChildObjects
  • For ExternalReport/Report: can be updated MainDataCompositionSchema