Skip to content

Commit 1162746

Browse files
antoineawsBrian Mycroft
authored andcommitted
Automated-Docs-Fix-Additional-Description
1 parent 457b96b commit 1162746

File tree

8 files changed

+118
-65
lines changed

8 files changed

+118
-65
lines changed

src/lib/docs-gen/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"gen-i18n-from-json-schema-fr": "pnpx ts-node scripts/generate-translation-file.ts fr ./output-schema/schema-fr.json ./output-translations/translation-fr.json",
1717
"gen-typedoc-all": "pnpm run gen-typedoc-en && pnpm run gen-typedoc-fr",
1818
"gen-typedoc-en": "rm -r ./output-docs/en; lang=en typedoc ./output-ts/en --name 'AWS SEA Config Docs' --hideGenerator --excludePrivate --localize en --templateStrings ./output-translations/translation-en.json --theme ./src/typedoc-theme --out ./output-docs/en --readme ./src/README-en.md",
19-
"gen-typedoc-fr": "rm -r ./output-docs/fr; lang=fr typedoc ./output-ts/fr --name 'Documents Config AWS SEA' --hideGenerator --excludePrivate --localize fr --templateStrings ./output-translations/translation-fr.json --theme ./src/typedoc-theme --out ./output-docs/fr --readme ./src/README-fr.md",
19+
"gen-typedoc-fr": "rm -r ./output-docs/fr; lang=fr typedoc ./output-ts/en --name 'Documents Config AWS SEA' --hideGenerator --excludePrivate --localize fr --templateStrings ./output-translations/translation-fr.json --theme ./src/typedoc-theme --out ./output-docs/fr --readme ./src/README-fr.md",
2020
"gen-docs": "pnpm run gen-json-schema-all && pnpm run gen-ts-from-json-schema-all && pnpm run gen-i18n-from-json-schema-all && pnpm run gen-typedoc-all",
2121
"build": "pnpm run gen-docs"
2222
},

src/lib/docs-gen/src/README-en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You can find detailed description on each field of the configuration file by acc
1414
- [Accelerator Configuration](./interfaces/AcceleratorConfiguration.html)
1515
- [Global Options](./interfaces/GlobalOptions.html)
1616
- [Mandatory Account Configs](./interfaces/SharedAccountConfig.html)
17-
- [Organizational Units](./interfaces/OrganizationalUnit.html)
17+
- [Organizational Units](./interfaces/OrganizationalUnitConfiguration.html)
1818
- [Workload Account Configs](./interfaces/SharedAccountConfig.html)
1919

20-
- [All Config file "Interfaces"](./Modules.html)
20+
- [All Config file "Interfaces"](./modules.html)

src/lib/docs-gen/src/README-fr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ You can find detailed description on each field of the configuration file by acc
1414
- [Accelerator Configuration](./interfaces/AcceleratorConfiguration.html)
1515
- [Global Options](./interfaces/GlobalOptions.html)
1616
- [Mandatory Account Configs](./interfaces/SharedAccountConfig.html)
17-
- [Organizational Units](./interfaces/OrganizationalUnit.html)
17+
- [Organizational Units](./interfaces/OrganizationalUnitConfiguration.html)
1818
- [Workload Account Configs](./interfaces/SharedAccountConfig.html)
1919

20-
- [All Config file "Interfaces"](./Modules.html)
20+
- [All Config file "Interfaces"](./modules.html)
2121

2222

src/lib/docs-gen/src/helpers/translation-extract-helper.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ export class TranslationExtractHelper {
2828
if (obj.additionalProperties) {
2929
this.iterate(obj.additionalProperties, obj.additionalProperties.title);
3030
}
31+
if (obj.items) {
32+
this.iterate(obj.items, obj.items.title);
33+
}
34+
if (obj.oneOf) {
35+
for (const oneOfObj of obj.oneOf) {
36+
this.iterate(oneOfObj, oneOfObj.title);
37+
}
38+
}
3139

3240
}
3341
private generateTitle(title: string, propertyName: string) {

src/lib/docs-gen/src/i18n/base-en.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"app-title": "Accelerator config file documentation",
66
"Hierarchy": "Hierarchy",
77
"Inherited": "Inherited",
8-
"Title":"Title",
9-
"Description":"Description"
8+
"Title": "Title",
9+
"Description": "Description",
10+
"Disclaimer": "The configuration file schema documentation is a work in progress. Please use this <b>draft</b> document with caution."
1011
}
1112
}

src/lib/docs-gen/src/i18n/base-fr.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"Hierarchy": "Hiérarchie",
77
"Inherited": "Hérité",
88
"Title": "Titre",
9-
"Description": "Description"
9+
"Description": "Description",
10+
"Disclaimer": "(FR) The configuration file schema documentation is a work in progress. Please use this <b>draft</b> document with caution."
1011
}
1112
}

src/lib/docs-gen/src/typedoc-theme/assets/js/src/main-custom.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/lib/docs-gen/src/typedoc-theme/partials/header.hbs

Lines changed: 100 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<div class="tsd-page-toolbar">
33
<div class="container">
44
<div class="table-wrap">
5-
<div class="table-cell" id="tsd-search" data-index="{{relativeURL "assets/js/search.json"}}" data-base="{{relativeURL "./"}}">
5+
<div class="table-cell" id="tsd-search" data-index="{{relativeURL " assets/js/search.json"}}"
6+
data-base="{{relativeURL " ./"}}">
67
<div class="field">
78
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
89
<input id="tsd-search-field" type="text" />
@@ -18,8 +19,8 @@
1819
{{/each}}
1920
</ul>
2021

