File: blog_config.lua

package info (click to toggle)
lua-orbit 2.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 1,956 kB
  • ctags: 638
  • sloc: sql: 78; sh: 32; makefile: 31; xml: 20
file content (157 lines) | stat: -rw-r--r-- 3,795 bytes parent folder | download | duplicates (4)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

blog_title = "Blog"

cache_path = "page_cache"

copyright_notice = "Copyright 2007 Foobar"

about_blurb = [[This is an example of a blog built using Orbit. You
can browse posts and add comments, but to add new posts you have
to go directly to the database. This will be fixed in the future.]]

blogroll = {
  { "http://slashdot.org", "Slashdot"},
  { "http://news.google.com", "Google News" },
  { "http://www.wikipedia.org", "Wikipedia" },
}

-- Uncomment this to send static files through X-Sendfile
-- use_xsendfile = true

database = {
-- driver = "mysql",
-- conn_data = { "blog", "root", "password" }
  driver = "sqlite3",
  conn_data = { real_path .. "/blog.db" }
}

recent_count = 7

strings = {}

strings.pt = {
  home_page_name = "Página Inicial",
  about_title = "Sobre o Blog",
  last_posts = "Últimos Posts",
  blogroll_title = "Links",
  archive_title = "Arquivo",
  anonymous_author = "Anônimo",
  no_posts = "No há posts publicados.",
  published_at = "Publicado às",
  comments = "Comentários",
  written_by = "Escrito por",
  on_date = "em",
  new_comment = "Novo comentário",
  no_comment = "Você esqueceu o comentário!",
  form_name = "Nome:",
  form_email = "Email:",
  form_url = "Site:",
  italics = "itálico",
  bold = "negrito",
  link = "link",
  send = "Enviar"
}

strings.en = {
  home_page_name = "Home Page",
  about_title = "About this Blog",
  last_posts = "Recent Posts",
  blogroll_title = "Links",
  archive_title = "Archives",
  anonymous_author = "Anonymous",
  no_posts = "No published posts.",
  published_at = "Published at",
  comments = "Comments",
  written_by = "Written by",
  on_date = "at",
  new_comment = "New comment",
  no_comment = "You forgot the comment!",
  form_name = "Name:",
  form_email = "Email:",
  form_url = "Site:",
  italics = "italics",
  bold = "bold",
  link = "link",
  send = "Send"
}

language = "en"

strings = strings[language]

months = {}

months.pt = { "Janeiro", "Fevereiro", "Março", "Abril",
    "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro",
    "Novembro", "Dezembro" }

months.en = { "January", "February", "March", "April",
    "May", "June", "July", "August", "September", "October",
    "November", "December" }

weekdays = {}

weekdays.pt = { "Domingo", "Segunda", "Terça", "Quarta",
    "Quinta", "Sexta", "Sábado" }

weekdays.en = { "Sunday", "Monday", "Tuesday", "Wednesday",
    "Thursday", "Friday", "Saturday" }

-- Utility functions

time = {}
date = {}
month = {}

local datetime_mt = { __call = function (tab, date) return tab[language](date) end }

setmetatable(time, datetime_mt)
setmetatable(date, datetime_mt)
setmetatable(month, datetime_mt)

function time.pt(date)
  local time = os.date("%H:%M", date)
  date = os.date("*t", date)
  return date.day .. " de "
    .. months.pt[date.month] .. " de " .. date.year .. " às " .. time
end

function date.pt(date)
  date = os.date("*t", date)
  return weekdays.pt[date.wday] .. ", " .. date.day .. " de "
    .. months.pt[date.month] .. " de " .. date.year
end

function month.pt(month)
  return months.pt[month.month] .. " de " .. month.year
end

local function ordinalize(number)
  if number == 1 then
    return "1st"
  elseif number == 2 then
    return "2nd"
  elseif number == 3 then
    return "3rd"
  else
    return tostring(number) .. "th"
  end
end

function time.en(date)
  local time = os.date("%H:%M", date)
  date = os.date("*t", date)
  return months.en[date.month] .. " " .. ordinalize(date.day) .. " " ..
     date.year .. " at " .. time
end

function date.en(date)
  date = os.date("*t", date)
  return weekdays.en[date.wday] .. ", " .. months.en[date.month] .. " " ..
     ordinalize(date.day) .. " " .. date.year
end

function month.en(month)
  return months.en[month.month] .. " " .. month.year
end