File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 15
15
"@std/encoding" : " jsr:@std/encoding@^1.0.1" ,
16
16
"@std/front-matter" : " jsr:@std/front-matter@^1.0.1" ,
17
17
"@std/fs" : " jsr:@std/fs@^1.0.1" ,
18
+ "@std/html" : " jsr:@std/html@^1.0.1" ,
18
19
"@std/http" : " jsr:@std/http@^1.0.0" ,
19
20
"@std/path" : " jsr:@std/path@^1.0.2" ,
20
21
"@std/streams" : " jsr:@std/streams@^1.0.0" ,
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type {DinoHandle} from '@ssr/dinossr';
2
2
import type { Data } from '@src/types.ts' ;
3
3
import { manifest } from '@src/manifest.ts' ;
4
4
import { replace , striptags } from '@src/shared.ts' ;
5
+ import { escape , unescape } from '@std/html/entities' ;
5
6
6
7
export const pattern = '.xml' ;
7
8
@@ -53,8 +54,7 @@ export const GET: DinoHandle<Data> = () => {
53
54
const entries = notes . map ( ( note ) => {
54
55
let xml = entry ;
55
56
let description = striptags ( note . body ) ;
56
- description = replace ( description , '<' , '<' ) ;
57
- description = replace ( description , '>' , '>' ) ;
57
+ description = escape ( unescape ( description ) ) ;
58
58
const guid = new URL ( note . href , meta . url ) ;
59
59
xml = replace ( xml , `{{description}}` , description ) ;
60
60
xml = replace ( xml , `{{html}}` , note . body ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type {DinoHandle} from '@ssr/dinossr';
2
2
import type { Data } from '@src/types.ts' ;
3
3
import { manifest } from '@src/manifest.ts' ;
4
4
import { replace , striptags } from '@src/shared.ts' ;
5
+ import { escape , unescape } from '@std/html/entities' ;
5
6
6
7
export const pattern = '.xml' ;
7
8
@@ -54,8 +55,7 @@ export const GET: DinoHandle<Data> = () => {
54
55
const pubDate = new Date ( bookmark . date ! ) . toUTCString ( ) ;
55
56
const guid = new URL ( bookmark . href , meta . url ) ;
56
57
let excerpt = striptags ( bookmark . excerpt ) ;
57
- excerpt = replace ( excerpt , '<' , '<' ) ;
58
- excerpt = replace ( excerpt , '>' , '>' ) ;
58
+ excerpt = escape ( unescape ( excerpt ) ) ;
59
59
xml = replace ( xml , `{{title}}` , bookmark . title ) ;
60
60
xml = replace ( xml , `{{description}}` , excerpt ) ;
61
61
xml = replace ( xml , `{{html}}` , bookmark . body ) ;
You can’t perform that action at this time.
0 commit comments