xml indenter

This commit is contained in:
Michele Artini 2024-02-01 10:35:20 +01:00
parent d330b4442d
commit c0e3456887
6 changed files with 42 additions and 3 deletions

View File

@ -4,10 +4,10 @@ COPY package*.json .
RUN npm install
RUN npm install --save swagger-ui-dist
RUN npm install mermaid
RUN npm install xml-formatter
RUN npm install --save-dev @types/dompurify
RUN npm install --save-dev @types/dompurify
RUN npm install --save-dev @types/d3
COPY . .
EXPOSE 4200
CMD ["npm", "start"]

View File

@ -22,6 +22,7 @@
"rxjs": "~7.8.0",
"swagger-ui-dist": "^5.10.0",
"tslib": "^2.3.0",
"xml-formatter": "^3.6.2",
"zone.js": "~0.12.0"
},
"devDependencies": {
@ -14077,6 +14078,25 @@
}
}
},
"node_modules/xml-formatter": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/xml-formatter/-/xml-formatter-3.6.2.tgz",
"integrity": "sha512-enWhevZNOwffZFUhzl1WMcha8lFLZUgJ7NzFs5Ug4ZOFCoNheGYXz1J9Iz/e+cTn9rCkuT1GwTacz+YlmFHOGw==",
"dependencies": {
"xml-parser-xo": "^4.1.0"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/xml-parser-xo": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/xml-parser-xo/-/xml-parser-xo-4.1.1.tgz",
"integrity": "sha512-Ggf2y90+Y6e9IK5hoPuembVHJ03PhDSdhldEmgzbihzu9k0XBo0sfcFxaSi4W1PlUSSI1ok+MJ0JCXUn+U4Ilw==",
"engines": {
"node": ">= 14"
}
},
"node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",

View File

@ -24,6 +24,7 @@
"rxjs": "~7.8.0",
"swagger-ui-dist": "^5.10.0",
"tslib": "^2.3.0",
"xml-formatter": "^3.6.2",
"zone.js": "~0.12.0"
},
"devDependencies": {

View File

@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FilterPipe } from './common/filter.pipe';
import { XmlPipe } from './common/xml.pipe';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@ -54,6 +55,7 @@ import { OaiExplorerComponent } from './oai-explorer/oai-explorer.component';
declarations: [
AppComponent,
FilterPipe,
XmlPipe,
MainMenuPanelsComponent,
InfoComponent,
ServiceInfoDialog,

View File

@ -0,0 +1,16 @@
import { Pipe, PipeTransform } from "@angular/core";
import xmlFormat from 'xml-formatter';
@Pipe({
name: 'xml'
})
export class XmlPipe implements PipeTransform {
transform(value: string): string {
return xmlFormat(value, {
indentation: ' ',
collapseContent: true,
lineSeparator: '\n',
throwOnFailure: false
});
}
}

View File

@ -165,8 +165,8 @@
</tr>
</table>
</mat-card-content>
<mat-card-content>
<pre>{{r.body}}</pre>
<mat-card-content style="overflow: scroll;">
<pre>{{r.body | xml}}</pre>
</mat-card-content>
</mat-card>
</ng-container>