mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-29 01:41:20 +08:00
Make the setting-the-date example conditional
This makes the example a bit more realistic/valuable by checking if the metadata value "date" is already present, before changing the value.
This commit is contained in:
committed by
Albert Krewinkel
parent
93e3d463fd
commit
214f2f08e4
+5
-3
@@ -362,12 +362,14 @@ end
|
||||
## Setting the date in the metadata
|
||||
|
||||
This filter sets the date in the document's metadata to the
|
||||
current date:
|
||||
current date, if a date isn't already set:
|
||||
|
||||
``` lua
|
||||
function Meta(m)
|
||||
m.date = os.date("%B %e, %Y")
|
||||
return m
|
||||
if m.date == nil then
|
||||
m.date = os.date("%B %e, %Y")
|
||||
return m
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user