Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into ODATA-1571
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Dec 4, 2023
2 parents d722b87 + e637cdc commit 7cc7ea4
Show file tree
Hide file tree
Showing 82 changed files with 6,919 additions and 7,630 deletions.
1,950 changes: 977 additions & 973 deletions docs/odata-csdl-json/odata-csdl-json.html

Large diffs are not rendered by default.

620 changes: 323 additions & 297 deletions docs/odata-csdl-json/odata-csdl-json.md

Large diffs are not rendered by default.

Binary file modified docs/odata-csdl-json/odata-csdl-json.pdf
Binary file not shown.
1,670 changes: 839 additions & 831 deletions docs/odata-csdl-xml/odata-csdl-xml.html

Large diffs are not rendered by default.

801 changes: 415 additions & 386 deletions docs/odata-csdl-xml/odata-csdl-xml.md

Large diffs are not rendered by default.

Binary file modified docs/odata-csdl-xml/odata-csdl-xml.pdf
Binary file not shown.
78 changes: 39 additions & 39 deletions docs/odata-data-aggregation-ext/odata-data-aggregation-ext.html

Large diffs are not rendered by default.

80 changes: 40 additions & 40 deletions docs/odata-data-aggregation-ext/odata-data-aggregation-ext.md

Large diffs are not rendered by default.

Binary file modified docs/odata-data-aggregation-ext/odata-data-aggregation-ext.pdf
Binary file not shown.
972 changes: 558 additions & 414 deletions docs/odata-json-format/odata-json-format.html

Large diffs are not rendered by default.

422 changes: 289 additions & 133 deletions docs/odata-json-format/odata-json-format.md

Large diffs are not rendered by default.

Binary file modified docs/odata-json-format/odata-json-format.pdf
Binary file not shown.
512 changes: 264 additions & 248 deletions docs/odata-protocol/odata-protocol.html

Large diffs are not rendered by default.

600 changes: 316 additions & 284 deletions docs/odata-protocol/odata-protocol.md

Large diffs are not rendered by default.

Binary file modified docs/odata-protocol/odata-protocol.pdf
Binary file not shown.
1,691 changes: 445 additions & 1,246 deletions docs/odata-temporal-ext/odata-temporal-ext.html

Large diffs are not rendered by default.

1,696 changes: 450 additions & 1,246 deletions docs/odata-temporal-ext/odata-temporal-ext.md

Large diffs are not rendered by default.

Binary file added docs/odata-temporal-ext/odata-temporal-ext.pdf
Binary file not shown.
270 changes: 117 additions & 153 deletions docs/odata-url-conventions/odata-url-conventions.html

Large diffs are not rendered by default.

261 changes: 188 additions & 73 deletions docs/odata-url-conventions/odata-url-conventions.md

Large diffs are not rendered by default.

Binary file modified docs/odata-url-conventions/odata-url-conventions.pdf
Binary file not shown.
12 changes: 8 additions & 4 deletions lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ new Number("odata-data-aggregation-ext").build(proc.stdin);

The HTML file uses CSS stylesheets contained in the [`docs/*/styles`](../docs/odata-data-aggregation-ext/styles) subfolder in order to render keywords in the same font (MathJax Typewriter) whether they occur standalone or in a formula:

| Keyword occurs | Markdown source | Rendered result |
| ------------------ | ------------------------------------ | ------------------------------------ |
| standalone | `` The `aggregate` transformation `` | The ${\tt aggregate}$ transformation |
| in MathJax formula | `${\tt aggregate}(α{\tt\ as\ }D)$` | ${\tt aggregate}(α{\tt\ as\ }D)$ |
| Keyword occurs | Markdown source | Rendered result |
| ------------------ | ---------------------------------- | ------------------------------------ |
| standalone | ``The `aggregate` transformation`` | The ${\tt aggregate}$ transformation |
| in MathJax formula | `${\tt aggregate}(α{\tt\ as\ }D)$` | ${\tt aggregate}(α{\tt\ as\ }D)$ |

A monospaced font (Courier New) is used for OData requests and their JSON or XML responses.

