An example of how to use Sputnik as a module, e.g. to render all the pages into HTML:
First, create an instance of Sputnik passing all necessary configurations:
yuri@chai:~/sputnik$ ./bin/lua
Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio
> require'luarocks.require'
> require'sputnik'
> s = sputnik.new{
VERSIUM_PARAMS = {"/home/yuri/sputnik/wiki-data/"},
BASE_URL = "",
TOKEN_SALT = "",
}
Now, let's just list the nodes:
> for i, n in ipairs(s:get_node_names()) do print(n) end
@Lua_Config
index
@Root
Let's load them:
> for i, n in ipairs(s:get_node_names()) do print(s:get_node(n)) end
table: 0x81bd058
table: 0x817e838
table: 0x8103f78
table: 0x80c6f60
table: 0x81be9d8
table: 0x80f3d30
table: 0x81d7ee8
table: 0x82adee0
table: 0x80f5d78
Let's print the content of one of them:
> = s:get_node(s:get_node_names()[2]).content
Congratulations, you just installed [Sputnik](http://www.freewisdom.org/projects/sputnik/)!
What's next?
First, check if you edit pages. (Click "Edit" on this page.) You ...
Now, let's render the HTML for that node:
> n = s:get_node("index")
> n = s:decorate_node(n)
> =type(n.actions.show_content)
function
> =n.actions.show_content(n, {params={}}, s)
<p>Congratulations, you just installed <a href="http://www.freewis...
<p>What's next? </p>
<p>First, check if you edit pages. (Click "Edit" on this page.) Yo...
<p>After that, you can do some customizations. Edit the <a href='/...
<p>Also, edit the <a href='/sputnik.lua?p=_navigation' class='local...
<p>test</p>