Skip to content

Commit f2c9679

Browse files
authored
Merge pull request #8 from IPdotSetAF/4-json-xml-yaml-toml-converters
4 json xml yaml toml converters
2 parents 2c41817 + f891f47 commit f2c9679

11 files changed

Lines changed: 345 additions & 19 deletions

angular.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
"scripts": [
3535
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
3636
],
37+
"allowedCommonJsDependencies": [
38+
"fast-xml-parser",
39+
"yamljs"
40+
],
3741
"server": "src/main.server.ts",
3842
"prerender": true,
3943
"ssr": false

package-lock.json

Lines changed: 75 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@
2525
"bootstrap": "^5.3.3",
2626
"bootstrap-icons": "^1.11.3",
2727
"express": "^4.18.2",
28+
"fast-xml-parser": "^4.5.0",
2829
"marked": "^14.1.3",
2930
"prism-code-editor": "^4.0.0-beta.1",
3031
"rxjs": "~7.8.0",
32+
"smol-toml": "^1.3.0",
3133
"tslib": "^2.3.0",
34+
"yamljs": "^0.3.0",
3235
"zone.js": "~0.14.10"
3336
},
3437
"devDependencies": {
@@ -38,12 +41,18 @@
3841
"@types/express": "^4.17.17",
3942
"@types/jasmine": "~5.1.0",
4043
"@types/node": "^18.18.0",
44+
"@types/yamljs": "^0.2.34",
4145
"jasmine-core": "~5.2.0",
4246
"karma": "~6.4.0",
4347
"karma-chrome-launcher": "~3.2.0",
4448
"karma-coverage": "~2.2.0",
4549
"karma-jasmine": "~5.1.0",
4650
"karma-jasmine-html-reporter": "~2.1.0",
4751
"typescript": "~5.5.2"
52+
},
53+
"browser": {
54+
"fs": false,
55+
"path": false,
56+
"os": false
4857
}
49-
}
58+
}

src/app/app.routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import { NotFoundComponent } from './not-found/not-found.component';
33
import { Cs2tsComponent } from './cs2ts/cs2ts.component';
44
import { HomeComponent } from './home/home.component';
55
import { Md2htmlComponent } from './md2html/md2html.component';
6+
import { SerializedToolComponent } from './serialized-tool/serialized-tool.component';
67

78
export const routes: Routes = [
89
{ path: '', redirectTo: "home", pathMatch: "full" },
910

1011
{ path: 'home', title: "Home • CodeChef", component: HomeComponent },
1112
{ path: 'cs2ts', title: "C# to TS • CodeChef", component: Cs2tsComponent },
1213
{ path: 'md2html', title: "MD to HTML • CodeChef", component: Md2htmlComponent },
14+
{ path: 'serialized', title: "Serialized Tool • CodeChef", component: SerializedToolComponent },
1315

1416
{ path: '**', title: "Not Found • CodeChef", component: NotFoundComponent },
1517
];

src/app/code-area/code-area.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import { copyButton } from "prism-code-editor/copy-button";
2121
import "prism-code-editor/prism/languages/json";
2222
import "prism-code-editor/prism/languages/yaml";
2323
import "prism-code-editor/prism/languages/toml";
24-
import "prism-code-editor/prism/languages/java";
2524
import "prism-code-editor/prism/languages/xml";
2625
import "prism-code-editor/prism/languages/csharp";
2726
import "prism-code-editor/prism/languages/typescript";
2827
import "prism-code-editor/prism/languages/markup";
28+
import "prism-code-editor/prism/languages/markdown";
2929

3030
@Component({
3131
selector: 'code-area',
@@ -62,9 +62,13 @@ export class CodeAreaComponent implements AfterViewInit, OnChanges {
6262
}
6363

6464
ngOnChanges(changes: SimpleChanges): void {
65-
if (changes["code"].previousValue !== changes["code"].currentValue) {
66-
this.editor?.setOptions({ value: changes["code"].currentValue });
67-
}
65+
if (changes["code"])
66+
if (changes["code"].previousValue !== changes["code"].currentValue)
67+
this.editor?.setOptions({ value: changes["code"].currentValue });
68+
69+
if (changes["language"])
70+
if (changes["language"].previousValue !== changes["language"].currentValue)
71+
this.editor?.setOptions({ language: changes["language"].currentValue });
6872
}
6973

7074
initEditor(): PrismEditor {

src/app/cs2ts/cs2ts.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ <h2>C# to TS Converter</h2>
66

77
<div class="row">
88
<div class="col-md-6">
9-
<label for="csharp-code" class="form-label">C# class fields:</label>
9+
<label class="form-label">C# class fields:</label>
1010
<div class="code-border">
1111
<code-area innerStyle="min-height:500px;" [(code)]="csCode" (codeChange)="inputDebouncer.next(csCode)"
1212
language="csharp" />
1313
</div>
1414
<br />
1515
</div>
1616
<div class="col-md-6">
17-
<label for="ts-code" class="form-label">TS interface fields:</label>
17+
<label class="form-label">TS interface fields:</label>
1818
<div class="code-border" [@valueChangeAnim]="status">
1919
<code-area innerStyle="min-height:500px;" [(code)]="tsCode" language="typescript" readonly="true" />
2020
</div>

src/app/home/home.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ <h1>CodeChef</h1>
1313
<div class="col-12 d-flex flex-wrap gap-2 justify-content-center">
1414
<a class="btn btn-outline-success" [routerLink]="['/','cs2ts']">C# to TS Converter</a>
1515
<a class="btn btn-outline-success" [routerLink]="['/','md2html']">Markdown to HTML Converter</a>
16+
<a class="btn btn-outline-success" [routerLink]="['/','serialized']">Serialized Tool</a>
1617
</div>
1718
</div>
1819
<br />

src/app/md2html/md2html.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ <h2>Markdown to HTML Converter</h2>
66

77
<div class="row">
88
<div class="col-md-6">
9-
<label for="csharp-code" class="form-label">Markdown:</label>
9+
<label class="form-label">Markdown:</label>
1010
<div class="code-border">
1111
<code-area innerStyle="min-height:500px;" [(code)]="mdCode" (codeChange)="inputDebouncer.next(mdCode)"
1212
language="markdown" />
1313
</div>
1414
<br />
1515
</div>
1616
<div class="col-md-6">
17-
<label for="ts-code" class="form-label">HTML:</label>
17+
<label class="form-label">HTML:</label>
1818
<div class="code-border" [@valueChangeAnim]="status">
1919
<code-area innerStyle="min-height:500px;" [(code)]="htmlCode" language="markup" readonly="true" />
2020
</div>

0 commit comments

Comments
 (0)