21-
{{!-- <a href="{{relativeURL "index.html"}}" class="title">{{project.name}}</a> --}}
22-
<a href="{{relativeURL "index.html"}}" class="title">{{#localize}}app-title{{/localize}}</a>
22+
{{!-- <a href="{{relativeURL " index.html"}}" class="title">{{project.name}}</a> --}}
23+
<a href="{{relativeURL " index.html"}}" class="title">{{#localize}}app-title{{/localize}}</a>
2324
{{#each settings.links}}
2425
&emsp;<a href="{{url}}" class="title">{{label}}</a>
2526
{{/each}}
@@ -38,7 +39,8 @@
3839
</ul>
3940
</div>
4041
<div class="tsd-select" id="tsd-language-filter">
41-
<span id="selected-language" class="tsd-select-label" data-language="{{#localize}}language-code{{/localize}}">{{#localize}}Language{{/localize}}</span>
42+
<span id="selected-language" class="tsd-select-label"
43+
data-language="{{#localize}}language-code{{/localize}}">{{#localize}}Language{{/localize}}</span>
4244
<ul class="tsd-select-list" id="tsd-language-select-list">
4345
<li data-value="en">English</li>
4446
<li data-value="fr">Français</li>
@@ -49,13 +51,13 @@
4951
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
5052

5153
{{#unless settings.excludeExternals}}
52-
<input type="checkbox" id="tsd-filter-externals" checked />
53-
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
54+
<input type="checkbox" id="tsd-filter-externals" checked />
55+
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
5456
{{/unless}}
5557

5658
{{#unless settings.excludeNotExported}}
57-
<input type="checkbox" id="tsd-filter-only-exported" />
58-
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
59+
<input type="checkbox" id="tsd-filter-only-exported" />
60+
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
5961
{{/unless}}
6062
</div>
6163
</div>
@@ -65,12 +67,100 @@
6567
</div>
6668
</div>
6769
</div>
68-
<div class="tsd-page-title">
70+
<div class="tsd-page-title custom-breadcrumb">
6971
<div class="container">
7072
<ul class="tsd-breadcrumb">
7173
{{#with model}}{{> breadcrumb}}{{/with}}
7274
</ul>
7375
</div>
7476
</div>
77+
<div class="tsd-page-title disclaimer-wrapper">
78+
<div class="container disclaimer">
79+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
80+
<title>Warning</title>
81+
<path
82+
d="M85.57 446.25h340.86a32 32 0 0028.17-47.17L284.18 82.58c-12.09-22.44-44.27-22.44-56.36 0L57.4 399.08a32 32 0 0028.17 47.17z"
83+
fill="none" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" />
84+
<path d="M250.26 195.39l5.74 122 5.73-121.95a5.74 5.74 0 00-5.79-6h0a5.74 5.74 0 00-5.68 5.95z"
85+
fill="none" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" />
86+
<path fill="black" d="M256 397.25a20 20 0 1120-20 20 20 0 01-20 20z" />
87+
</svg>
88+
<h5>
89+
{{#localize}}Disclaimer{{/localize}}
90+
</h5>
91+
</div>
92+
</div>
7593
</header>
76-
<script src="{{relativeURL "assets/js/src/main-custom.js"}}"></script>
94+
<style>
95+
.disclaimer-wrapper {
96+
background: #FFD740;
97+
padding: 0;
98+
}
99+
100+
.custom-breadcrumb {
101+
margin-bottom: 0px;
102+
}
103+
104+
.disclaimer {
105+
display: flex;
106+
justify-content: flex-start;
107+
align-items: center;
108+
}
109+
110+
.disclaimer svg {
111+
width: 40px;
112+
margin-right: 15px;
113+
}
114+
115+
.disclaimer h5 {
116+
line-height: 20px;
117+
}
118+
</style>
119+
<script>
120+
function replaceMainBreadcrumbLink() {
121+
const mainBreadcrumb = document.querySelector('.main-breadcrumb');
122+
if (!mainBreadcrumb.href.indexOf("modules.html")) return;
123+
mainBreadcrumb.href = mainBreadcrumb.href.replace(`/modules.html`, `/index.html`);
124+
}
125+
const currentLanguage = document.getElementById('selected-language').dataset.language;
126+
127+
const languageFilter = document.getElementById('tsd-language-filter');
128+
languageFilter.addEventListener("mouseenter", (event) => {
129+
languageFilter.classList.add("active");
130+
const languageList = document.getElementById('tsd-language-select-list');
131+
const items = languageList.getElementsByTagName('li');
132+
for (const item of items) {
133+
if (item.dataset.value === currentLanguage) {
134+
item.classList.add('selected');
135+
break;
136+
}
137+
}
138+
});
139+
languageFilter.addEventListener("mouseleave", (event) => {
140+
languageFilter.classList.remove("active");
141+
});
142+
143+
function addEventListenerToLanguages() {
144+
const languageList = document.getElementById('tsd-language-select-list');
145+
const items = languageList.getElementsByTagName('li');
146+
for (const item of items) {
147+
item.addEventListener("click", (event) => {
148+
languageSelected(event, item);
149+
});
150+
}
151+
}
152+
153+
function languageSelected(event, itemClicked) {
154+
const selectedLanguage = itemClicked.dataset.value; //'en', 'fr', 'es', '..'
155+
if (currentLanguage === selectedLanguage) return;
156+
document.location = document.location.href.replace(`/${currentLanguage}/`, `/${selectedLanguage}/`);
157+
}
158+
159+
function initializePage() {
160+
addEventListenerToLanguages();
161+
replaceMainBreadcrumbLink();
162+
}
163+
window.addEventListener('load', (event) => {
164+
initializePage();
165+
});
166+
</script>

0 commit comments

Comments
 (0)