Christian Fraß commited on 2018-08-22 10:21:45
Zeige 20 geänderte Dateien mit 32 Einfügungen und 1326 Löschungen.
... | ... |
@@ -1,9 +1,3 @@ |
1 |
-<?php |
|
2 |
- global $configuration; |
|
3 |
- include_once("source/logic/server/table.php"); |
|
4 |
- include_once("source/logic/server/data.php"); |
|
5 |
- include_once("source/logic/server/misc.php"); |
|
6 |
- ?> |
|
7 | 1 |
<section class="section" id="conjugation"> |
8 | 2 |
<header>Conjugation</header> |
9 | 3 |
<p>In Folksprak verbs are not conjugated for different participants (<span class="grammarterm">personae</span>), number of actors (<span class="grammarterm">numeri</span>) or grammatical genders (<span class="grammarterm">genera</span>).</p> |
... | ... |
@@ -2,7 +2,7 @@ |
2 | 2 |
<header>Modal verbs</header> |
3 | 3 |
{{call::_proposal.html.tpl}} |
4 | 4 |
<p>The following verbs are modal verbs in Folksprak:</p> |
5 |
- <ul>{{list:section-modal_verbs.list:modal_verbs-list.html.tpl}}</ul> |
|
5 |
+ <ul>{{list:section-modal_verbs.list:modal_verbs-listentry.html.tpl}}</ul> |
|
6 | 6 |
<p>Modal verbs in contrast to normal verbs never take an extended infinitive as object, e.g. {{fsdraft_format_correlation:section-modal_verbs.example1:type_sentence}}, but {{fsdraft_format_correlation:section-modal_verbs.example2:type_sentence}}</p> |
7 | 7 |
<p>The special modal verb <span class="type_word lang_flk">vöre</span> is used for expressing the subjunctive.</p> |
8 | 8 |
</section> |
... | ... |
@@ -1,79 +0,0 @@ |
1 |
-"use strict"; |
|
2 |
- |
|
3 |
-class class_format |
|
4 |
-{ |
|
5 |
- constructor(title, extract, format = function (x) {return x;}) |
|
6 |
- { |
|
7 |
- this.title = title; |
|
8 |
- this.extract = extract; |
|
9 |
- this.format = tormat; |
|
10 |
- } |
|
11 |
-} |
|
12 |
- |
|
13 |
-class class_table |
|
14 |
-{ |
|
15 |
- constructor(columns, rows = []) |
|
16 |
- { |
|
17 |
- this.columns = columns; |
|
18 |
- this.rows = rows; |
|
19 |
- } |
|
20 |
- |
|
21 |
- add(row) |
|
22 |
- { |
|
23 |
- this.rows.push(row); |
|
24 |
- } |
|
25 |
- |
|
26 |
- fill(rows) |
|
27 |
- { |
|
28 |
- rows.forEach(row => this.add(row)); |
|
29 |
- } |
|
30 |
- |
|
31 |
- generate() |
|
32 |
- { |
|
33 |
- let dom_table = document.createElement("table"); |
|
34 |
- { |
|
35 |
- let dom_thead = document.createElement("thead"); |
|
36 |
- [null].forEach |
|
37 |
- ( |
|
38 |
- function (dummy) |
|
39 |
- { |
|
40 |
- let dom_row = document.createElement("tr"); |
|
41 |
- this.columns.forEach |
|
42 |
- ( |
|
43 |
- function (column) |
|
44 |
- { |
|
45 |
- let dom_cell = document.createElement("th"); |
|
46 |
- dom_cell.textContent = column.title; |
|
47 |
- dom_row.appendChild(dom_cell); |
|
48 |
- } |
|
49 |
- ); |
|
50 |
- dom_thead.appendChild(dom_row); |
|
51 |
- } |
|
52 |
- ); |
|
53 |
- dom_table.appendChild(dom_thead); |
|
54 |
- } |
|
55 |
- { |
|
56 |
- let dom_thead = document.createElement("tbody"); |
|
57 |
- this.rows.forEach |
|
58 |
- ( |
|
59 |
- function (row) |
|
60 |
- { |
|
61 |
- let dom_row = document.createElement("tr"); |
|
62 |
- this.columns.forEach |
|
63 |
- ( |
|
64 |
- function (column) |
|
65 |
- { |
|
66 |
- let dom_cell = document.createElement("td"); |
|
67 |
- dom_cell.textContent = column.format(column.extract(row)); |
|
68 |
- dom_row.appendChild(dom_cell); |
|
69 |
- } |
|
70 |
- ); |
|
71 |
- dom_thead.appendChild(dom_row); |
|
72 |
- } |
|
73 |
- ); |
|
74 |
- dom_table.appendChild(dom_tbody); |
|
75 |
- } |
|
76 |
- return dom_table; |
|
77 |
- } |
|
78 |
-} |
|
79 |
- |
... | ... |
@@ -2,7 +2,7 @@ |
2 | 2 |
|
3 | 3 |
function add_tooltips() |
4 | 4 |
{ |
5 |
- for (let dom_node of document.querySelectorAll(".word_fs")) |
|
5 |
+ for (let dom_node of document.querySelectorAll(".type_word.lang_flk")) |
|
6 | 6 |
{ |
7 | 7 |
let url = "http://folksprak.org/munin.php?query=translation_fs_" + dom_node.textContent + "_en"; |
8 | 8 |
load_file |
... | ... |
@@ -1,15 +0,0 @@ |
1 |
-<?php |
|
2 |
- function read_json($path) |
|
3 |
- { |
|
4 |
- $content = file_get_contents($path); |
|
5 |
- $object = json_decode($content, true); |
|
6 |
- if ($object == null) |
|
7 |
- { |
|
8 |
- throw (new Exception("invalid json-file '" . $path . "'")); |
|
9 |
- } |
|
10 |
- return $object; |
|
11 |
- } |
|
12 |
-?> |
|
13 |
- |
|
14 |
- |
|
15 |
- |
... | ... |
@@ -1,52 +0,0 @@ |
1 |
-<?php |
|
2 |
- |
|
3 |
-/** |
|
4 |
- */ |
|
5 |
-function list_group($list, $collation = null) |
|
6 |
- { |
|
7 |
- if ($collation == null) |
|
8 |
- { |
|
9 |
- $collation = (function ($x, $y) {return ($x == $y);}); |
|
10 |
- } |
|
11 |
- $groups = []; |
|
12 |
- foreach ($list as $element) |
|
13 |
- { |
|
14 |
- $found = false; |
|
15 |
- $group = null; |
|
16 |
- foreach ($groups as $group_) |
|
17 |
- { |
|
18 |
- if ($collation($group_[0], $element)) |
|
19 |
- { |
|
20 |
- $group = $group_; |
|
21 |
- $found = true; |
|
22 |
- break; |
|
23 |
- } |
|
24 |
- } |
|
25 |
- if (! $found) |
|
26 |
- { |
|
27 |
- $group = []; |
|
28 |
- } |
|
29 |
- array_push($group, $element); |
|
30 |
- if (! $found) |
|
31 |
- { |
|
32 |
- array_push($groups, $group); |
|
33 |
- } |
|
34 |
- } |
|
35 |
- return $groups; |
|
36 |
- } |
|
37 |
- |
|
38 |
- |
|
39 |
-/** |
|
40 |
- */ |
|
41 |
-function list_clean($list, $collation = null) |
|
42 |
- { |
|
43 |
- return ( |
|
44 |
- array_map |
|
45 |
- ( |
|
46 |
- function ($group) {return $group[0];}, |
|
47 |
- list_group($list, $collation) |
|
48 |
- ) |
|
49 |
- ); |
|
50 |
- } |
|
51 |
- |
|
52 |
- ?> |
... | ... |
@@ -1,234 +0,0 @@ |
1 |
-<?php |
|
2 |
- function function_feed($value) |
|
3 |
- { |
|
4 |
- return ( |
|
5 |
- function ($function) use (&$value) |
|
6 |
- { |
|
7 |
- return $function($value); |
|
8 |
- } |
|
9 |
- ); |
|
10 |
- } |
|
11 |
- |
|
12 |
- function function_compose($function1, $function2) |
|
13 |
- { |
|
14 |
- return ( |
|
15 |
- function ($value) use (&$function1, &$function2) |
|
16 |
- { |
|
17 |
- return ($function2($function1($value))); |
|
18 |
- } |
|
19 |
- ); |
|
20 |
- } |
|
21 |
- |
|
22 |
- function function_chain($functions) |
|
23 |
- { |
|
24 |
- return ( |
|
25 |
- function ($value) use (&$functions) |
|
26 |
- { |
|
27 |
- /* |
|
28 |
- return array_reduce($functions, function ($x, $y) {call_user_func("function_compose", $x, $y);}, $value); |
|
29 |
- */ |
|
30 |
- return ((count($functions) == 0) ? $value : function_feed($functions[0]($value))(function_chain(array_slice($functions, 1)))); |
|
31 |
- } |
|
32 |
- ); |
|
33 |
- } |
|
34 |
- |
|
35 |
- function object_from_array($key_name) |
|
36 |
- { |
|
37 |
- return ( |
|
38 |
- function ($list) use (&$key_name) |
|
39 |
- { |
|
40 |
- $object = []; |
|
41 |
- foreach ($list as $element) |
|
42 |
- { |
|
43 |
- $key = $element[$key_name]; |
|
44 |
- $object[$key] = $element; |
|
45 |
- } |
|
46 |
- return $object; |
|
47 |
- } |
|
48 |
- ); |
|
49 |
- } |
|
50 |
- |
|
51 |
- function object_attribute($name) |
|
52 |
- { |
|
53 |
- return ( |
|
54 |
- function ($object) use (&$name) |
|
55 |
- { |
|
56 |
- return $object[$name]; |
|
57 |
- } |
|
58 |
- ); |
|
59 |
- } |
|
60 |
- |
|
61 |
- function object_map($function) |
|
62 |
- { |
|
63 |
- return ( |
|
64 |
- function ($object) use (&$function) |
|
65 |
- { |
|
66 |
- $object_ = []; |
|
67 |
- foreach ($object as $key => $value) |
|
68 |
- { |
|
69 |
- $object_[$key] = $function($value); |
|
70 |
- } |
|
71 |
- return $object_; |
|
72 |
- } |
|
73 |
- ); |
|
74 |
- } |
|
75 |
- |
|
76 |
- function fetch($structure, $field, $fallback = null, $escalation = 1) |
|
77 |
- { |
|
78 |
- if (array_key_exists($field, $structure)) |
|
79 |
- { |
|
80 |
- return $structure[$field]; |
|
81 |
- } |
|
82 |
- else |
|
83 |
- { |
|
84 |
- switch ($escalation) |
|
85 |
- { |
|
86 |
- case 0: |
|
87 |
- { |
|
88 |
- return $fallback; |
|
89 |
- // break; |
|
90 |
- } |
|
91 |
- case 1: |
|
92 |
- { |
|
93 |
- return $fallback; |
|
94 |
- // break; |
|
95 |
- } |
|
96 |
- case 2: |
|
97 |
- { |
|
98 |
- throw (sprintf("field '%s' missing in structure!", $field)); |
|
99 |
- return $fallback; |
|
100 |
- // break; |
|
101 |
- } |
|
102 |
- default: |
|
103 |
- { |
|
104 |
- throw (sprintf("unhandled escalation level %u", $escalation)); |
|
105 |
- // break; |
|
106 |
- } |
|
107 |
- } |
|
108 |
- } |
|
109 |
- } |
|
110 |
- |
|
111 |
- function compose($names) |
|
112 |
- { |
|
113 |
- array_map |
|
114 |
- ( |
|
115 |
- function ($name) |
|
116 |
- { |
|
117 |
- include("source/content/" . $name . ".html.php"); |
|
118 |
- }, |
|
119 |
- $names |
|
120 |
- ); |
|
121 |
- } |
|
122 |
- |
|
123 |
- function mark($core, $classes) |
|
124 |
- { |
|
125 |
- global $configuration; |
|
126 |
- if ($configuration["replace_fs_umlauts"]) |
|
127 |
- { |
|
128 |
- if (in_array("lang_fs", $classes) and !in_array("letter", $classes)) |
|
129 |
- { |
|
130 |
- $core = str_replace |
|
131 |
- ( |
|
132 |
- ["ö","ü"], |
|
133 |
- ["oy","uy"], |
|
134 |
- $core |
|
135 |
- ); |
|
136 |
- } |
|
137 |
- } |
|
138 |
- return ('<span class="' . implode(" ", $classes) . '">' . $core . '</span>'); |
|
139 |
- } |
|
140 |
- |
|
141 |
- function format($string, $classes = ["type_word", "lang_fs"]) |
|
142 |
- { |
|
143 |
- if ($string == NULL) |
|
144 |
- { |
|
145 |
- $string = "--"; |
|
146 |
- } |
|
147 |
- else |
|
148 |
- { |
|
149 |
- $string = preg_replace("/\/([^\/]*)\//", mark("$1", ["ipa"]), $string); |
|
150 |
- $string = preg_replace("/_([^_]*)_/", "<u>$1</u>", $string); |
|
151 |
- $string = preg_replace("/\'([^\']*)\'/", mark("$1", $classes), $string); |
|
152 |
- } |
|
153 |
- return $string; |
|
154 |
- } |
|
155 |
- |
|
156 |
- function _foo($fieldname) |
|
157 |
- { |
|
158 |
- return ( |
|
159 |
- function ($row) use (&$fieldname) |
|
160 |
- { |
|
161 |
- global $configuration; |
|
162 |
- return ["original" => $row[$fieldname]["flk"], "translated" => $row[$fieldname][$configuration["target"]]]; |
|
163 |
- } |
|
164 |
- ); |
|
165 |
- } |
|
166 |
- |
|
167 |
- function _baz($words, $type, $language) |
|
168 |
- { |
|
169 |
- return ((count($words) == 0) ? "?" : implode(", ", array_map(function ($word) use (&$type,&$language) {return mark($word, [$type, "lang_" . $language]);}, $words))); |
|
170 |
- } |
|
171 |
- |
|
172 |
- function _bar($type = "type_word") |
|
173 |
- { |
|
174 |
- return ( |
|
175 |
- function ($value) use (&$type) |
|
176 |
- { |
|
177 |
- global $configuration; |
|
178 |
- $output = ""; |
|
179 |
- $output .= _baz($value["original"], $type, "flk"); |
|
180 |
- $output .= " ~ "; |
|
181 |
- $output .= _baz($value["translated"], $type, $configuration["target"]); |
|
182 |
- return $output; |
|
183 |
- } |
|
184 |
- ); |
|
185 |
- } |
|
186 |
- |
|
187 |
- function format_single($type, $language) |
|
188 |
- { |
|
189 |
- return ( |
|
190 |
- function ($piece) use (&$type, &$language) |
|
191 |
- { |
|
192 |
- return mark($piece, [$type, "lang_" . $language]); |
|
193 |
- } |
|
194 |
- ); |
|
195 |
- } |
|
196 |
- |
|
197 |
- function format_list($type, $language) |
|
198 |
- { |
|
199 |
- return ( |
|
200 |
- function ($pieces) use (&$type, &$language) |
|
201 |
- { |
|
202 |
- return ((count($pieces) == 0) ? "?" : implode(", ", array_map(format_single($type, $language), $pieces))); |
|
203 |
- } |
|
204 |
- ); |
|
205 |
- } |
|
206 |
- |
|
207 |
- function format_correlation($type, $language_from = "flk", $language_to = null) |
|
208 |
- { |
|
209 |
- global $configuration; |
|
210 |
- if ($language_to == null) $language_to = $configuration["target"]; |
|
211 |
- return ( |
|
212 |
- function ($source) use (&$type, &$language_from, &$language_to) |
|
213 |
- { |
|
214 |
- $output = ""; |
|
215 |
- $output .= format_list($type, $language_from)($source[$language_from]); |
|
216 |
- $output .= " ~ "; |
|
217 |
- $output .= format_list($type, $language_to)($source[$language_to]); |
|
218 |
- return $output; |
|
219 |
- } |
|
220 |
- ); |
|
221 |
- } |
|
222 |
- |
|
223 |
- function proposal() |
|
224 |
- { |
|
225 |
- ?> |
|
226 |
- <div class="note note_error"> |
|
227 |
- <span class="note_content"> |
|
228 |
- <p>This section is only a proposal yet; not part of the draft.</p> |
|
229 |
- </span> |
|
230 |
- </div> |
|
231 |
-<?php |
|
232 |
- } |
|
233 |
- ?> |
|
234 |
- |
... | ... |
@@ -1,180 +0,0 @@ |
1 |
-<?php |
|
2 |
- function sql_cross($table_left, $table_right) |
|
3 |
- { |
|
4 |
- $table_result = []; |
|
5 |
- array_map |
|
6 |
- ( |
|
7 |
- function ($row_left) use (&$table_left,&$table_right,&$table_result) |
|
8 |
- { |
|
9 |
- array_map |
|
10 |
- ( |
|
11 |
- function ($row_right) use (&$table_left,&$table_right,&$table_result,&$row_left) |
|
12 |
- { |
|
13 |
- $row_result = []; |
|
14 |
- foreach ($row_left as $key_left => $value_left) $row_result[$key_left] = $value_left; |
|
15 |
- foreach ($row_right as $key_right => $value_right) $row_result[$key_right] = $value_right; |
|
16 |
- array_push($table_result, $row_result); |
|
17 |
- }, |
|
18 |
- $table_right |
|
19 |
- ); |
|
20 |
- }, |
|
21 |
- $table_left |
|
22 |
- ); |
|
23 |
- return $table_result; |
|
24 |
- } |
|
25 |
- |
|
26 |
- function sql_cross_all($tables_source) |
|
27 |
- { |
|
28 |
- $n = count($tables_source); |
|
29 |
- if ($n == 1) |
|
30 |
- { |
|
31 |
- return $tables_source[0]; |
|
32 |
- } |
|
33 |
- else |
|
34 |
- { |
|
35 |
- return sql_cross(sql_cross_all(array_slice($tables_source, $n-1)), $tables_source[$n-1]); |
|
36 |
- } |
|
37 |
- } |
|
38 |
- |
|
39 |
- function sql_project($table_source, $columns) |
|
40 |
- { |
|
41 |
- return ( |
|
42 |
- array_map |
|
43 |
- ( |
|
44 |
- function ($row_in) use (&$columns) |
|
45 |
- { |
|
46 |
- $row_out = []; |
|
47 |
- foreach ($row_in as $key_in => $value_in) |
|
48 |
- { |
|
49 |
- if (array_search($key_in, $columns) !== false) |
|
50 |
- { |
|
51 |
- $row_out[$key_in] = $value_in; |
|
52 |
- } |
|
53 |
- } |
|
54 |
- return $row_out; |
|
55 |
- }, |
|
56 |
- $table_source |
|
57 |
- ) |
|
58 |
- ); |
|
59 |
- } |
|
60 |
- |
|
61 |
- function sql_order($table_source, $order) |
|
62 |
- { |
|
63 |
- usort |
|
64 |
- ( |
|
65 |
- $table_source, |
|
66 |
- $order |
|
67 |
- ); |
|
68 |
- return $table_source; |
|
69 |
- } |
|
70 |
- |
|
71 |
- function sql_condense($table_source, $columns_from, $columns_to, $condensators) |
|
72 |
- { |
|
73 |
- return ( |
|
74 |
- array_map |
|
75 |
- ( |
|
76 |
- function ($row_in) use (&$columns_from,&$columns_to,&$condensators) |
|
77 |
- { |
|
78 |
- $row_out = []; |
|
79 |
- $values = []; |
|
80 |
- foreach ($row_in as $column => $value) |
|
81 |
- { |
|
82 |
- if (array_search($column, $columns_from) === false) |
|
83 |
- { |
|
84 |
- $row_out[$column] = $row_in[$column]; |
|
85 |
- } |
|
86 |
- else |
|
87 |
- { |
|
88 |
- $values[$column] = $value; |
|
89 |
- } |
|
90 |
- } |
|
91 |
- foreach ($columns_to as $column) |
|
92 |
- { |
|
93 |
- $row_out[$column] = (array_key_exists($column, $condensators) ? $condensators[$column]($values) : null); |
|
94 |
- } |
|
95 |
- return $row_out; |
|
96 |
- }, |
|
97 |
- $table_source |
|
98 |
- ) |
|
99 |
- ); |
|
100 |
- } |
|
101 |
- |
|
102 |
- function sql_delete($table_source, $columns) |
|
103 |
- { |
|
104 |
- return sql_condense($table_source, $columns, [], []); |
|
105 |
- } |
|
106 |
- |
|
107 |
- function sql_add($table_source, $columns, $assigners = []) |
|
108 |
- { |
|
109 |
- return sql_condense($table_source, [], $columns, $assigners); |
|
110 |
- } |
|
111 |
- |
|
112 |
- function sql_rename($table_source, $column_from, $column_to) |
|
113 |
- { |
|
114 |
- return sql_condense($table_source, [$column_from], [$column_to], [$column_to => function ($values) use (&$column_from) {return $values[$column_from];}]); |
|
115 |
- } |
|
116 |
- |
|
117 |
- function sql_select($table_source, $predicate) |
|
118 |
- { |
|
119 |
- return array_filter($table_source, $predicate); |
|
120 |
- } |
|
121 |
- |
|
122 |
- function sql_groups($table_source, $column, $extraction = null) |
|
123 |
- { |
|
124 |
- if ($extraction == null) $extraction = (function ($column, $row) {return $row[$column];}); |
|
125 |
- $groups = []; |
|
126 |
- array_map |
|
127 |
- ( |
|
128 |
- function ($row_source) use (&$table_source,&$column,&$extraction,&$groups) |
|
129 |
- { |
|
130 |
- $value = $extraction($column, $row_source); |
|
131 |
- $group = null; |
|
132 |
- $index = null; |
|
133 |
- // foreach ($groups as $group_) |
|
134 |
- for ($index_ = 0; $index_ < count($groups); $index_ += 1) |
|
135 |
- { |
|
136 |
- $group_ = $groups[$index_]; |
|
137 |
- if ($group_["value"] == $value) |
|
138 |
- { |
|
139 |
- $group = $group_; |
|
140 |
- $index = $index_; |
|
141 |
- break; |
|
142 |
- } |
|
143 |
- } |
|
144 |
- if ($group == null) |
|
145 |
- { |
|
146 |
- $group = ["value" => $value, "members" => []]; |
|
147 |
- $index = count($groups); |
|
148 |
- array_push($groups, $group); |
|
149 |
- } |
|
150 |
- // array_push($group["members"], $row_source); |
|
151 |
- array_push($groups[$index]["members"], $row_source); |
|
152 |
- }, |
|
153 |
- $table_source |
|
154 |
- ); |
|
155 |
- return $groups; |
|
156 |
- } |
|
157 |
- |
|
158 |
- function sql_groupify($table_source, $column, $aggregators) |
|
159 |
- { |
|
160 |
- $groups = sql_groups($table_source, $column); |
|
161 |
- $table_result = array_map |
|
162 |
- ( |
|
163 |
- function ($group) use (&$column,&$aggregators) |
|
164 |
- { |
|
165 |
- $row_result = []; |
|
166 |
- $row_result[$column] = $group["value"]; |
|
167 |
- foreach ($aggregators as $aggregator_key => $aggregator_value) |
|
168 |
- { |
|
169 |
- $args = array_map(function ($member) use (&$aggregator_key) {return $member[$aggregator_key];}, $group["members"]); |
|
170 |
- $row_result[$aggregator_key] = $aggregator_value($args); |
|
171 |
- } |
|
172 |
- return $row_result; |
|
173 |
- }, |
|
174 |
- $groups |
|
175 |
- ); |
|
176 |
- return $table_result; |
|
177 |
- } |
|
178 |
- |
|
179 |
- ?> |
|
180 |
- |
... | ... |
@@ -1,361 +0,0 @@ |
1 |
-<?php |
|
2 |
-include_once("misc.php"); |
|
3 |
-include_once("list.php"); |
|
4 |
- |
|
5 |
-/** |
|
6 |
- */ |
|
7 |
-class class_column |
|
8 |
- { |
|
9 |
- |
|
10 |
- /** |
|
11 |
- */ |
|
12 |
- public $title; |
|
13 |
- |
|
14 |
- |
|
15 |
- /** |
|
16 |
- */ |
|
17 |
- public $field; |
|
18 |
- |
|
19 |
- |
|
20 |
- /** |
|
21 |
- */ |
|
22 |
- public $format_; |
|
23 |
- |
|
24 |
- |
|
25 |
- /** |
|
26 |
- */ |
|
27 |
- public function __construct($title, $field, $format_ = null) |
|
28 |
- { |
|
29 |
- if ($format_ == null) $format_ = function ($x) {return $x;}; |
|
30 |
- $this->title = $title; |
|
31 |
- $this->field = $field; |
|
32 |
- $this->format_ = $format_; |
|
33 |
- } |
|
34 |
- |
|
35 |
- |
|
36 |
- /** |
|
37 |
- */ |
|
38 |
- public function extract($row) |
|
39 |
- { |
|
40 |
- // return call_user_func($this->extract_, $row); |
|
41 |
- return $row[$this->field]; |
|
42 |
- // return $this->extract_($row); |
|
43 |
- } |
|
44 |
- |
|
45 |
- |
|
46 |
- /** |
|
47 |
- */ |
|
48 |
- public function format($value) |
|
49 |
- { |
|
50 |
- return call_user_func($this->format_, $value); |
|
51 |
- // return $this->format_($value); |
|
52 |
- } |
|
53 |
- |
|
54 |
- } |
|
55 |
- |
|
56 |
- |
|
57 |
-/** |
|
58 |
- */ |
|
59 |
-class class_table |
|
60 |
- { |
|
61 |
- |
|
62 |
- /** |
|
63 |
- */ |
|
64 |
- private $columns; |
|
65 |
- |
|
66 |
- |
|
67 |
- /** |
|
68 |
- */ |
|
69 |
- private $rows; |
|
70 |
- |
|
71 |
- |
|
72 |
- /** |
|
73 |
- */ |
|
74 |
- public function __construct($columns, $rows = []) |
|
75 |
- { |
|
76 |
- $this->columns = $columns; |
|
77 |
- $this->rows = []; |
|
78 |
- $this->fill($rows); |
|
79 |
- } |
|
80 |
- |
|
81 |
- |
|
82 |
- /** |
|
83 |
- */ |
|
84 |
- public function columns_get() |
|
85 |
- { |
|
86 |
- return $this->columns; |
|
87 |
- } |
|
88 |
- |
|
89 |
- |
|
90 |
- /** |
|
91 |
- */ |
|
92 |
- private function add($row) |
|
93 |
- { |
|
94 |
- array_push($this->rows, $row); |
|
95 |
- } |
|
96 |
- |
|
97 |
- |
|
98 |
- /** |
|
99 |
- */ |
|
100 |
- private function fill($rows) |
|
101 |
- { |
|
102 |
- array_map |
|
103 |
- ( |
|
104 |
- function ($row) {$this->add($row);}, |
|
105 |
- $rows |
|
106 |
- ) |
|
107 |
- ; |
|
108 |
- } |
|
109 |
- |
|
110 |
- /* |
|
111 |
- +------+------+------+ |
|
112 |
- | xA | xB | xC | |
|
113 |
- +------+------+------+ |
|
114 |
- | a2 | b1 | c3 | |
|
115 |
- +------+------+------+ |
|
116 |
- | a1 | b1 | c0 | |
|
117 |
- +------+------+------+ |
|
118 |
- | a1 | b3 | c2 | |
|
119 |
- +------+------+------+ |
|
120 |
- | a2 | b2 | c4 | |
|
121 |
- +------+------+------+ |
|
122 |
- | a1 | b2 | c1 | |
|
123 |
- +------+------+------+ |
|
124 |
- | a2 | b4 | c5 | |
|
125 |
- +------+------+------+ |
|
126 |
- |
|
127 |
- +------+------+------+ |
|
128 |
- | xA | xB | xC | |
|
129 |
- +------+------+------+ |
|
130 |
- | a1 | b1 | c0 | |
|
131 |
- +------+------+------+ |
|
132 |
- | a1 | b2 | c1 | |
|
133 |
- +------+------+------+ |
|
134 |
- | a1 | b3 | c2 | |
|
135 |
- +------+------+------+ |
|
136 |
- | a2 | b1 | c3 | |
|
137 |
- +------+------+------+ |
|
138 |
- | a2 | b2 | c4 | |
|
139 |
- +------+------+------+ |
|
140 |
- | a2 | b4 | c5 | |
|
141 |
- +------+------+------+ |
|
142 |
- |
|
143 |
- +------+------+------+ |
|
144 |
- | xA | xB | xC | |
|
145 |
- +------+------+------+ |
|
146 |
- | a1 | b1 | c0 | |
|
147 |
- | +------+------+ |
|
148 |
- | | b2 | c1 | |
|
149 |
- | +------+------+ |
|
150 |
- | | b3 | c2 | |
|
151 |
- +------+------+------+ |
|
152 |
- | a2 | b1 | c3 | |
|
153 |
- | +------+------+ |
|
154 |
- | | b2 | c4 | |
|
155 |
- | +------+------+ |
|
156 |
- | | b4 | c5 | |
|
157 |
- +------+------+------+ |
|
158 |
- |
|
159 |
- +------+------+------+------+------+ |
|
160 |
- | xA | xB:b1| xB:b2| xB:b3| xB:b4| |
|
161 |
- +------+------+------+------+------+ |
|
162 |
- | a1 | c0 | c1 | c2 | -- | |
|
163 |
- +------+------+------+------+------+ |
|
164 |
- | a2 | c3 | c4 | -- | c5 | |
|
165 |
- +------+------+------+------+------+ |
|
166 |
- */ |
|
167 |
- public function snap($configuration) |
|
168 |
- { |
|
169 |
- $columns_vertical = fetch($configuration, "columns_vertical", null, 2); |
|
170 |
- $columns_horizontal = fetch($configuration, "columns_horizontal", null, 2); |
|
171 |
- $columns_data = fetch($configuration, "columns_data", null, 2); |
|
172 |
- $data_aggregator = fetch($configuration, "data_aggregator", function ($values) {return /*json_encode(*/$values/*)*/;}, 1); |
|
173 |
- |
|
174 |
- $columns_source = |
|
175 |
- [ |
|
176 |
- new class_column("Vertical", "_vertical"), |
|
177 |
- new class_column("Horizontal", "_horizontal"), |
|
178 |
- new class_column("Data", "_data", function ($x) {return json_encode($x);}), |
|
179 |
- ] |
|
180 |
- ; |
|
181 |
- // gather data for the three columns |
|
182 |
- $rows_source = array_map |
|
183 |
- ( |
|
184 |
- function ($row) use (&$columns_vertical, &$columns_horizontal, &$columns_data, $data_aggregator) |
|
185 |
- { |
|
186 |
- $raw_vertical = array_map(function ($column) use (&$row) {return $column->extract($row);}, $columns_vertical); |
|
187 |
- $raw_horizontal = array_map(function ($column) use (&$row) {return $column->extract($row);}, $columns_horizontal); |
|
188 |
- $raw_data = []; foreach ($columns_data as $column) $raw_data[$column->field] = $column->extract($row); |
|
189 |
- $row_ = []; |
|
190 |
- $row_["_vertical"] = implode("/", $raw_vertical); |
|
191 |
- $row_["_horizontal"] = implode("/", $raw_horizontal); |
|
192 |
- $row_["_data"] = $data_aggregator($raw_data); |
|
193 |
- return $row_; |
|
194 |
- } |
|
195 |
- , |
|
196 |
- $this->rows |
|
197 |
- ) |
|
198 |
- ; |
|
199 |
- // return (new class_table($columns_source, $rows_source)); |
|
200 |
- // find groups |
|
201 |
- $values = list_clean |
|
202 |
- ( |
|
203 |
- array_map |
|
204 |
- ( |
|
205 |
- function ($row) use (&$columns_source) {return $columns_source[1]->extract($row);}, |
|
206 |
- $rows_source |
|
207 |
- ) |
|
208 |
- ) |
|
209 |
- ; |
|
210 |
- $count = 0; |
|
211 |
- $columns_result = array_merge |
|
212 |
- ( |
|
213 |
- [ |
|
214 |
- new class_column |
|
215 |
- ( |
|
216 |
- fetch |
|
217 |
- ( |
|
218 |
- $configuration, |
|
219 |
- "label_vertical", |
|
220 |
- function ($columns) {return implode("/", array_map(function ($column) {return $column->title;}, $columns));}, |
|
221 |
- 1 |
|
222 |
- ) |
|
223 |
- ($columns_vertical) |
|
224 |
- , |
|
225 |
- "vertical" |
|
226 |
- ) |
|
227 |
- ], |
|
228 |
- array_map |
|
229 |
- ( |
|
230 |
- function ($value) use (&$configuration, &$columns_horizontal, &$count) |
|
231 |
- { |
|
232 |
- $count += 1; |
|
233 |
- return ( |
|
234 |
- new class_column |
|
235 |
- ( |
|
236 |
- fetch |
|
237 |
- ( |
|
238 |
- $configuration, |
|
239 |
- "label_horizontal", |
|
240 |
- function ($columns, $value) {return implode("/", array_map(function ($column) {return $column->title;}, $columns)) . ":" . $value;}, |
|
241 |
- 1 |
|
242 |
- ) |
|
243 |
- ($columns_horizontal, $value) |
|
244 |
- , |
|
245 |
- sprintf("horizontal_%u", $count-1), |
|
246 |
- fetch($configuration, "data_formatter", function ($x) {return json_encode($x);}, 1) |
|
247 |
- ) |
|
248 |
- ); |
|
249 |
- } |
|
250 |
- , |
|
251 |
- $values |
|
252 |
- ) |
|
253 |
- ) |
|
254 |
- ; |
|
255 |
- $rows_result = array_map |
|
256 |
- ( |
|
257 |
- function ($group) use (&$columns_vertical, &$columns_horizontal, &$columns_data, &$columns_source, &$columns_result, &$values) |
|
258 |
- { |
|
259 |
- $row = []; |
|
260 |
- { |
|
261 |
- $row["vertical"] = $group["value"]; |
|
262 |
- } |
|
263 |
- for ($index = 0; $index < count($columns_result); ++$index) |
|
264 |
- { |
|
265 |
- $row[sprintf("horizontal_%u", $index)] = []; |
|
266 |
- } |
|
267 |
- foreach ($group["members"] as $member) |
|
268 |
- { |
|
269 |
- $value = $columns_source[1]->extract($member); |
|
270 |
- $data = $columns_source[2]->extract($member); |
|
271 |
- $index = array_search($value, $values); |
|
272 |
- if ($index === false) |
|
273 |
- { |
|
274 |
- throw ("fatal error"); |
|
275 |
- } |
|
276 |
- else |
|
277 |
- { |
|
278 |
- $field = sprintf("horizontal_%u", $index); |
|
279 |
- array_push($row[$field], $data); |
|
280 |
- } |
|
281 |
- } |
|
282 |
- return $row; |
|
283 |
- } |
|
284 |
- , |
|
285 |
- sql_groups($rows_source, "_vertical") |
|
286 |
- ) |
|
287 |
- ; |
|
288 |
- return (new class_table($columns_result, $rows_result)); |
|
289 |
- } |
|
290 |
- |
|
291 |
- |
|
292 |
- /** |
|
293 |
- */ |
|
294 |
- public function generate() |
|
295 |
- { |
|
296 |
- ?> |
|
297 |
-<table class="datatable"> |
|
298 |
- <thead> |
|
299 |
- <tr> |
|
300 |
-<?php |
|
301 |
- array_map |
|
302 |
- ( |
|
303 |
- function ($column) |
|
304 |
- { |
|
305 |
- ?> |
|
306 |
- <th> |
|
307 |
-<?php |
|
308 |
- echo($column->title); |
|
309 |
- ?> |
|
310 |
- </th> |
|
311 |
-<?php |
|
312 |
- } |
|
313 |
- , |
|
314 |
- $this->columns |
|
315 |
- ) |
|
316 |
- ; |
|
317 |
- ?> |
|
318 |
- </tr> |
|
319 |
- </thead> |
|
320 |
- <tbody> |
|
321 |
-<?php |
|
322 |
- array_map |
|
323 |
- ( |
|
324 |
- function ($row) |
|
325 |
- { |
|
326 |
- ?> |
|
327 |
- <tr> |
|
328 |
-<?php |
|
329 |
- array_map |
|
330 |
- ( |
|
331 |
- function ($column) use (&$row) |
|
332 |
- { |
|
333 |
- ?> |
|
334 |
- <td> |
|
335 |
-<?php |
|
336 |
- echo($column->format($column->extract($row))); |
|
337 |
- ?> |
|
338 |
- </td> |
|
339 |
-<?php |
|
340 |
- } |
|
341 |
- , |
|
342 |
- $this->columns |
|
343 |
- ) |
|
344 |
- ; |
|
345 |
- ?> |
|
346 |
- </tr> |
|
347 |
-<?php |
|
348 |
- } |
|
349 |
- , |
|
350 |
- $this->rows |
|
351 |
- ) |
|
352 |
- ; |
|
353 |
- ?> |
|
354 |
- </tbody> |
|
355 |
-</table> |
|
356 |
-<?php |
|
357 |
- } |
|
358 |
- } |
|
359 |
- |
|
360 |
- ?> |
|
361 |
- |
... | ... |
@@ -1,273 +0,0 @@ |
1 |
- |
|
2 |
- |
|
3 |
- |
|
4 |
- |
|
5 |
- |
|
6 |
- |
|
7 |
-<table class="datatable"> |
|
8 |
- <thead> |
|
9 |
- <tr> |
|
10 |
- <th> |
|
11 |
- </th> |
|
12 |
- <th> |
|
13 |
-singular/impersonal/common </th> |
|
14 |
- <th> |
|
15 |
-singular/1st/common </th> |
|
16 |
- <th> |
|
17 |
-singular/2nd/common </th> |
|
18 |
- <th> |
|
19 |
-singular/3rd/common </th> |
|
20 |
- <th> |
|
21 |
-singular/3rd/masculine </th> |
|
22 |
- <th> |
|
23 |
-singular/3rd/feminine </th> |
|
24 |
- <th> |
|
25 |
-singular/3rd/neuter </th> |
|
26 |
- <th> |
|
27 |
-plural/impersonal/common </th> |
|
28 |
- <th> |
|
29 |
-plural/1st/common </th> |
|
30 |
- <th> |
|
31 |
-plural/2nd/common </th> |
|
32 |
- <th> |
|
33 |
-plural/3rd/common </th> |
|
34 |
- </tr> |
|
35 |
- </thead> |
|
36 |
- <tbody> |
|
37 |
- <tr> |
|
38 |
- <td> |
|
39 |
-normal/nominative </td> |
|
40 |
- <td> |
|
41 |
-<span class="words lang_fs">man</span> ~ <span class="words lang_">one</span>, <span class="words lang_">you</span> </td> |
|
42 |
- <td> |
|
43 |
-<span class="words lang_fs">ek</span> ~ <span class="words lang_">i</span> </td> |
|
44 |
- <td> |
|
45 |
-<span class="words lang_fs">du</span> ~ <span class="words lang_">you</span>, <span class="words lang_">thou</span> </td> |
|
46 |
- <td> |
|
47 |
-<span class="words lang_fs">hen</span> ~ ? </td> |
|
48 |
- <td> |
|
49 |
-<span class="words lang_fs">han</span> ~ <span class="words lang_">he</span> </td> |
|
50 |
- <td> |
|
51 |
-<span class="words lang_fs">hun</span> ~ <span class="words lang_">she</span> </td> |
|
52 |
- <td> |
|
53 |
-<span class="words lang_fs">hit</span> ~ <span class="words lang_">it</span> </td> |
|
54 |
- <td> |
|
55 |
-<span class="words lang_fs">maner</span> ~ <span class="words lang_">you</span>, <span class="words lang_">they</span> </td> |
|
56 |
- <td> |
|
57 |
-<span class="words lang_fs">vi</span> ~ <span class="words lang_">we</span> </td> |
|
58 |
- <td> |
|
59 |
-<span class="words lang_fs">je</span> ~ <span class="words lang_">you (all)</span> </td> |
|
60 |
- <td> |
|
61 |
-<span class="words lang_fs">di</span> ~ <span class="words lang_">they</span> </td> |
|
62 |
- </tr> |
|
63 |
- <tr> |
|
64 |
- <td> |
|
65 |
-normal/accusative </td> |
|
66 |
- <td> |
|
67 |
-<span class="words lang_fs">man</span> ~ <span class="words lang_">one</span>, <span class="words lang_">you</span> </td> |
|
68 |
- <td> |
|
69 |
-<span class="words lang_fs">mek</span> ~ <span class="words lang_">me</span> </td> |
|
70 |
- <td> |
|
71 |
-<span class="words lang_fs">dek</span> ~ <span class="words lang_">you</span>, <span class="words lang_">thee</span> </td> |
|
72 |
- <td> |
|
73 |
-<span class="words lang_fs">hen</span> ~ ? </td> |
|
74 |
- <td> |
|
75 |
-<span class="words lang_fs">han</span> ~ <span class="words lang_">him</span> </td> |
|
76 |
- <td> |
|
77 |
-<span class="words lang_fs">hun</span> ~ <span class="words lang_">her</span> </td> |
|
78 |
- <td> |
|
79 |
-<span class="words lang_fs">hit</span> ~ <span class="words lang_">it</span> </td> |
|
80 |
- <td> |
|
81 |
-<span class="words lang_fs">maner</span> ~ <span class="words lang_">you</span>, <span class="words lang_">them</span> </td> |
|
82 |
- <td> |
|
83 |
-<span class="words lang_fs">us</span> ~ <span class="words lang_">us</span> </td> |
|
84 |
- <td> |
|
85 |
-<span class="words lang_fs">ju</span> ~ <span class="words lang_">you (all)</span> </td> |
|
86 |
- <td> |
|
87 |
-<span class="words lang_fs">dim</span> ~ <span class="words lang_">them</span> </td> |
|
88 |
- </tr> |
|
89 |
- <tr> |
|
90 |
- <td> |
|
91 |
-normal/dative </td> |
|
92 |
- <td> |
|
93 |
-<span class="words lang_fs">to man</span> ~ <span class="words lang_">to one</span>, <span class="words lang_">to you</span> </td> |
|
94 |
- <td> |
|
95 |
-<span class="words lang_fs">to mek</span> ~ <span class="words lang_">to me</span> </td> |
|
96 |
- <td> |
|
97 |
-<span class="words lang_fs">to dek</span> ~ <span class="words lang_">to you</span>, <span class="words lang_">to thee</span> </td> |
|
98 |
- <td> |
|
99 |
-<span class="words lang_fs">to hen</span> ~ ? </td> |
|
100 |
- <td> |
|
101 |
-<span class="words lang_fs">to han</span> ~ <span class="words lang_">to him</span> </td> |
|
102 |
- <td> |
|
103 |
-<span class="words lang_fs">to hun</span> ~ <span class="words lang_">to her</span> </td> |
|
104 |
- <td> |
|
105 |
-<span class="words lang_fs">to hit</span> ~ <span class="words lang_">to it</span> </td> |
|
106 |
- <td> |
|
107 |
-<span class="words lang_fs">to maner</span> ~ <span class="words lang_">to you</span>, <span class="words lang_">to them</span> </td> |
|
108 |
- <td> |
|
109 |
-<span class="words lang_fs">to us</span> ~ <span class="words lang_">to us</span> </td> |
|
110 |
- <td> |
|
111 |
-<span class="words lang_fs">to ju</span> ~ <span class="words lang_">to you (all)</span> </td> |
|
112 |
- <td> |
|
113 |
-<span class="words lang_fs">to dim</span> ~ <span class="words lang_">to them</span> </td> |
|
114 |
- </tr> |
|
115 |
- <tr> |
|
116 |
- <td> |
|
117 |
-reflexive/accusative </td> |
|
118 |
- <td> |
|
119 |
-<span class="words lang_fs">sek</span> ~ <span class="words lang_">oneself</span>, <span class="words lang_">yourself</span> </td> |
|
120 |
- <td> |
|
121 |
-<span class="words lang_fs">mek</span> ~ <span class="words lang_">myself</span> </td> |
|
122 |
- <td> |
|
123 |
-<span class="words lang_fs">dek</span> ~ <span class="words lang_">yourself</span> </td> |
|
124 |
- <td> |
|
125 |
-<span class="words lang_fs">sek</span> ~ ? </td> |
|
126 |
- <td> |
|
127 |
-<span class="words lang_fs">sek</span> ~ <span class="words lang_">himself</span> </td> |
|
128 |
- <td> |
|
129 |
-<span class="words lang_fs">sek</span> ~ <span class="words lang_">herself</span> </td> |
|
130 |
- <td> |
|
131 |
-<span class="words lang_fs">sek</span> ~ <span class="words lang_">itself</span> </td> |
|
132 |
- <td> |
|
133 |
-<span class="words lang_fs">maner</span> ~ <span class="words lang_">themselves</span>, <span class="words lang_">yourselves</span> </td> |
|
134 |
- <td> |
|
135 |
-<span class="words lang_fs">us</span> ~ <span class="words lang_">ourselves</span> </td> |
|
136 |
- <td> |
|
137 |
-<span class="words lang_fs">ju</span> ~ <span class="words lang_">yourselves</span> </td> |
|
138 |
- <td> |
|
139 |
-<span class="words lang_fs">sek</span> ~ <span class="words lang_">themselves</span> </td> |
|
140 |
- </tr> |
|
141 |
- <tr> |
|
142 |
- <td> |
|
143 |
-reflexive/dative </td> |
|
144 |
- <td> |
|
145 |
-<span class="words lang_fs">to sek</span> ~ <span class="words lang_">to oneself</span>, <span class="words lang_">to yourself</span> </td> |
|
146 |
- <td> |
|
147 |
-<span class="words lang_fs">to mek</span> ~ <span class="words lang_">to myself</span> </td> |
|
148 |
- <td> |
|
149 |
-<span class="words lang_fs">to dek</span> ~ <span class="words lang_">to yourself</span> </td> |
|
150 |
- <td> |
|
151 |
-<span class="words lang_fs">to sek</span> ~ ? </td> |
|
152 |
- <td> |
|
153 |
-<span class="words lang_fs">to sek</span> ~ <span class="words lang_">to himself</span> </td> |
|
154 |
- <td> |
|
155 |
-<span class="words lang_fs">to sek</span> ~ <span class="words lang_">to herself</span> </td> |
|
156 |
- <td> |
|
157 |
-<span class="words lang_fs">to sek</span> ~ <span class="words lang_">to itself</span> </td> |
|
158 |
- <td> |
|
159 |
-<span class="words lang_fs">to sek</span> ~ <span class="words lang_">to themselves</span>, <span class="words lang_">to yourselves</span> </td> |
|
160 |
- <td> |
|
161 |
-<span class="words lang_fs">to us</span> ~ <span class="words lang_">to ourselves</span> </td> |
|
162 |
- <td> |
|
163 |
-<span class="words lang_fs">to ju</span> ~ <span class="words lang_">to yourselves</span> </td> |
|
164 |
- <td> |
|
165 |
-<span class="words lang_fs">to sek</span> ~ <span class="words lang_">to themselves</span> </td> |
|
166 |
- </tr> |
|
167 |
- <tr> |
|
168 |
- <td> |
|
169 |
-possesive/nominative </td> |
|
170 |
- <td> |
|
171 |
-<span class="words lang_fs">mans</span> ~ <span class="words lang_">ones</span>, <span class="words lang_">your</span> </td> |
|
172 |
- <td> |
|
173 |
-<span class="words lang_fs">min</span> ~ <span class="words lang_">my</span> </td> |
|
174 |
- <td> |
|
175 |
-<span class="words lang_fs">din</span> ~ <span class="words lang_">your</span> </td> |
|
176 |
- <td> |
|
177 |
-<span class="words lang_fs">hens</span> ~ ? </td> |
|
178 |
- <td> |
|
179 |
-<span class="words lang_fs">hans</span> ~ <span class="words lang_">his</span> </td> |
|
180 |
- <td> |
|
181 |
-<span class="words lang_fs">huns</span> ~ <span class="words lang_">her</span> </td> |
|
182 |
- <td> |
|
183 |
-<span class="words lang_fs">hits</span> ~ <span class="words lang_">its</span> </td> |
|
184 |
- <td> |
|
185 |
-<span class="words lang_fs">maners</span> ~ <span class="words lang_">their</span>, <span class="words lang_">your</span> </td> |
|
186 |
- <td> |
|
187 |
-<span class="words lang_fs">ur</span> ~ <span class="words lang_">our</span> </td> |
|
188 |
- <td> |
|
189 |
-<span class="words lang_fs">jer</span> ~ <span class="words lang_">your</span> </td> |
|
190 |
- <td> |
|
191 |
-<span class="words lang_fs">dir</span> ~ <span class="words lang_">their</span> </td> |
|
192 |
- </tr> |
|
193 |
- <tr> |
|
194 |
- <td> |
|
195 |
-possesive/accusative </td> |
|
196 |
- <td> |
|
197 |
-<span class="words lang_fs">mans</span> ~ <span class="words lang_">ones</span>, <span class="words lang_">your</span> </td> |
|
198 |
- <td> |
|
199 |
-<span class="words lang_fs">min</span> ~ <span class="words lang_">my</span> </td> |
|
200 |
- <td> |
|
201 |
-<span class="words lang_fs">din</span> ~ <span class="words lang_">your</span> </td> |
|
202 |
- <td> |
|
203 |
-<span class="words lang_fs">hens</span> ~ ? </td> |
|
204 |
- <td> |
|
205 |
-<span class="words lang_fs">hans</span> ~ <span class="words lang_">his</span> </td> |
|
206 |
- <td> |
|
207 |
-<span class="words lang_fs">huns</span> ~ <span class="words lang_">her</span> </td> |
|
208 |
- <td> |
|
209 |
-<span class="words lang_fs">hits</span> ~ <span class="words lang_">its</span> </td> |
|
210 |
- <td> |
|
211 |
-<span class="words lang_fs">maners</span> ~ <span class="words lang_">their</span>, <span class="words lang_">your</span> </td> |
|
212 |
- <td> |
|
213 |
-<span class="words lang_fs">ur</span> ~ <span class="words lang_">our</span> </td> |
|
214 |
- <td> |
|
215 |
-<span class="words lang_fs">jer</span> ~ <span class="words lang_">your</span> </td> |
|
216 |
- <td> |
|
217 |
-<span class="words lang_fs">dir</span> ~ <span class="words lang_">their</span> </td> |
|
218 |
- </tr> |
|
219 |
- <tr> |
|
220 |
- <td> |
|
221 |
-possesive/dative </td> |
|
222 |
- <td> |
|
223 |
-<span class="words lang_fs">to mans</span> ~ <span class="words lang_">to ones</span>, <span class="words lang_">to your</span> </td> |
|
224 |
- <td> |
|
225 |
-<span class="words lang_fs">to min</span> ~ <span class="words lang_">to my</span> </td> |
|
226 |
- <td> |
|
227 |
-<span class="words lang_fs">to din</span> ~ <span class="words lang_">to your</span> </td> |
|
228 |
- <td> |
|
229 |
-<span class="words lang_fs">to hens</span> ~ ? </td> |
|
230 |
- <td> |
|
231 |
-<span class="words lang_fs">to hans</span> ~ <span class="words lang_">to his</span> </td> |
|
232 |
- <td> |
|
233 |
-<span class="words lang_fs">to huns</span> ~ <span class="words lang_">to her</span> </td> |
|
234 |
- <td> |
|
235 |
-<span class="words lang_fs">to hits</span> ~ <span class="words lang_">to its</span> </td> |
|
236 |
- <td> |
|
237 |
-<span class="words lang_fs">to maners</span> ~ <span class="words lang_">to their</span>, <span class="words lang_">to your</span> </td> |
|
238 |
- <td> |
|
239 |
-<span class="words lang_fs">to ur</span> ~ <span class="words lang_">to our</span> </td> |
|
240 |
- <td> |
|
241 |
-<span class="words lang_fs">to jer</span> ~ <span class="words lang_">to your</span> </td> |
|
242 |
- <td> |
|
243 |
-<span class="words lang_fs">to dir</span> ~ <span class="words lang_">to their</span> </td> |
|
244 |
- </tr> |
|
245 |
- <tr> |
|
246 |
- <td> |
|
247 |
-possesive/genitive </td> |
|
248 |
- <td> |
|
249 |
-<span class="words lang_fs">av mans</span> ~ <span class="words lang_">of ones</span>, <span class="words lang_">of your</span> </td> |
|
250 |
- <td> |
|
251 |
-<span class="words lang_fs">av min</span> ~ <span class="words lang_">of my</span> </td> |
|
252 |
- <td> |
|
253 |
-<span class="words lang_fs">av din</span> ~ <span class="words lang_">of your</span> </td> |
|
254 |
- <td> |
|
255 |
-<span class="words lang_fs">av hens</span> ~ ? </td> |
|
256 |
- <td> |
|
257 |
-<span class="words lang_fs">av hans</span> ~ <span class="words lang_">of his</span> </td> |
|
258 |
- <td> |
|
259 |
-<span class="words lang_fs">av huns</span> ~ <span class="words lang_">of her</span> </td> |
|
260 |
- <td> |
|
261 |
-<span class="words lang_fs">av hits</span> ~ <span class="words lang_">of its</span> </td> |
|
262 |
- <td> |
|
263 |
-<span class="words lang_fs">av maners</span> ~ <span class="words lang_">of their</span>, <span class="words lang_">of your</span> </td> |
|
264 |
- <td> |
|
265 |
-<span class="words lang_fs">av ur</span> ~ <span class="words lang_">of our</span> </td> |
|
266 |
- <td> |
|
267 |
-<span class="words lang_fs">av jer</span> ~ <span class="words lang_">of your</span> </td> |
|
268 |
- <td> |
|
269 |
-<span class="words lang_fs">av dir</span> ~ <span class="words lang_">of their</span> </td> |
|
270 |
- </tr> |
|
271 |
- </tbody> |
|
272 |
-</table> |
|
273 |
- |
... | ... |
@@ -1,99 +0,0 @@ |
1 |
-<?php |
|
2 |
- include_once("data.php"); |
|
3 |
- include_once("sql.php"); |
|
4 |
- include_once("table.php"); |
|
5 |
- |
|
6 |
- $data_common = read_json("../../data/common.json"); |
|
7 |
- $data_pronouns = read_json("../../data/personal_pronouns.json"); |
|
8 |
- |
|
9 |
- $data = $data_pronouns["words"]; |
|
10 |
- { |
|
11 |
- { |
|
12 |
- $data = sql_cross($data, $data_common["counts"]); |
|
13 |
- $data = sql_select($data, function ($row) {return ($row["count_id"] == $row["id"]);}); |
|
14 |
- $data = sql_delete($data, ["count_id", "id"]); |
|
15 |
- $data = sql_rename($data, "name", "count_name"); |
|
16 |
- } |
|
17 |
- { |
|
18 |
- $data = sql_cross($data, $data_common["persons"]); |
|
19 |
- $data = sql_select($data, function ($row) {return ($row["person_id"] == $row["id"]);}); |
|
20 |
- $data = sql_delete($data, ["person_id", "id"]); |
|
21 |
- $data = sql_rename($data, "name", "person_name"); |
|
22 |
- } |
|
23 |
- { |
|
24 |
- $data = sql_cross($data, $data_common["genders"]); |
|
25 |
- $data = sql_select($data, function ($row) {return ($row["gender_id"] == $row["id"]);}); |
|
26 |
- $data = sql_delete($data, ["gender_id", "id"]); |
|
27 |
- $data = sql_rename($data, "name", "gender_name"); |
|
28 |
- } |
|
29 |
- { |
|
30 |
- $data = sql_cross($data, $data_pronouns["types"]); |
|
31 |
- $data = sql_select($data, function ($row) {return ($row["type_id"] == $row["id"]);}); |
|
32 |
- $data = sql_delete($data, ["type_id", "id"]); |
|
33 |
- $data = sql_rename($data, "name", "type_name"); |
|
34 |
- } |
|
35 |
- { |
|
36 |
- $data = sql_cross($data, $data_common["cases"]); |
|
37 |
- $data = sql_select($data, function ($row) {return ($row["case_id"] == $row["id"]);}); |
|
38 |
- $data = sql_delete($data, ["case_id", "id"]); |
|
39 |
- $data = sql_rename($data, "name", "case_name"); |
|
40 |
- } |
|
41 |
- } |
|
42 |
- |
|
43 |
- $table = new class_table |
|
44 |
- ( |
|
45 |
- [ |
|
46 |
- new class_column("Language", "language_id"), |
|
47 |
- new class_column("Count", "count_name"), |
|
48 |
- new class_column("Person", "person_name"), |
|
49 |
- new class_column("Gender", "gender_name"), |
|
50 |
- new class_column("Type", "type_name"), |
|
51 |
- new class_column("Case", "case_name"), |
|
52 |
- new class_column("Words", "words", function ($x) {return json_encode($x);}), |
|
53 |
- ], |
|
54 |
- $data |
|
55 |
- ); |
|
56 |
- |
|
57 |
- $table = $table->snap |
|
58 |
- ( |
|
59 |
- [ |
|
60 |
- "label_vertical" => function ($column) {return "";}, |
|
61 |
- "columns_vertical" => |
|
62 |
- [ |
|
63 |
- $table->columns_get()[4], |
|
64 |
- $table->columns_get()[5], |
|
65 |
- ], |
|
66 |
- "label_horizontal" => function ($column, $value) {return $value;}, |
|
67 |
- "columns_horizontal" => |
|
68 |
- [ |
|
69 |
- $table->columns_get()[1], |
|
70 |
- $table->columns_get()[2], |
|
71 |
- $table->columns_get()[3], |
|
72 |
- ], |
|
73 |
- "columns_data" => |
|
74 |
- [ |
|
75 |
- $table->columns_get()[0], |
|
76 |
- $table->columns_get()[6], |
|
77 |
- ], |
|
78 |
- "data_aggregator" => function ($values) |
|
79 |
- { |
|
80 |
- return $values; |
|
81 |
- }, |
|
82 |
- "data_formatter" => function ($value) |
|
83 |
- { |
|
84 |
- return ( |
|
85 |
- _bar("words") |
|
86 |
- ( |
|
87 |
- [ |
|
88 |
- "original" => $value[0]["words"], |
|
89 |
- "translated" => $value[1]["words"], |
|
90 |
- ] |
|
91 |
- ) |
|
92 |
- ); |
|
93 |
- return json_encode($value); |
|
94 |
- }, |
|
95 |
- ] |
|
96 |
- ); |
|
97 |
- $table->generate(); |
|
98 |
-?> |
|
99 |
- |
... | ... |
@@ -19,12 +19,19 @@ |
19 | 19 |
"source/data/texts.json", |
20 | 20 |
"source/data/timeforms.json", |
21 | 21 |
"source/data/transitions.json", |
22 |
+ "source/data/section-adpositions.json", |
|
23 |
+ "source/data/section-cases.json", |
|
24 |
+ "source/data/section-declension.json", |
|
25 |
+ "source/data/section-definiteness.json", |
|
26 |
+ "source/data/section-infinite_verbforms.json", |
|
27 |
+ "source/data/section-modal_verbs.json", |
|
28 |
+ "source/data/section-negation.json", |
|
29 |
+ "source/data/section-numeri.json", |
|
30 |
+ "source/data/section-personal_pronouns.json", |
|
31 |
+ "source/data/section-preface.json", |
|
32 |
+ "source/data/section-tempora_and_modi.json", |
|
33 |
+ "source/data/section-word_functions.json", |
|
22 | 34 |
"source/data/word_functions.json", |
23 |
- "source/logic/server/misc.php", |
|
24 |
- "source/logic/server/data.php", |
|
25 |
- "source/logic/server/settings.php", |
|
26 |
- "source/logic/server/table.php", |
|
27 |
- "source/logic/server/sql.php", |
|
28 | 35 |
"source/content/_meta.html.tpl", |
29 | 36 |
"source/content/_proposal.html.tpl", |
30 | 37 |
"source/content/introduction.html.tpl", |
... | ... |
@@ -39,6 +46,7 @@ |
39 | 46 |
"source/content/conjugation.html.tpl", |
40 | 47 |
"source/content/infinite_verbforms.html.tpl", |
41 | 48 |
"source/content/modal_verbs.html.tpl", |
49 |
+ "source/content/modal_verbs-listentry.html.tpl", |
|
42 | 50 |
"source/content/tempora_and_modi.html.tpl", |
43 | 51 |
"source/content/negation.html.tpl", |
44 | 52 |
"source/content/declension.html.tpl", |
... | ... |
@@ -50,12 +58,14 @@ |
50 | 58 |
"source/content/vocabulary.html.tpl", |
51 | 59 |
"source/content/principles.html.tpl", |
52 | 60 |
"source/content/word_functions.html.tpl", |
61 |
+ "source/content/word_functions-listentry.html.tpl", |
|
53 | 62 |
"source/content/adpositions.html.tpl", |
54 | 63 |
"source/content/pronouns.html.tpl", |
55 | 64 |
"source/content/dictionary.html.tpl", |
56 | 65 |
"source/content/examples.html.tpl", |
57 | 66 |
"source/content/example_sentences.html.tpl", |
58 | 67 |
"source/content/example_texts.html.tpl", |
68 |
+ "source/content/example_texts-paragraph.html.tpl", |
|
59 | 69 |
"source/content/draft.html.tpl" |
60 | 70 |
], |
61 | 71 |
"outputs": [ |
... | ... |
@@ -69,10 +79,9 @@ |
69 | 79 |
"type": "concat", |
70 | 80 |
"parameters": { |
71 | 81 |
"inputs": [ |
72 |
- "source/logic/client/tools.js", |
|
73 |
- "source/logic/client/table.js", |
|
74 |
- "source/logic/client/toc.js", |
|
75 |
- "source/logic/client/main.js" |
|
82 |
+ "source/logic/tools.js", |
|
83 |
+ "source/logic/toc.js", |
|
84 |
+ "source/logic/main.js" |
|
76 | 85 |
], |
77 | 86 |
"output": "build/draft.js" |
78 | 87 |
} |
... | ... |
@@ -1,6 +1,10 @@ |
1 | 1 |
"use strict"; |
2 | 2 |
exports.__esModule = true; |
3 | 3 |
|
4 |
+ |
|
5 |
+/** |
|
6 |
+ * @author kcf |
|
7 |
+ */ |
|
4 | 8 |
const configuration = { |
5 | 9 |
"replace_fs_umlauts": false, |
6 | 10 |
"target": "eng", |
... | ... |
@@ -14,8 +18,13 @@ function mark( |
14 | 18 |
core, |
15 | 19 |
classes |
16 | 20 |
) { |
21 |
+ const contains = ((list, entry) => (list.indexOf(entry) >= 0)); |
|
17 | 22 |
if (configuration["replace_fs_umlauts"]) { |
18 |
- if ((classes.indexOf("lang_fs") >= 0) && (classes.indexOf("letter") < 0)) { |
|
23 |
+ if ( |
|
24 |
+ contains(classes, "lang_flk") |
|
25 |
+ && |
|
26 |
+ ! contains(classes, "type_letter") |
|
27 |
+ ) { |
|
19 | 28 |
core = ( |
20 | 29 |
core |
21 | 30 |
.replace(new RegExp("ö", "g"), "oy") |
22 | 31 |