1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
-- RST
-- format_help.lua
-- ---------------
--
-- Functions used in the ingame help windows for formatting the text and pictures.
-- RST
-- .. function:: dependencies(images[, text = nil])
--
-- Creates a dependencies line of any length.
--
-- :arg images: images in the correct order from left to right as table (set in {}).
-- :arg text: comment of the image.
-- :returns: a row of pictures connected by arrows.
--
function dependencies(images, text)
if not text then
text = ""
end
string = "image=" .. images[1]
for k,v in ipairs({unpack(images,2)}) do
string = string .. ";pics/arrow-right.png;" .. v
end
return rt(string, text)
end
-- RST
-- .. function:: image_line(image, count[, text = nil])
--
-- Aligns the image to a row on the right side with text on the left.
--
-- :arg image: the picture to be aligned to a row.
-- :arg count: length of the picture row.
-- :arg text: if given the text aligned on the left side, formatted via
-- formatting.lua functions.
-- :returns: the text on the left and a picture row on the right.
--
function image_line(image, count, text)
local imgs={}
for i=1,count do
imgs[#imgs + 1] = image
end
local imgstr = table.concat(imgs, ";")
if text then
return rt("image=" .. imgstr .. " image-align=right", " " .. text)
else
return rt("image=" .. imgstr .. " image-align=right", "")
end
end
-- RST
-- .. function text_line(t1, t2[, imgstr = nil])
--
-- Creates a line of h3 formatted text followed by normal text and an image.
--
-- :arg t1: text in h3 format.
-- :arg t2: text in p format.
-- :arg imgstr: image aligned right.
-- :returns: header followed by normal text and image.
--
function text_line(t1, t2, imgstr)
if imgstr then
return "<rt text-align=left image=" .. imgstr .. " image-align=right><p font-size=13 font-color=D1D1D1>" .. t1 .. "</p><p line-spacing=3 font-size=12>" .. t2 .. "<br></p><p font-size=8> <br></p></rt>"
else
return "<rt text-align=left><p font-size=13 font-color=D1D1D1>" .. t1 .. "</p><p line-spacing=3 font-size=12>" .. t2 .. "<br></p><p font-size=8> <br></p></rt>"
end
end
-- Tabs für die Hilfe, weiß aber nicht, ob das wirklich so funktionieren kann,
-- oder wie ich das eigentlich anwenden muss… Oder was ich falsch mache…
function make_tabs_array(t1, t2)
return { {
text = t1,
tab_picture = "pics/small.png", -- Graphic for the tab button
},
{
text = t2,
tab_picture = "pics/medium.png",
}
}
end
|