Expand All @@ -96,6 +96,10 @@ The following scripts can be executed manually or as part of a GitHub Action:
- a copy of the common [`styles`](../styles) folder
- a copy of the document-specific `*/images` folder, if this exists.
- [`npm run pdf`](build-pdf.mjs) runs the PDF conversion and writes the PDF document into the [`docs/*`](../docs) folder.
- [`npm run select <CSS selector> [<XPath expression>]`](selector.mjs) selects parts of the generated HTML documents by executing a CSS selector and optionally an XPath expression relative to each match. For example, syntax errors in JSON code snippets can be detected with
```sh
npm run select ".json .er" "self::*[.!='']/text()"
```
- [`npm test`](../test) runs a test suite.
## A note on diagrams
Expand Down
2 changes: 1 addition & 1 deletion lib/build-pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ iterator(function (srcname, name, variant, meta) {
console.log(
refreshed ? "✓" : "=",
srcname,
variant === "meta" ? "" : variant
variant === "meta" ? "" : variant,
);
})
.catch((error) => {
Expand Down
6 changes: 3 additions & 3 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ iterator(function (srcname, name, variant, meta) {
"--metadata-file": `${__dirname}/../${srcname}/${variant}.yaml`,
});
html.stdout.pipe(
fs.createWriteStream(`${__dirname}/../docs/${name}/${name}.html`)
fs.createWriteStream(`${__dirname}/../docs/${name}/${name}.html`),
);
new Number(srcname, variant, meta)
.build(
Expand All @@ -34,7 +34,7 @@ iterator(function (srcname, name, variant, meta) {
.on("end", function () {
md.end();
html.stdin.end();
})
}),
)
.then(() => {
console.log("✓", srcname, variant === "meta" ? "" : variant);
Expand All @@ -53,5 +53,5 @@ fs.writeFileSync(
This repository contains working drafts for OData specifications:
${docs.sort().join("\n")}
`
`,
);
38 changes: 19 additions & 19 deletions lib/clean.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const clean = old
.replaceAll("\r\n", "\n")
.replace(
/<span[ \n]style='font:7.0pt "Times New Roman"'>(&nbsp;|\n|\s)+<\/span>/g,
" "
" ",
)
.replace(/<a[ \n]name="_[^"]+">[\d\. \n]*<\/a>/g, "")
.replace(/<a[ \n]name="_[^"]+">([^>]*)<\/a>/g, "$1")
Expand All @@ -28,30 +28,30 @@ const clean = old
// clean up formatting
.replace(
/<span[ \n]+style='font-family:\n?"Arial",sans-serif'>([^<]*)<\/span>/g,
"$1"
"$1",
)
.replace(
/<span[ \n](lang=[A-Z]+ )?style='(font-size:\n?[\d\.]+pt;[ \n]*)?color:\n?black(;\n?background:\n?(white|#D9D9D9))?'>([^<]*)<\/span>/g,
"$5"
"$5",
)
.replace(
/<span[ \n]style='font-family:"Calibri",sans-serif'>([^<]*)<\/span>/g,
"$1"
"$1",
)
.replace(/<span[ \n]style='color:windowtext'>([^<]*)<\/span>/g, "$1")
.replace(
/<span[ \n]style='background:(white|#D9D9D9)'>([^<]*)<\/span>/g,
"$2"
"$2",
)
.replace(/<span[ \n]style='color:(black|#333333)'>([^<]*)<\/span>/g, "$2")
.replace(
/<span[ \n]style='color:\n?(black|#333333);\n?background:\n?white'>([^<]*)<\/span>/g,
"$2"
"$2",
)
.replace(/<span[ \n]class=MsoHyperlink>([^<]*)<\/span>/g, "$1")
.replace(
/<span[ \n]class=MsoHyperlink>([^<]*)<b>([^<]*)<\/b><\/span>/g,
"$1$2"
"$1$2",
)
.replace(/<span[ \n]lang=EN>([^<]*)<\/span>/g, "$1")
.replace(/<span[ \n]class=string>([^<]*)<\/span>/g, "$1")
Expand All @@ -61,7 +61,7 @@ const clean = old
// clean up code formatting
.replace(
/<span[ \n]+style='(font-size:[\d\.]+pt;[ \n]*)?font-family:[ \n]*"Courier[ \n]New"(;\n?color:black)?(;\n?background:\n?white)?'>([^<]*)<\/span>/g,
"<code>$4</code>"
"<code>$4</code>",
)
.replace(/<span[ \n]+class=Datatype>([^<]*)<\/span>/g, "<code>$1</code>")
.replace(/<span[ \n]+class=Keyword>([^<]*)<\/span>/g, "<code>$1</code>")
Expand All @@ -70,19 +70,19 @@ const clean = old
.replaceAll("</code><code>", "")
.replace(
/<span[ \n]style='color:(black|#333333)'>((<code>|<\/code>|[^<])*)<\/span>/g,
"$2"
"$2",
)
.replace(
/<p[ \n]+class=SourceCode>([^<]*)<\/p>/g,
"<p class=SourceCode><code>$1</code></p>"
"<p class=SourceCode><code>$1</code></p>",
)
.replace(/<span[ \n]+class=MsoHyperlink><code> <\/code><\/span>/g, "")
.replace(/<span[ \n]+class=MsoHyperlink><i> <\/i><\/span>/g, "")

// clean up headings
.replace(
/<a[ \n]href="#sec[^"]+">((<code>|<\/code>|[^<])*)<\/a><\/h/g,
"$1</h"
"$1</h",
)
.replace(/<h1>[\d\.\s]*/g, "<h1>##sec ")
.replace(/<h2>[\d\.\s]*/g, "<h2>##subsec ")
Expand All @@ -94,7 +94,7 @@ const clean = old
// TODO: clean up more <div> tags
.replace(
/<div style='border:none;border-top:solid gray 1.0pt;padding:6.0pt 0in 0in 0in'>([\s\S]*?)<\/div>/g,
"$1"
"$1",
)

// clean up references
Expand Down Expand Up @@ -134,11 +134,11 @@ const final = raw
// bullet points
.replace(
/\n\[· \]\{style="(font-size:[\d\.]+pt;)?font-family:\n?Symbol(;color:black)?(;font-style:normal)?"\}/g,
"- "
"- ",
)
.replace(
/\n\[\[·[ \n]\]\{style="(font-size:[\d\.]+pt;)?font-family:Symbol(;\n?color:(black|windowtext))?"\}\]\{[^}]*\}/g,
"- "
"- ",
)
// code blocks
.replace(
Expand All @@ -149,25 +149,25 @@ const final = raw
.replace(/`\n\n`/g, "\n")
.replace(/^`/, "")
.replace(/`$/, "") +
"\n```\n"
"\n```\n",
)
// CSDL representation-specific stuff
.replace(
/^::: \{style="border:none;border-left:solid windowtext 1.0pt;padding:0in 0in 0in 8.0pt;\nmargin-left:21.55pt;margin-right:0in"\}\n/gm,
"::: csdlHeadline\n"
"::: csdlHeadline\n",
)
.replace(
/^::: \{style="border:none;border-left:solid windowtext 1.0pt;padding:0in 0in 0in 8.0pt;\nmargin-left:21.55pt;margin-right:21.55pt"\}\n/gm,
"::: csdl\n"
"::: csdl\n",
)
// examples: twice for consecutive examples without empty lines between them
.replace(
/\nExample \d+:([\s\S]*?)\n\n/g,
"\n::: example\nExample ##ex:$1\n:::\n\n"
"\n::: example\nExample ##ex:$1\n:::\n\n",
)
.replace(
/\n ?Example \d+:([\s\S]*?)\n\n/g,
"\n::: example\nExample ##ex:$1\n:::\n\n"
"\n::: example\nExample ##ex:$1\n:::\n\n",
)
// minor tweaks
.replace(/\[([^\]]+)\]\{#_Toc[^}]+\}/g, "$1");
Expand Down
44 changes: 23 additions & 21 deletions lib/iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@ const fs = require("fs");
const yaml = require("js-yaml");

module.exports = function (callback) {
fs.readdirSync(__dirname + "/..", { withFileTypes: true }).forEach(function (
doc
) {
if (doc.isDirectory() && doc.name.startsWith("odata-")) {
fs.readdirSync(`${__dirname}/../${doc.name}`)
.filter((fn) => fn.endsWith(".yaml"))
.forEach(function (metaname) {
var meta = yaml.load(
fs.readFileSync(`${__dirname}/../${doc.name}/${metaname}`)
);
var name =
metaname === "meta.yaml" || !meta.dirname ? doc.name : meta.dirname;
callback(
doc.name,
name,
metaname.substring(0, metaname.length - 5),
meta
);
});
}
});
fs.readdirSync(__dirname + "/..", { withFileTypes: true }).forEach(
function (doc) {
if (doc.isDirectory() && doc.name.startsWith("odata-")) {
fs.readdirSync(`${__dirname}/../${doc.name}`)
.filter((fn) => fn.endsWith(".yaml"))
.forEach(function (metaname) {
var meta = yaml.load(
fs.readFileSync(`${__dirname}/../${doc.name}/${metaname}`),
);
var name =
metaname === "meta.yaml" || !meta.dirname
? doc.name
: meta.dirname;
callback(
doc.name,
name,
metaname.substring(0, metaname.length - 5),
meta,
);
});
}
},
);
};
Loading

0 comments on commit 7cc7ea4

Please sign in to comment.