aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorthe-solipsist <the.solipsist@gmail.com>2020-08-26 16:04:14 +0530
committerAlbert Krewinkel <albert+github@zeitkraut.de>2020-08-26 13:36:06 +0200
commit214f2f08e40aed660d2dc76c809ba035656e827f (patch)
tree527cb7a93a06e8ad921d52a688d6c62b050fe0a3 /doc
parent93e3d463fdce74a2f5399a360e4da552ec2fa039 (diff)
downloadpandoc-214f2f08e40aed660d2dc76c809ba035656e827f.tar.gz
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.
Diffstat (limited to 'doc')
-rw-r--r--doc/lua-filters.md8
1 files changed, 5 insertions, 3 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 1862700c9..1cdad7391 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -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
```