entry_builders instead of entry_templates

This commit is contained in:
Wuzzy 2016-08-03 00:55:35 +02:00
parent bcdd9427d3
commit 698609945e
2 changed files with 5 additions and 5 deletions

4
API.md
View File

@ -57,11 +57,11 @@ data.
For `build_formspec` you can either define your own function or use one For `build_formspec` you can either define your own function or use one
of the following predefined functions: of the following predefined functions:
* `doc.entry_templates.text`: Expects entry data to be a string. * `doc.entry_builders.text`: Expects entry data to be a string.
It will be inserted directly into the entry. Useful for entries with It will be inserted directly into the entry. Useful for entries with
a freeform text. a freeform text.
* `doc.entry_templates.formspec`: Entry data is expected to contain the * `doc.entry_builders.formspec`: Entry data is expected to contain the
complete entry formspec as a string. Useful if your entries. Useful complete entry formspec as a string. Useful if your entries. Useful
if you expect your entries to differ wildly in layouts. if you expect your entries to differ wildly in layouts.

View File

@ -147,15 +147,15 @@ function doc.get_viewed_count(playername, category_id)
end end
-- Template function templates, to be used for build_formspec in doc.new_category -- Template function templates, to be used for build_formspec in doc.new_category
doc.entry_templates = {} doc.entry_builders = {}
-- Freeform text -- Freeform text
doc.entry_templates.text = function(data) doc.entry_builders.text = function(data)
return "textarea[0.25,0.5;12,8;;"..minetest.formspec_escape(data)..";]" return "textarea[0.25,0.5;12,8;;"..minetest.formspec_escape(data)..";]"
end end
-- Direct formspec -- Direct formspec
doc.entry_templates.formspec = function(data) doc.entry_builders.formspec = function(data)
return data return data
end end