Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-os-health-mon-guide
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwolfs authored Mar 13, 2024
2 parents fe5741e + 57c676b commit 18da93c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 13 deletions.
20 changes: 10 additions & 10 deletions community/contribute/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

We adopt the default Admonition colors for Note, Tip, Info, Caution, Danger by docusaurus:

[Docusaurus Admonitons](https://docusaurus.io/docs/2.0.1/markdown-features/admonitions)
[Docusaurus Admonitons](https://docusaurus-archive-october-2023.netlify.app/docs/markdown-features/admonitions)

:::note

Expand Down Expand Up @@ -52,7 +52,7 @@ Example Blockquote:

We support markdown language features for Codeblocks.
It is mandatory to define the language to be quoted, when using codeblocks.
Syntax Highlighting is also supported by [Docusaurus via Prism](https://docusaurus.io/docs/2.0.1/markdown-features/code-blocks#supported-languages).
Syntax Highlighting is also supported by [Docusaurus via Prism](https://docusaurus-archive-october-2023.netlify.app/docs/markdown-features/code-blocks#supported-languages).
We are using the GitHub language themeing as default.

```python title="Python example"
Expand All @@ -68,22 +68,22 @@ for i in range(4):

```javascript title="Javascript example"
const code_block = () => {
console.log("inside code_block");
};
console.log('inside code_block')
}
```

```yaml title="YAML example"
---
doe: "a deer, a female deer"
ray: "a drop of golden sun"
doe: 'a deer, a female deer'
ray: 'a drop of golden sun'
pi: 3.14159
xmas: true
french-hens: 3
calling-birds:
- huey
- dewey
- louie
- fred
- huey
- dewey
- louie
- fred
```
```ruby title="Ruby example"
Expand Down
40 changes: 37 additions & 3 deletions populateStds.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ filenames.forEach((filename) => {
id: filename.substring(0, filename.length - 3),
adrId: components[1],
version: components[2],
slug: filename.substring(12, filename.length - 3), // 12 == "scs-xxxx-vN-".length
state: {},
}
// now calculate the properties for the columns (plus stable0 as a helper)
Expand All @@ -46,8 +47,14 @@ filenames.forEach((filename) => {
if (track === undefined) return
if (tracks[track] === undefined) tracks[track] = {}
var standards = tracks[track]
if (standards[obj.adrId] === undefined) standards[obj.adrId] = {versions: []}
standards[obj.adrId].versions.push(obj)
if (standards[obj.adrId] === undefined) standards[obj.adrId] = {versions: [], supplements: {}}
if (obj.type === "Supplement") {
var supplements = standards[obj.adrId].supplements
if (supplements[obj.slug] === undefined) supplements[obj.slug] = {versions: [], title: obj.title}
supplements[obj.slug].versions.push(obj)
} else {
standards[obj.adrId].versions.push(obj)
}
})

function readPrefixLines(fn) {
Expand Down Expand Up @@ -104,6 +111,7 @@ ${headerLegend}
tlines.push('| --------- | ------------ | ----- | ------- | --------- | ----------- |')
Object.entries(trackEntry[1]).forEach((standardEntry) => {
var versions = standardEntry[1].versions
var supplements = standardEntry[1].supplements
var ref = versions[versions.length - 1]
var effectiveVersions = versions.filter((v) => v.state.effective)
if (effectiveVersions.length) {
Expand Down Expand Up @@ -135,7 +143,7 @@ ${headerLegend}
).join(' | ')
lines.push(`| ${link} | ${track} | ${ref.title} | ${versionList} |`)
tlines.push(`| ${link} | ${ref.title} | ${versionList} |`)
standardEntry[1].versions.forEach((obj) => {
versions.forEach((obj) => {
var versionItem = {
type: 'doc',
label: obj.version.toUpperCase(),
Expand All @@ -144,6 +152,32 @@ ${headerLegend}
standardItem.items.push(versionItem)
slines.push(`| [scs-${adrId}-${obj.version}](/standards/${obj.id}) | ${obj.type} | ${obj.status} | ${obj.stabilized_at || '-'} | ${obj.obsoleted_at || '-'} |`)
})
Object.values(supplements).forEach((obj) => {
// var link = `[scs-${adrId}](/standards/${track.toLowerCase()}/scs-${adrId})`
var title = obj.title
var versions = obj.versions
var versionList = ['draft', 'stable', 'effective', 'deprecated'].map(
(column) => mkLinkList(versions.filter((v) => v.state[column])) || '-'
).join(' | ')
if (title.startsWith(ref.title)) {
title = title.substring(ref.title.length)
if (title.startsWith(':')) title = title.substring(1).trimStart()
}
lines.push(`| | | Supplement: ${title} | ${versionList} |`)
tlines.push(`| | Supplement: ${title} | ${versionList} |`)
slines.push(`\n## Supplement: ${title}\n`)
slines.push('| Version | State | stabilized | obsoleted |')
slines.push('| -------- | ------- | ---------- | --------- |')
versions.forEach((obj) => {
var versionItem = {
type: 'doc',
label: obj.version.toUpperCase(),
id: obj.id,
}
standardItem.items.push(versionItem)
slines.push(`| [${obj.version}](/standards/${obj.id}) | ${obj.status} | ${obj.stabilized_at || '-'} | ${obj.obsoleted_at || '-'} |`)
})
})
slines.push('') // file should end with a single newline character
fs.writeFileSync(`${trackPath}/scs-${adrId}.md`, slines.join('\n'), 'utf8')
})
Expand Down

0 comments on commit 18da93c

Please sign in to comment.