diff --git a/.editorconfig b/.editorconfig index 59a6e17a1..404f9b991 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,7 @@ root = true # ensure the LF line endings -[*.{abap,md,properties,acds,json,mjs,gitignore}] +[*.{abap,properties,acds,json,mjs,gitignore}] charset = utf-8 end_of_line = lf insert_final_newline = true @@ -14,3 +14,12 @@ trim_trailing_whitespace = true [*.json] indent_style = space indent_size = 2 + + +# ensure the LF line endings for SKTD markdowns +[*.md] +charset = utf-8 +end_of_line = lf +insert_final_newline = true + + diff --git a/file-formats/sktd/README.md b/file-formats/sktd/README.md new file mode 100644 index 000000000..b3164ab1d --- /dev/null +++ b/file-formats/sktd/README.md @@ -0,0 +1,15 @@ +# SKTD File Format + +File | Cardinality | Definition | Schema | Example +:--- | :--- | :--- | :--- | :--- +`.sktd.json` | 1 | [`zif_aff_sktd_v1.intf.abap`](./type/zif_aff_sktd_v1.intf.abap) | [`sktd-v1.json`](./sktd-v1.json) | [`z_aff_example_sktd.sktd.json`](./examples/z_aff_example_sktd.sktd.en.json) + + +The serialization of a KTD object will be done by serialization of each documentation element, for each element the ID is followed by the markdown content. +The ID will be serialized as comment, e.g. the element ID of the headings action documentation element from the example: + +``` +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.headings ) +``` + +All lines of the documentation content which starts with `[//]:` will be escaped as `\[//]:`. diff --git a/file-formats/sktd/examples/z_aff_example_sktd.sktd.en.md b/file-formats/sktd/examples/z_aff_example_sktd.sktd.en.md new file mode 100644 index 000000000..6d07dfc17 --- /dev/null +++ b/file-formats/sktd/examples/z_aff_example_sktd.sktd.en.md @@ -0,0 +1,252 @@ +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.headings ) + +## Headings + +Section headings can be specified in six different levels using the hash character. + +**Markdown**: +``` +# This is a h1 heading +## This is a h2 heading +### This is a h3 heading +#### This is a h4 heading +##### This is a h5 heading +###### This is a h6 heading +``` + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.headings ) + + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.linesAndParagraphs ) + +## Lines and paragraphs + +This is a paragraph. +This is a new line in the same paragraph. + +This is a separate paragraph. + +**Markdown**: +``` +This is a paragraph. +This is a new line in the same paragraph. + +This is a separate paragraph. +``` + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.linesAndParagraphs ) + + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.links ) + +## Links + +### Web links + +* See [Link SAP](https://www.sap.com) +* A direct link goes is specified like this: + +**Markdown**: +``` +* See [Link SAP](http://www.sap.com) +* A direct link goes is specified like this: +``` + +### Object reference + +* See [Link to BDEF](BDEF:Z_AFF_EXAMPLE_SKTD) +* A direct link goes is specified like this: + +**Markdown**: +``` +* See [Link to BDEF](BDEF:Z_AFF_EXAMPLE_SKTD) +* A direct link goes is specified like this: +``` + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.links ) + + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.lists ) + +## Lists + +### Unordered list + +* item 1 + * item 1.1 + * item 1.2 + * item 1.2.1 +* item 2 +* item 3 + +**Markdown**: +``` +* item 1 + * item 1.1 + * item 1.2 + * item 1.2.1 +* item 2 +* item 3 +``` + +### Ordered List + +1. item a +2. item b +3. item c + +**Markdown**: +``` +1. item a +2. item b +3. item c +``` + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.lists ) + + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.quote ) + +### Quote + +> This is a simple blockquote text. +> This line is part of the same quote. + +Quote break. + +> This is the continued blockquote text. + +**Markdown**: +``` +> A blockquote starts with the greater-than character (>). +``` + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.quote ) + + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.sourceCode ) + +### Source Code + +`Inline code` has *back-ticks* (`\``) around it. + +A code block is enclosed by *three back-ticks* (`\`\`\``) before and after the code snippet. + +``` +if (a == b) { + alert(s); +} +``` + +**Markdown**: +``` +\`\`\` +if (a == b) { + alert(s); +} +\`\`\` +``` + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.sourceCode ) + + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.table ) + +## Tables in Simple Markdown + +There must be at least 3 dashes separating each header cell. + +| Header1 | Header2 | Header3 | +|---------|---------|---------| +|Cell11 |*Cell12* |Cell13 | +|Cell21 |Cell22 |Cell23 | + +**Markdown**: +``` +| Header1 | Header2 | Header3 | +|---------|---------|---------| +|Cell11 |*Cell12* |Cell13 | +|Cell21 |Cell22 |Cell23 | +``` + +The outer pipes (`|`) are optional. + +Markdown | Less | Pretty +--- | --- | --- +*Still* | `renders` | **nicely** +1 | 2 | 3 + +**Markdown**: +``` +Markdown | Less | Pretty +--- | --- | --- +*Still* | `renders` | **nicely** +1 | 2 | 3 +``` + +Columns can be aligned using colons (`:`) with the dashes. + +| Tables | Are | Cool | +|----------|:-------------:|------:| +| col 1 is | left-aligned | $1600 | +| col 2 is | centered | $12 | +| col 3 is | right-aligned | $1 | + +**Markdown**: +``` +| Tables | Are | Cool | +|----------|:-------------:|------:| +| col 1 is | left-aligned | $1600 | +| col 2 is | centered | $12 | +| col 3 is | right-aligned | $1 | +``` + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.table ) + + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.textFormatting ) + +## Text formatting + +Simple Markdown supports *Italics* (enclosed by `\*`), **Bold** (enclosed by `\*\*`) and ~~Strikethrough~~ (enclosed by `\~\~`). + +**Markdown**: +``` +Text can be formatted in *Italics*, **Bold** or ~~Strikethrough~~. +``` + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.textFormatting ) + + + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAE;name=z_aff_example_sktd ) + +Here are some documentation texts for the different actions named after the different possibilities of KTD Markdown. + +[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAE;name=z_aff_example_sktd ) + + + +[//]: # (id:[z_aff_example_sktd] ) + +This is an example KTD documentation of a *Behavior Definition* (**BDEF**) and will be used to create an example *ABAP File Format* (**AFF**). + +The serialization of a KTD object will be done by serialization of each documentation element, for each element the ID followed by the markdown content. The ID will be serialized as comment, e.g. this element ID: + +``` +\[//]: # (id:/sap/bc/adt/bo/behaviordefinitions/z_aff_example_sktd/source/main#type=BDEF/BAC;name=z_aff_example_sktd.headings ) +``` + +Lines in the content starting with `[//]:` will be escaped as `\[//]:`. diff --git a/file-formats/sktd/examples/z_aff_example_sktd.sktd.json b/file-formats/sktd/examples/z_aff_example_sktd.sktd.json new file mode 100644 index 000000000..8824f87d6 --- /dev/null +++ b/file-formats/sktd/examples/z_aff_example_sktd.sktd.json @@ -0,0 +1,11 @@ +{ + "formatVersion": "1", + "header": { + "description": "Documentation for Z_AFF_EXAMPLE_SKTD", + "originalLanguage": "EN" + }, + "documentedObject": { + "type": "BDEF", + "name": "Z_AFF_EXAMPLE_SKTD" + } +} diff --git a/file-formats/sktd/sktd-v1.json b/file-formats/sktd/sktd-v1.json new file mode 100644 index 000000000..6598d5600 --- /dev/null +++ b/file-formats/sktd/sktd-v1.json @@ -0,0 +1,90 @@ +{ + "$comment": "This file is autogenerated, do not edit manually, see https://github.com/SAP/abap-file-formats for more information.", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/SAP/abap-file-formats/blob/main/file-formats/sktd/sktd-v1.json", + "title": "Knowledge Transfer Document Properties", + "description": "KTD properties", + "type": "object", + "properties": { + "formatVersion": { + "title": "ABAP File Format Version", + "description": "The ABAP file format version", + "type": "string", + "const": "1" + }, + "header": { + "title": "Header", + "description": "Header", + "type": "object", + "properties": { + "description": { + "title": "Description", + "description": "Description of the ABAP object", + "type": "string", + "maxLength": 60 + }, + "originalLanguage": { + "title": "Original Language", + "description": "Original language of the ABAP object", + "type": "string", + "maxLength": 2 + }, + "abapLanguageVersion": { + "title": "ABAP Language Version", + "description": "ABAP language version", + "type": "string", + "enum": [ + "standard", + "keyUser", + "cloudDevelopment" + ], + "enumTitles": [ + "Standard", + "ABAP for Key Users", + "ABAP Cloud Development" + ], + "enumDescriptions": [ + "Standard", + "ABAP for key user extensibility", + "ABAP cloud development" + ], + "default": "standard" + } + }, + "additionalProperties": false, + "required": [ + "description", + "originalLanguage" + ] + }, + "documentedObject": { + "title": "Documented Object", + "description": "Type and name of the documented object", + "type": "object", + "properties": { + "type": { + "title": "Object Type", + "description": "Type of the documented object", + "type": "string", + "maxLength": 4 + }, + "name": { + "title": "Object Name", + "description": "Name of the documented object", + "type": "string", + "maxLength": 40 + } + }, + "additionalProperties": false, + "required": [ + "type", + "name" + ] + } + }, + "additionalProperties": false, + "required": [ + "formatVersion", + "header" + ] +} diff --git a/file-formats/sktd/type/zif_aff_sktd_v1.intf.abap b/file-formats/sktd/type/zif_aff_sktd_v1.intf.abap new file mode 100644 index 000000000..3445fe6f0 --- /dev/null +++ b/file-formats/sktd/type/zif_aff_sktd_v1.intf.abap @@ -0,0 +1,34 @@ +INTERFACE zif_aff_sktd_v1 + PUBLIC. + + TYPES: + "!

