-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db0289b
commit 498754a
Showing
2 changed files
with
26 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
function RawInline (raw) | ||
if raw.format:match 'html' and raw.text == '<?quarto.version?>'then | ||
return tostring(quarto.version) | ||
end | ||
if raw.format:match 'html' and raw.text == '<?lua.date?>'then | ||
return tostring(os.date("%d-%m-%Y")) | ||
end | ||
if raw.format:match 'html' and raw.text == '<?lua.year?>'then | ||
return tostring(os.date("%Y")) | ||
end | ||
if raw.format:match 'html' and raw.text == '<?lua.time?>'then | ||
return tostring(os.date("%H:%M:%S")) | ||
end | ||
end | ||
-- Import the os and io modules | ||
os = require('os') | ||
io = require('io') | ||
|
||
-- The filter function | ||
function Meta(meta) | ||
-- Execute 'quarto version' command and get the output | ||
local quarto_version = io.popen('quarto --version'):read('*all') | ||
if quarto_version then | ||
-- Add the version to the document metadata | ||
meta['quarto_version'] = quarto_version | ||
end | ||
|
||
-- Get the current date and time | ||
local current_date = os.date("%d-%m-%Y") | ||
local current_year = os.date("%Y") | ||
local current_time = os.date("%H:%M:%S") | ||
|
||
-- Add them to the document metadata | ||
meta['current_date'] = current_date | ||
meta['current_year'] = current_year | ||
meta['current_time'] = current_time | ||
|
||
return meta | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters