node-riner 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +10 -5
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -17,10 +17,8 @@ export default class Ride {
|
|
|
17
17
|
this.defaultinfo = ""
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// this.F = readFileSync(__dirname + "/" + name, { encoding: "utf-8"})
|
|
23
|
-
let options = {
|
|
20
|
+
returnhtml(pagecontent: string | object) : string {
|
|
21
|
+
let options = {
|
|
24
22
|
ignoreAttributes: false,
|
|
25
23
|
}
|
|
26
24
|
const parser = new XMLParser(options);
|
|
@@ -47,7 +45,7 @@ export default class Ride {
|
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
// debug
|
|
50
|
-
if( typeof page['Content'][tags]
|
|
48
|
+
if( typeof page['Content'][tags] === "object" && !Array.isArray( page['Content'][tags])) {
|
|
51
49
|
let gene = `<${tags}>` + Object.keys(page['Content'][tags]).map(key => {
|
|
52
50
|
return `<${key}>${page['Content'][tags][key]}</${key}>`
|
|
53
51
|
}).join('') + `</${tags}>`
|
|
@@ -87,6 +85,13 @@ export default class Ride {
|
|
|
87
85
|
} catch (e) {
|
|
88
86
|
console.error("Whoops, an error occurred during analysis : " + e)
|
|
89
87
|
}
|
|
88
|
+
return ""
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
Ride(name: string) {
|
|
92
|
+
this.F = readFileSync(path.join(__dirname, "../../", name), { encoding: "utf-8"})
|
|
93
|
+
// this.F = readFileSync(__dirname + "/" + name, { encoding: "utf-8"})
|
|
94
|
+
this.returnhtml(this.F)
|
|
90
95
|
}
|
|
91
96
|
serve(port: number) {
|
|
92
97
|
// debug
|