summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index 47af07f..84972f3 100644
--- a/init.lua
+++ b/init.lua
@@ -37,11 +37,13 @@ end
function doc.new_entry(category_id, entry_id, def)
local cat = doc.data.categories[category_id]
if cat ~= nil then
- cat.entries[entry_id] = def
- cat.entry_count = doc.data.categories[category_id].entry_count + 1
- if def.hidden then
+ local hidden = def.hidden or (def.hidden == nil and cat.def.hide_entries_by_default)
+ if hidden then
cat.hidden_count = cat.hidden_count + 1
+ def.hidden = hidden
end
+ cat.entry_count = doc.data.categories[category_id].entry_count + 1
+ cat.entries[entry_id] = def
return true
else
return false