Documented Object

+ "! Type and name of the documented object + BEGIN OF ty_sktd_documented_object, + "!

Object Type

+ "! Type of the documented object + "! $required + type TYPE c LENGTH 4, + "!

Object Name

+ "! Name of the documented object + "! $required + name TYPE c LENGTH 40, + END OF ty_sktd_documented_object. + + + TYPES: + "!

Knowledge Transfer Document Properties

+ "! KTD properties + BEGIN OF ty_main, + "! $required + format_version TYPE zif_aff_types_v1=>ty_format_version, + "!

Header

+ "! Header + "! $required + header TYPE zif_aff_types_v1=>ty_header_60, + "!

Documented Object

+ "! Type and name of the documented object + documented_object TYPE ty_sktd_documented_object, + END OF ty_main. + +ENDINTERFACE. diff --git a/file-formats/sktd/type/zif_aff_sktd_v1.intf.json b/file-formats/sktd/type/zif_aff_sktd_v1.intf.json new file mode 100644 index 000000000..62211044c --- /dev/null +++ b/file-formats/sktd/type/zif_aff_sktd_v1.intf.json @@ -0,0 +1,7 @@ +{ + "formatVersion": "1", + "header": { + "description": "ABAP type specification for Knowledge Transfer Documents", + "originalLanguage": "EN" + } +}