Skip to content

Commit

Permalink
updated xml
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Jun 3, 2024
1 parent 0588e1c commit 4d3f776
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 23 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Go to the `v1` branch to see the changelog of Lume 1.
### Fixed
- Port detection in `lume cms` command.
- Show an error when trying to copy a file from outside the src folder [#610].
- Updated dependencies: `std`, `preact-render-to-string`, `vento`, `lightningcss`, `unocss`, `pug`, `cms`, `liquid`, `lightningcss`, `esbuild`, `react-types`, `deno_dom`, `sass`, `unocss`.
- Updated dependencies: `std`, `preact-render-to-string`, `vento`, `lightningcss`, `unocss`, `pug`, `cms`, `liquid`, `lightningcss`, `esbuild`, `react-types`, `deno_dom`, `sass`, `unocss`, `xml`.

## [2.2.0] - 2024-05-17
[Luísa Villalta](https://galicianliterature.com/villalta) edition.
Expand Down
2 changes: 1 addition & 1 deletion deps/xml.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/x/xml@4.0.0/mod.ts";
export * from "jsr:@libs/xml@5.4.2";
11 changes: 4 additions & 7 deletions plugins/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getExtension } from "../core/utils/path.ts";
import { merge } from "../core/utils/object.ts";
import { getCurrentVersion } from "../core/utils/lume_version.ts";
import { getDataValue } from "../core/utils/data_values.ts";
import { $XML, stringify } from "../deps/xml.ts";
import { cdata, stringify } from "../deps/xml.ts";
import { Page } from "../core/file.ts";

import type Site from "../core/site.ts";
Expand Down Expand Up @@ -212,11 +212,8 @@ function fixUrls(base: URL, html: string): string {

function generateRss(data: FeedData, file: string): string {
const feed = {
[$XML]: { cdata: [["rss", "channel", "item", "content:encoded"]] },
xml: {
"@version": "1.0",
"@encoding": "UTF-8",
},
"@version": "1.0",
"@encoding": "UTF-8",
rss: {
"@xmlns:content": "http://purl.org/rss/1.0/modules/content/",
"@xmlns:wfw": "http://wellformedweb.org/CommentAPI/",
Expand Down Expand Up @@ -246,7 +243,7 @@ function generateRss(data: FeedData, file: string): string {
"#text": item.url,
},
description: item.description,
"content:encoded": item.content,
"content:encoded": cdata(item.content),
pubDate: item.published.toUTCString(),
"atom:updated": item.updated?.toISOString(),
meta: item.image
Expand Down
6 changes: 2 additions & 4 deletions plugins/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ export default function (userOptions?: Options) {

function generateSitemap(pages: Data[]): string {
const sitemap = {
xml: {
"@version": "1.0",
"@encoding": "UTF-8",
},
"@version": "1.0",
"@encoding": "UTF-8",
urlset: {
"@xmlns": "http://www.sitemaps.org/schemas/sitemap/0.9",
"@xmlns:xhtml": "http://www.w3.org/1999/xhtml",
Expand Down
16 changes: 6 additions & 10 deletions tests/__snapshots__/feed.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ snapshot[`RSS plugin 3`] = `
<title>My RSS Feed</title>
<link>https://example.com/</link>
<atom:link href="https://example.com/feed.rss" rel="self" type="application/rss+xml"/>
<description></description>
<description/>
<lastBuildDate>Wed, 01 Jan 2020 00:00:00 GMT</lastBuildDate>
<language>en</language>
<generator>https://lume.land</generator>
Expand All @@ -178,10 +178,8 @@ snapshot[`RSS plugin 3`] = `
<title>PAGE 6</title>
<link>https://example.com/pages/page6/</link>
<guid isPermaLink="false">https://example.com/pages/page6/</guid>
<content:encoded>
<![CDATA[<p>Content of Page 6</p>
]]>
</content:encoded>
<content:encoded><![CDATA[<p>Content of Page 6</p>
]]></content:encoded>
<pubDate>Sat, 01 Jan 2022 00:00:00 GMT</pubDate>
<atom:updated>2022-01-01T00:00:00.000Z</atom:updated>
</item>
Expand Down Expand Up @@ -220,7 +218,7 @@ snapshot[`RSS plugin 3`] = `
<title>My RSS Feed</title>
<link>https://example.com/</link>
<atom:link href="https://example.com/feed.rss" rel="self" type="application/rss+xml"/>
<description></description>
<description/>
<lastBuildDate>Wed, 01 Jan 2020 00:00:00 GMT</lastBuildDate>
<language>en</language>
<generator>https://lume.land</generator>
Expand All @@ -235,10 +233,8 @@ snapshot[`RSS plugin 3`] = `
<title>PAGE 6</title>
<link>https://example.com/pages/page6/</link>
<guid isPermaLink="false">https://example.com/pages/page6/</guid>
<content:encoded>
<![CDATA[<p>Content of Page 6</p>
]]>
</content:encoded>
<content:encoded><![CDATA[<p>Content of Page 6</p>
]]></content:encoded>
<pubDate>Sat, 01 Jan 2022 00:00:00 GMT</pubDate>
<atom:updated>2022-01-01T00:00:00.000Z</atom:updated>
</item>
Expand Down

0 comments on commit 4d3f776

Please sign in to comment.