Skip to content

Commit 195d0b1

Browse files
committed
Merge pull request #13832 from mcanouil/fix/license-lua-processing
2 parents 1e2e2c4 + 67f955e commit 195d0b1

4 files changed

Lines changed: 35 additions & 2 deletions

File tree

news/changelog-1.9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,4 @@ All changes included in 1.9:
103103
- ([#13528](https://github.com/quarto-dev/quarto-cli/pull/13528)): Adds support for table specification using nested lists and the `list-table` class.
104104
- ([#13575](https://github.com/quarto-dev/quarto-cli/pull/13575)): Improve CPU architecture detection/reporting in macOS to allow quarto to run in virtualized environments such as OpenAI's `codex`.
105105
- ([#13656](https://github.com/quarto-dev/quarto-cli/issues/13656)): Fix R code cells with empty `lang: ""` option producing invalid markdown class attributes.
106+
- ([#13832](https://github.com/quarto-dev/quarto-cli/pull/13832)): Fix `license.text` metadata not being accessible when using an inline license (`license: "text"`), and populate it with the license name for CC licenses instead of empty string. (author: @mcanouil)

src/resources/filters/modules/license.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,14 @@ local function processLicense(el, meta)
8383
if ccLicense ~= nil then
8484
local license = licenses[ccLicense.base]
8585
if license ~= nil then
86+
local licenseText = ''
87+
if ccLicense.base and ccLicense.base ~= '' and ccLicense.version and ccLicense.version ~= '' then
88+
licenseText = ccLicense.base:upper() .. ' ' .. ccLicense.version
89+
end
8690
return {
8791
type = pandoc.Inlines(license.type),
8892
url = pandoc.Inlines(license.licenseUrl(meta.lang, ccLicense.version)),
89-
text = pandoc.Inlines('')
93+
text = pandoc.Inlines(licenseText)
9094
}
9195
end
9296
end
@@ -159,7 +163,7 @@ local function processLicenseMeta(meta)
159163
end
160164
meta[constants.kLicense] = normalizedEls
161165
elseif pandoc.utils.type(licenseMeta) == "Inlines" then
162-
meta[constants.kLicense] = {processLicense(licenseMeta, meta)}
166+
meta[constants.kLicense] = processLicense(licenseMeta, meta)
163167
end
164168
end
165169

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
format: html
3+
license: "CC BY"
4+
_quarto:
5+
tests:
6+
html:
7+
ensureFileRegexMatches:
8+
-
9+
- 'License: CC BY 4\.0'
10+
---
11+
12+
License: {{< meta license.text >}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
format: html
3+
license: "Whatever"
4+
copyright: "2024 My Company"
5+
_quarto:
6+
tests:
7+
html:
8+
ensureFileRegexMatches:
9+
-
10+
- "License: Whatever"
11+
- "Copyright: 2024 My Company"
12+
---
13+
14+
License: {{< meta license.text >}}
15+
16+
Copyright: {{< meta copyright.statement >}}

0 commit comments

Comments
 (0)