Christian Fraß commited on 2018-08-22 18:04:02
Zeige 26 geänderte Dateien mit 728 Einfügungen und 761 Löschungen.
... | ... |
@@ -4,15 +4,8 @@ |
4 | 4 |
<!-- |
5 | 5 |
<li>The following list gives an overview over prepositions:</li> |
6 | 6 |
--> |
7 |
- {{fold:adpositions.words:situation_id:type_id/reference_id}} |
|
7 |
+ {{fsdraft-table-2d:adpositions.words:situation_id:type_id/reference_id}} |
|
8 | 8 |
<p>Some examples:</p> |
9 |
- <ul> |
|
10 |
- <li>{{fsdraft_format_correlation:section-adpositions.examples.0:type_sentence}}</li> |
|
11 |
- <li>{{fsdraft_format_correlation:section-adpositions.examples.1:type_sentence}}</li> |
|
12 |
- <li>{{fsdraft_format_correlation:section-adpositions.examples.2:type_sentence}}</li> |
|
13 |
- <li>{{fsdraft_format_correlation:section-adpositions.examples.3:type_sentence}}</li> |
|
14 |
- <li>{{fsdraft_format_correlation:section-adpositions.examples.4:type_sentence}}</li> |
|
15 |
- <li>{{fsdraft_format_correlation:section-adpositions.examples.5:type_sentence}}</li> |
|
16 |
- </ul> |
|
9 |
+ <ul>{{list:section-adpositions.examples:adpositions-example.html.tpl}}</ul> |
|
17 | 10 |
</section> |
18 | 11 |
|
... | ... |
@@ -2,7 +2,7 @@ |
2 | 2 |
<header>Cases</header> |
3 | 3 |
<p>Regular nouns can appear in two cases: <span class="grammarterm">nominative</span> and <span class="grammarterm">genitive</span>.</p> |
4 | 4 |
<p>The base form of a noun is the nominative, which does not receive any marker.</p> |
5 |
- <p>The genitive is formed by appending the suffix <span class="type_word lang_flk">-(e)s</span> to the word, e.g. {{fsdraft_format_correlation:section-cases.example1:type_word}}. The marker for the plural has to be applied first, e.g. {{fsdraft_format_correlation:section-cases.example2:type_word}}.</p> |
|
5 |
+ <p>The genitive is formed by appending the suffix <span class="type_word lang_flk">-(e)s</span> to the word, e.g. {{fsdraft-correlation:section-cases.example1:type_word}}. The marker for the plural has to be applied first, e.g. {{fsdraft-correlation:section-cases.example2:type_word}}.</p> |
|
6 | 6 |
<p></p> |
7 | 7 |
</section> |
8 | 8 |
|
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
<section class="subsection" id="correlatives"> |
2 | 2 |
<header>Correlatives</header> |
3 | 3 |
{{call::_proposal.html.tpl}} |
4 |
- {{fold:correlatives.words:domain_id:type_id}} |
|
4 |
+ {{fsdraft-table-2d:correlatives.words:domain_id:type_id}} |
|
5 | 5 |
<div class="note note_information"> |
6 | 6 |
<span class="note_content"> |
7 | 7 |
<p>Some of these words are very unlikely to ever get used (e.g. <span class="type_word lang_flk">ni slag</span>). Nevertheless they exist and are listed for completeness.</p> |
... | ... |
@@ -4,134 +4,7 @@ |
4 | 4 |
{{call::cases.html.tpl}} |
5 | 5 |
{{call::definiteness.html.tpl}} |
6 | 6 |
<p>The following table summarizes the information of this section:</p> |
7 |
-<?php |
|
8 |
- $data_common = read_json("source/data/common.json"); |
|
9 |
- $data_declension = read_json("source/data/declension.json"); |
|
10 |
- |
|
11 |
- $data = $data_declension["words"]; |
|
12 |
- { |
|
13 |
- { |
|
14 |
- if (true) |
|
15 |
- { |
|
16 |
- $data = sql_cross($data, $data_common["counts"]); |
|
17 |
- $data = sql_select($data, function ($row) {return ($row["count_id"] == $row["id"]);}); |
|
18 |
- $data = sql_delete($data, ["count_id", "id"]); |
|
19 |
- $data = sql_rename($data, "name", "count_name"); |
|
20 |
- } |
|
21 |
- else |
|
22 |
- { |
|
23 |
- $data = sql_rename($data, "count_id", "count_name"); |
|
24 |
- } |
|
25 |
- } |
|
26 |
- { |
|
27 |
- if (true) |
|
28 |
- { |
|
29 |
- $data = sql_cross($data, $data_common["definitenesses"]); |
|
30 |
- $data = sql_select($data, function ($row) {return ($row["definiteness_id"] == $row["id"]);}); |
|
31 |
- $data = sql_delete($data, ["definiteness_id", "id"]); |
|
32 |
- $data = sql_rename($data, "name", "definiteness_name"); |
|
33 |
- } |
|
34 |
- else |
|
35 |
- { |
|
36 |
- $data = sql_rename($data, "definiteness_id", "definiteness_name"); |
|
37 |
- } |
|
38 |
- } |
|
39 |
- { |
|
40 |
- if (true) |
|
41 |
- { |
|
42 |
- $data = sql_cross($data, $data_common["cases"]); |
|
43 |
- $data = sql_select($data, function ($row) {return ($row["case_id"] == $row["id"]);}); |
|
44 |
- $data = sql_delete($data, ["case_id", "id"]); |
|
45 |
- $data = sql_rename($data, "name", "case_name"); |
|
46 |
- } |
|
47 |
- else |
|
48 |
- { |
|
49 |
- $data = sql_rename($data, "case_id", "case_name"); |
|
50 |
- } |
|
51 |
- } |
|
52 |
- } |
|
53 |
- |
|
54 |
- $table = new class_table |
|
55 |
- ( |
|
56 |
- [ |
|
57 |
- new class_column("Language", "language_id"), |
|
58 |
- new class_column("Count", "count_name"), |
|
59 |
- new class_column("Definiteness", "definiteness_name"), |
|
60 |
- new class_column("Case", "case_name"), |
|
61 |
- new class_column("Words", "words", function ($x) {return json_encode($x);}), |
|
62 |
- ], |
|
63 |
- $data |
|
64 |
- ); |
|
65 |
- |
|
66 |
- $table->snap |
|
67 |
- ( |
|
68 |
- [ |
|
69 |
- "label_vertical" => function ($column) {return "";}, |
|
70 |
- "columns_vertical" => |
|
71 |
- [ |
|
72 |
- $table->columns_get()[1], |
|
73 |
- $table->columns_get()[2], |
|
74 |
- ], |
|
75 |
- "label_horizontal" => function ($column, $value) {return $value;}, |
|
76 |
- "columns_horizontal" => |
|
77 |
- [ |
|
78 |
- $table->columns_get()[3], |
|
79 |
- ], |
|
80 |
- "columns_data" => |
|
81 |
- [ |
|
82 |
- $table->columns_get()[0], |
|
83 |
- $table->columns_get()[4], |
|
84 |
- ], |
|
85 |
- "data_aggregator" => function ($values) |
|
86 |
- { |
|
87 |
- return $values; |
|
88 |
- }, |
|
89 |
- "data_formatter" => function ($value) |
|
90 |
- { |
|
91 |
- switch (1) |
|
92 |
- { |
|
93 |
- case 0: |
|
94 |
- { |
|
95 |
- return format_list("type_word", "flk")($value[0]["words"]); |
|
96 |
- break; |
|
97 |
- } |
|
98 |
- case 1: |
|
99 |
- { |
|
100 |
- global $configuration; |
|
101 |
- $value_ = []; |
|
102 |
- foreach (["flk",$configuration["target"]] as $language_id) |
|
103 |
- { |
|
104 |
- $value_[$language_id] = array_reduce |
|
105 |
- ( |
|
106 |
- array_map |
|
107 |
- ( |
|
108 |
- function ($dataset) {return $dataset["words"];}, |
|
109 |
- array_filter($value, function ($dataset) use (&$language_id) {return ($dataset["language_id"] == $language_id);}) |
|
110 |
- ), |
|
111 |
- function ($x, $y) {return array_merge($x, $y);}, |
|
112 |
- [] |
|
113 |
- ); |
|
114 |
- } |
|
115 |
- return ( |
|
116 |
- format_correlation("type_word") |
|
117 |
- ( |
|
118 |
- [ |
|
119 |
- "flk" => $value_["flk"], |
|
120 |
- $configuration["target"] => $value_[$configuration["target"]], |
|
121 |
- ] |
|
122 |
- ) |
|
123 |
- ); |
|
124 |
- break; |
|
125 |
- } |
|
126 |
- default: |
|
127 |
- { |
|
128 |
- return json_encode($value); |
|
129 |
- break; |
|
130 |
- } |
|
131 |
- } |
|
132 |
- }, |
|
133 |
- ] |
|
134 |
- )->generate(); |
|
135 |
- ?> |
|
136 |
-<p>{{fsdraft_format_correlation:section-declension.example:type_sentence}}</p></section> |
|
7 |
+ {{fsdraft-table-2d:declension.words:count_id/definiteness_id:case_id}} |
|
8 |
+ <p>{{fsdraft-correlation:section-declension.example:type_sentence}}</p> |
|
9 |
+</section> |
|
137 | 10 |
|
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
<section class="subsection" id="definiteness"> |
2 | 2 |
<header>Definiteness</header> |
3 |
- <p>The undefinite aspect of a singular noun is formed by using the article <span class="type_word lang_flk">en</span>, e.g. {{fsdraft_format_correlation:section-definiteness.example1:type_word}}. Undefinite plural nouns don't have an article, e.g. {{fsdraft_format_correlation:section-definiteness.example2:type_word}}.</p> |
|
4 |
- <p>The definite aspect of both singular and plural nouns is formed by using the article <span class="type_word lang_flk">de</span>, e.g. {{fsdraft_format_correlation:section-definiteness.example3:type_word}}.</p> |
|
3 |
+ <p>The undefinite aspect of a singular noun is formed by using the article <span class="type_word lang_flk">en</span>, e.g. {{fsdraft-correlation:section-definiteness.example1:type_word}}. Undefinite plural nouns don't have an article, e.g. {{fsdraft-correlation:section-definiteness.example2:type_word}}.</p> |
|
4 |
+ <p>The definite aspect of both singular and plural nouns is formed by using the article <span class="type_word lang_flk">de</span>, e.g. {{fsdraft-correlation:section-definiteness.example3:type_word}}.</p> |
|
5 | 5 |
<span class="todo">abstract aspect like in "sand is dry"</span> |
6 | 6 |
</section> |
7 | 7 |
|
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
<section class="subsection" id="infinite_verbforms"> |
2 | 2 |
<header>Infinite Verbforms</header> |
3 |
- <p>The <span class="grammarterm">infinitive</span> is formed by appending <span class="type_word lang_flk">-e</span> to the verb stem, e.g. {{fsdraft_format_correlation:section-infinite_verbforms.example1:type_word}}. In some cases it is mandatory to mark the infinitive with the special particle <span class="type_word lang_flk">tu</span> in order to form the <span class="grammarterm">extended intfinitive</span>, e.g.: {{fsdraft_format_correlation:section-infinite_verbforms.example2:type_sentence}}.</p> |
|
3 |
+ <p>The <span class="grammarterm">infinitive</span> is formed by appending <span class="type_word lang_flk">-e</span> to the verb stem, e.g. {{fsdraft-correlation:section-infinite_verbforms.example1:type_word}}. In some cases it is mandatory to mark the infinitive with the special particle <span class="type_word lang_flk">tu</span> in order to form the <span class="grammarterm">extended intfinitive</span>, e.g.: {{fsdraft-correlation:section-infinite_verbforms.example2:type_sentence}}.</p> |
|
4 | 4 |
<span class="todo">Specify cases for extended infinitive</span> |
5 |
- <p>The <span class="grammarterm">active participle</span> is formed by appending <span class="type_word lang_flk">-end</span> to the verb stem, e.g. {{fsdraft_format_correlation:section-infinite_verbforms.example3:type_word}}.</p> |
|
6 |
- <p>The <span class="grammarterm">passive participle</span> is formed by appending <span class="type_word lang_flk">-et</span> to the verb stem, e.g. {{fsdraft_format_correlation:section-infinite_verbforms.example4:type_word}}. If pronouncable, the <span class="type_letter lang_flk">e</span> in the ending can be omitted, e.g. <span class="type_word lang_flk">skrivt</span>.</p> |
|
5 |
+ <p>The <span class="grammarterm">active participle</span> is formed by appending <span class="type_word lang_flk">-end</span> to the verb stem, e.g. {{fsdraft-correlation:section-infinite_verbforms.example3:type_word}}.</p> |
|
6 |
+ <p>The <span class="grammarterm">passive participle</span> is formed by appending <span class="type_word lang_flk">-et</span> to the verb stem, e.g. {{fsdraft-correlation:section-infinite_verbforms.example4:type_word}}. If pronouncable, the <span class="type_letter lang_flk">e</span> in the ending can be omitted, e.g. <span class="type_word lang_flk">skrivt</span>.</p> |
|
7 | 7 |
</section> |
8 | 8 |
|
... | ... |
@@ -3,7 +3,7 @@ |
3 | 3 |
{{call::_proposal.html.tpl}} |
4 | 4 |
<p>The following verbs are modal verbs in Folksprak:</p> |
5 | 5 |
<ul>{{list:section-modal_verbs.list:modal_verbs-listentry.html.tpl}}</ul> |
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> |
|
6 |
+ <p>Modal verbs in contrast to normal verbs never take an extended infinitive as object, e.g. {{fsdraft-correlation:section-modal_verbs.example1:type_sentence}}, but {{fsdraft-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> |
9 | 9 |
|
... | ... |
@@ -1,9 +1,9 @@ |
1 | 1 |
<section class="subsection" id="negation"> |
2 | 2 |
<header>Negation</header> |
3 | 3 |
{{call::_proposal.html.tpl}} |
4 |
- <p>In order to negate the meaning of a predicate, one shall place the word <span class="type_word lang_flk">nit</span> after the flected verb part of the predicate. Example: {{fsdraft_format_correlation:section-negation.examples.0:type_sentence}}</p> |
|
5 |
- <p>If the verb takes a direct object it is allowed to place the object before the <span class="type_word lang_flk">nit</span>. Example: {{fsdraft_format_correlation:section-negation.examples.1:type_sentence}}</p> |
|
6 |
- <p>Negations can also be expressed implicitly by using negative correlatives. Example: {{fsdraft_format_correlation:section-negation.examples.2:type_sentence}}</p> |
|
7 |
- <p>Doubled negations (both explicit and implicit ones) cancel each other out. Example: {{fsdraft_format_correlation:section-negation.examples.3:type_sentence}}</p> |
|
4 |
+ <p>In order to negate the meaning of a predicate, one shall place the word <span class="type_word lang_flk">nit</span> after the flected verb part of the predicate. Example: {{fsdraft-correlation:section-negation.examples.0:type_sentence}}</p> |
|
5 |
+ <p>If the verb takes a direct object it is allowed to place the object before the <span class="type_word lang_flk">nit</span>. Example: {{fsdraft-correlation:section-negation.examples.1:type_sentence}}</p> |
|
6 |
+ <p>Negations can also be expressed implicitly by using negative correlatives. Example: {{fsdraft-correlation:section-negation.examples.2:type_sentence}}</p> |
|
7 |
+ <p>Doubled negations (both explicit and implicit ones) cancel each other out. Example: {{fsdraft-correlation:section-negation.examples.3:type_sentence}}</p> |
|
8 | 8 |
</section> |
9 | 9 |
|
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
<section class="subsection" id="numeri"> |
2 | 2 |
<header>Count</header> |
3 | 3 |
{{call::_proposal.html.tpl}} |
4 |
- <p>The plural of a noun is formed by appending the syllable <span class="type_word lang_flk">-er</span>, e.g. {{fsdraft_format_correlation:section-numeri.example:type_word}}.</p> |
|
4 |
+ <p>The plural of a noun is formed by appending the syllable <span class="type_word lang_flk">-er</span>, e.g. {{fsdraft-correlation:section-numeri.example:type_word}}.</p> |
|
5 | 5 |
</section> |
6 | 6 |
|
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
<section class="subsection" id="personal_pronouns"> |
2 | 2 |
<header>Personal Pronouns</header> |
3 |
- {{fold:personal_pronouns.words:count_id/person_id/gender_id:type_id/case_id}} |
|
3 |
+ {{fsdraft-table-2d:personal_pronouns.words:count_id/person_id/gender_id:type_id/case_id}} |
|
4 | 4 |
<div class="note note_information"> |
5 | 5 |
<span class="note_content"> |
6 | 6 |
<p>Since the word <span class="type_word lang_flk">man</span> simply means <span class="type_word lang_en">human being</span>, it can be understood as an implicit way to express an abstract actor; similar words like <span class="type_word lang_flk">lüd</span> (<span class="type_word lang_en">people</span>) or <span class="type_word lang_flk">di</span> can be used as well.</p> |
... | ... |
@@ -13,7 +13,7 @@ |
13 | 13 |
</div> |
14 | 14 |
<div class="note note_information"> |
15 | 15 |
<span class="note_content"> |
16 |
- <p>A reflexive genitive can be formed by inserting the word <span class="word lang_flk">egen</span> (<span class="type_word lang_en">own</span>), for example {{fsdraft_format_correlation:section-personal_pronouns.example:type_sentence}} (A's book was given to B).</p> |
|
16 |
+ <p>A reflexive genitive can be formed by inserting the word <span class="word lang_flk">egen</span> (<span class="type_word lang_en">own</span>), for example {{fsdraft-correlation:section-personal_pronouns.example:type_sentence}} (A's book was given to B).</p> |
|
17 | 17 |
</span> |
18 | 18 |
</div> |
19 | 19 |
<div class="note note_reasoning"> |
... | ... |
@@ -1,9 +1,3 @@ |
1 |
-<?php |
|
2 |
- global $configuration; |
|
3 |
- include_once("source/logic/server/data.php"); |
|
4 |
- include_once("source/logic/server/table.php"); |
|
5 |
- include_once("source/logic/server/misc.php"); |
|
6 |
- ?> |
|
7 | 1 |
<section class="section" id="phonology_and_orthography"> |
8 | 2 |
<header>Phonology and Orthography</header> |
9 | 3 |
<!-- |
... | ... |
@@ -12,79 +6,7 @@ |
12 | 6 |
<!-- |
13 | 7 |
<div class="note_information">It was not easy to find a phonology system for Folksprak.</div> |
14 | 8 |
--> |
15 |
-<?php |
|
16 |
- $table = new class_table |
|
17 |
- ( |
|
18 |
- [ |
|
19 |
- new class_column |
|
20 |
- ( |
|
21 |
- "IPA-sound", |
|
22 |
- "ipa", |
|
23 |
- function ($value) |
|
24 |
- { |
|
25 |
- return format($value); |
|
26 |
- } |
|
27 |
- ), |
|
28 |
- /* |
|
29 |
- new class_column |
|
30 |
- ( |
|
31 |
- "Type", |
|
32 |
- "type"]; |
|
33 |
- } |
|
34 |
- ), |
|
35 |
- */ |
|
36 |
- new class_column |
|
37 |
- ( |
|
38 |
- "Latin letter Representation", |
|
39 |
- "latin", |
|
40 |
- function ($value) |
|
41 |
- { |
|
42 |
- return format($value, ["letter", "lang_flk"]); |
|
43 |
- } |
|
44 |
- ), |
|
45 |
- new class_column |
|
46 |
- ( |
|
47 |
- "Runic Representation", |
|
48 |
- "runic", |
|
49 |
- function ($value) |
|
50 |
- { |
|
51 |
- return format($value, ["letter", "lang_flk", "runic"]); |
|
52 |
- } |
|
53 |
- ), |
|
54 |
- new class_column |
|
55 |
- ( |
|
56 |
- $configuration["languagemap"]["flk"] . " Example", |
|
57 |
- "examples", |
|
58 |
- function ($value) |
|
59 |
- { |
|
60 |
- return format($value["flk"], ["word", "lang_flk"]); |
|
61 |
- } |
|
62 |
- ), |
|
63 |
- new class_column |
|
64 |
- ( |
|
65 |
- $configuration["languagemap"][$configuration["target"]] . " Example", |
|
66 |
- "examples", |
|
67 |
- function ($value) use (&$configuration) |
|
68 |
- { |
|
69 |
- return format($value[$configuration["target"]], ["word", "lang_" . $configuration["target"]]); |
|
70 |
- } |
|
71 |
- ), |
|
72 |
- /* |
|
73 |
- new class_column |
|
74 |
- ( |
|
75 |
- "Remark", |
|
76 |
- "remark", |
|
77 |
- function ($value) |
|
78 |
- { |
|
79 |
- return format($value); |
|
80 |
- } |
|
81 |
- ), |
|
82 |
- */ |
|
83 |
- ], |
|
84 |
- read_json("source/data/phonology_and_orthography.json") |
|
85 |
- ); |
|
86 |
- $table->generate(); |
|
87 |
- ?> |
|
9 |
+ {{fsdraft-table-1d:phonology_and_orthography:ipa/latin/runic/examples}} |
|
88 | 10 |
<div class="note note_information"> |
89 | 11 |
<span class="note_content"> |
90 | 12 |
<p>It is permitted to pronounce the sounds a little differently, for example <span class="type_letter lang_flk">v</span> as <span class="ipa">ʋ</span> or <span class="type_letter lang_flk">s</span> as <span class="ipa">z</span>, whilst the sounds from the table above are the default.</p> |
... | ... |
@@ -1,111 +1,8 @@ |
1 |
-<?php |
|
2 |
-global $configuration; |
|
3 |
-include_once("source/logic/server/data.php"); |
|
4 |
-include_once("source/logic/server/sql.php"); |
|
5 |
-include_once("source/logic/server/table.php"); |
|
6 |
- ?> |
|
7 | 1 |
<section class="section" id="principles"> |
8 | 2 |
<header>Principles</header> |
9 | 3 |
<p>The word stock of Folksprak is ‐ with minor exceptions ‐ derived from the modern Germanic languages (e.g. English, German, Swedish, …) and/or their precursors (e.g. Old English, Old Norse, Proto Germanic, etc.). Branches which no longer emerge today (e.g. the East Germanic languages like Gothic), were not incorporated.</p> |
10 | 4 |
<p>The following table gives an overview about the typical transitions of phones from Proto-Germanic to some of todays natural Germanic languages and Folksprak, along with example words in square brackets:</p> |
11 | 5 |
<span class="todo">more entries</span> |
12 |
-<?php |
|
13 |
- $data_common = read_json("source/data/common.json"); |
|
14 |
- $data_transitions = read_json("source/data/transitions.json"); |
|
15 |
- |
|
16 |
- $data = $data_transitions["data"]; |
|
17 |
- { |
|
18 |
- { |
|
19 |
- $data = sql_select($data, function ($row) {return in_array($row["language_id"], ["gem","flk","eng","deu","nld","dan","nob","swe","isl"]);}); |
|
20 |
- } |
|
21 |
- { |
|
22 |
- { |
|
23 |
- $data = sql_cross($data, $data_common["languages"]); |
|
24 |
- $data = sql_select($data, function ($row) {return ($row["language_id"] == $row["id"]);}); |
|
25 |
- $data = sql_delete($data, ["id"]); |
|
26 |
- $data = sql_rename($data, "name", "language_name"); |
|
27 |
- } |
|
28 |
- } |
|
29 |
- } |
|
30 |
- |
|
31 |
- $table = new class_table |
|
32 |
- ( |
|
33 |
- [ |
|
34 |
- new class_column("Transition", "transition_id"), |
|
35 |
- new class_column("Language", "language_name"), |
|
36 |
- new class_column("Language ID", "language_id"), |
|
37 |
- new class_column("Phones", "phones"), |
|
38 |
- new class_column("Examples", "examples"), |
|
39 |
- ], |
|
40 |
- $data |
|
41 |
- ); |
|
42 |
- |
|
43 |
- $table->snap |
|
44 |
- ( |
|
45 |
- [ |
|
46 |
- "label_vertical" => function ($column) {return "";}, |
|
47 |
- "columns_vertical" => |
|
48 |
- [ |
|
49 |
- $table->columns_get()[0], |
|
50 |
- ], |
|
51 |
- "label_horizontal" => function ($column, $value) {return $value;}, |
|
52 |
- "columns_horizontal" => |
|
53 |
- [ |
|
54 |
- $table->columns_get()[1], |
|
55 |
- ], |
|
56 |
- "columns_data" => |
|
57 |
- [ |
|
58 |
- $table->columns_get()[2], |
|
59 |
- $table->columns_get()[3], |
|
60 |
- $table->columns_get()[4], |
|
61 |
- ], |
|
62 |
- "data_aggregator" => function ($values) |
|
63 |
- { |
|
64 |
- return $values; |
|
65 |
- }, |
|
66 |
- "data_formatter" => function ($values) |
|
67 |
- { |
|
68 |
- if (count($values) == 1) |
|
69 |
- { |
|
70 |
- $phones = implode( |
|
71 |
- ", ", |
|
72 |
- array_map |
|
73 |
- ( |
|
74 |
- function ($phoneme) use (&$values) |
|
75 |
- { |
|
76 |
- return mark($phoneme, ["type_word", "lang_" . $values[0]["language_id"]]); |
|
77 |
- }, |
|
78 |
- $values[0]["phones"] |
|
79 |
- ) |
|
80 |
- ); |
|
81 |
- $examples = implode |
|
82 |
- ( |
|
83 |
- ", ", |
|
84 |
- array_map |
|
85 |
- ( |
|
86 |
- function ($word) use (&$values) |
|
87 |
- { |
|
88 |
- return mark($word, ["type_word", "lang_" . $values[0]["language_id"]]); |
|
89 |
- }, |
|
90 |
- array_slice($values[0]["examples"], 0, 1) |
|
91 |
- ) |
|
92 |
- ); |
|
93 |
- $output = $phones; |
|
94 |
- if (count($values[0]["examples"]) > 0) |
|
95 |
- { |
|
96 |
- $break = true; |
|
97 |
- $breaker = $break ? "<br/>" : " "; |
|
98 |
- $output .= "${breaker}[${examples}]"; |
|
99 |
- } |
|
100 |
- return $output; |
|
101 |
- } |
|
102 |
- else |
|
103 |
- { |
|
104 |
- return "?"; |
|
105 |
- } |
|
106 |
- }, |
|
107 |
- ] |
|
108 |
- )->generate(); |
|
109 |
- ?> |
|
6 |
+ {{fsdraft-table-2d:transitions.data:transition_id:language_id}} |
|
110 | 7 |
</section> |
111 | 8 |
|
... | ... |
@@ -2,66 +2,16 @@ |
2 | 2 |
<header>Timeforms and modes</header> |
3 | 3 |
{{call::_proposal.html.tpl}} |
4 | 4 |
<p>The following table lists the basic timeforms found in Folksprak and how they are built in the <span class="grammarterm">indicative</span> mode.</p> |
5 |
-<?php |
|
6 |
-(new class_table |
|
7 |
-( |
|
8 |
- [ |
|
9 |
- new class_column |
|
10 |
- ( |
|
11 |
- "Name", |
|
12 |
- "name_", |
|
13 |
- function ($value) |
|
14 |
- { |
|
15 |
- $output = $value["name"]; |
|
16 |
- if ($value["remark"] != null) |
|
17 |
- { |
|
18 |
- $output .= (" " . "(" . $value["remark"] . ")"); |
|
19 |
- } |
|
20 |
- return $output; |
|
21 |
- } |
|
22 |
- ), |
|
23 |
- new class_column |
|
24 |
- ( |
|
25 |
- "Description", |
|
26 |
- "description" |
|
27 |
- ), |
|
28 |
- new class_column |
|
29 |
- ( |
|
30 |
- "Scheme", |
|
31 |
- "scheme", |
|
32 |
- function ($value) |
|
33 |
- { |
|
34 |
- return format($value, ["type_word", "lang_flk"]); |
|
35 |
- } |
|
36 |
- ), |
|
37 |
- new class_column |
|
38 |
- ( |
|
39 |
- "Example", |
|
40 |
- "example_", |
|
41 |
- _bar("type_sentence") |
|
42 |
- ), |
|
43 |
- ], |
|
44 |
- sql_condense |
|
45 |
- ( |
|
46 |
- array_slice(read_json("source/data/timeforms.json"), 0, 4), |
|
47 |
- ["name","remark","example"], |
|
48 |
- ["name_","example_"], |
|
49 |
- [ |
|
50 |
- "name_" => function ($row) {return ["name" => $row["name"], "remark" => $row["remark"]];}, |
|
51 |
- "example_" => function ($row) {global $configuration; return ["original" => [$row["example"]["original"]], "translated" => $row["example"]["translations"][$configuration["target"]]];}, |
|
52 |
- ] |
|
53 |
- ) |
|
54 |
-))->generate(); |
|
55 |
-?> |
|
5 |
+ {{fsdraft-table-1d:timeforms:name/description/scheme/example}} |
|
56 | 6 |
<p>These forms can be combined straightforward to form complex timeforms:</p> |
57 | 7 |
<ul> |
58 |
- <li>{{fsdraft_format_correlation:section-tempora_and_modi.examples_complex.0:type_sentence}}</li> |
|
59 |
- <li>{{fsdraft_format_correlation:section-tempora_and_modi.examples_complex.1:type_sentence}}</li> |
|
8 |
+ <li>{{fsdraft-correlation:section-tempora_and_modi.examples_complex.0:type_sentence}}</li> |
|
9 |
+ <li>{{fsdraft-correlation:section-tempora_and_modi.examples_complex.1:type_sentence}}</li> |
|
60 | 10 |
<!-- |
61 |
- <li>{{fsdraft_format_correlation:section-tempora_and_modi.examples_complex_inactive.0:type_sentence}}</li> |
|
11 |
+ <li>{{fsdraft-correlation:section-tempora_and_modi.examples_complex_inactive.0:type_sentence}}</li> |
|
62 | 12 |
--> |
63 | 13 |
</ul> |
64 | 14 |
<p>The <span class="grammarterm">imperative</span> only exists in the present (with future meaning) for the 2nd person singular and plural. It is formed by using the bare stem of the verb, optionally followed by the personal pronoun (i.e. either <span class="type_word lang_flk">du</span> or <span class="type_word lang_flk">je</span>) in order to specify or emphasize the numerus. Examples: <span class="type_sentence lang_flk">skriv!</span>, <span class="type_sentence lang_flk">skriv, je!</span>.</p> |
65 |
- <p>There are two ways to form the <span class="grammarterm">subjunctive</span>. One is to use the special modal verb <span class="type_word lang_flk">vöre</span> which can be understood as a wrapper for regular verbs. The other possibility is to use the adverbial particle <span class="type_word lang_flk">maglik</span>. Both can be applied to the indicative forms, e.g.: {{fsdraft_format_correlation:section-tempora_and_modi.example_subjunctive:type_sentence}}</p> |
|
15 |
+ <p>There are two ways to form the <span class="grammarterm">subjunctive</span>. One is to use the special modal verb <span class="type_word lang_flk">vöre</span> which can be understood as a wrapper for regular verbs. The other possibility is to use the adverbial particle <span class="type_word lang_flk">maglik</span>. Both can be applied to the indicative forms, e.g.: {{fsdraft-correlation:section-tempora_and_modi.example_subjunctive:type_sentence}}</p> |
|
66 | 16 |
</section> |
67 | 17 |
|
... | ... |
@@ -1,97 +1,7 @@ |
1 |
-<?php |
|
2 |
- global $configuration; |
|
3 |
- include_once("source/logic/server/misc.php"); |
|
4 |
- include_once("source/logic/server/data.php"); |
|
5 |
- include_once("source/logic/server/table.php"); |
|
6 |
- ?> |
|
7 | 1 |
<section class="section" id="word_functions"> |
8 | 2 |
<header>Word Functions</header> |
9 | 3 |
{{call::_proposal.html.tpl}} |
10 |
-<?php |
|
11 |
- $table = new class_table |
|
12 |
- ( |
|
13 |
- [ |
|
14 |
- new class_column |
|
15 |
- ( |
|
16 |
- "Affix", |
|
17 |
- "affix", |
|
18 |
- function ($value) |
|
19 |
- { |
|
20 |
- return mark($value, ["type_word", "lang_flk"]); |
|
21 |
- } |
|
22 |
- ), |
|
23 |
- new class_column |
|
24 |
- ( |
|
25 |
- "Type", |
|
26 |
- "type_", |
|
27 |
- function ($value) |
|
28 |
- { |
|
29 |
- return ( |
|
30 |
- implode |
|
31 |
- ( |
|
32 |
- " → ", |
|
33 |
- array_map |
|
34 |
- ( |
|
35 |
- function ($group) |
|
36 |
- { |
|
37 |
- return ("{" . implode(",", $group) . "}"); |
|
38 |
- }, |
|
39 |
- $value |
|
40 |
- ) |
|
41 |
- ) |
|
42 |
- ); |
|
43 |
- } |
|
44 |
- ), |
|
45 |
- new class_column |
|
46 |
- ( |
|
47 |
- "Description", |
|
48 |
- "description_", |
|
49 |
- function ($value) |
|
50 |
- { |
|
51 |
- $output = ""; |
|
52 |
- if ($value["name"] != null) $output .= (mark($value["name"], ["grammarterm"]) . ": "); |
|
53 |
- if ($value["description"] != null) $output .= ($value["description"]); |
|
54 |
- return $output; |
|
55 |
- } |
|
56 |
- ), |
|
57 |
- /* |
|
58 |
- new class_column |
|
59 |
- ( |
|
60 |
- "Cognates", |
|
61 |
- "cognates", |
|
62 |
- function ($value) |
|
63 |
- { |
|
64 |
- return implode(", ", array_map(function ($entry) {return ($entry["language"] . ": " . mark($entry["affix"], ["word", "lang_" . $entry["language"]]));}, $value)); |
|
65 |
- } |
|
66 |
- ), |
|
67 |
- */ |
|
68 |
- new class_column |
|
69 |
- ( |
|
70 |
- "Example", |
|
71 |
- "example_", |
|
72 |
- _bar("word") |
|
73 |
- /* |
|
74 |
- function ($x) |
|
75 |
- { |
|
76 |
- return json_encode($x); |
|
77 |
- } |
|
78 |
- */ |
|
79 |
- ), |
|
80 |
- ], |
|
81 |
- sql_condense |
|
82 |
- ( |
|
83 |
- read_json("source/data/word_functions.json"), |
|
84 |
- ["type_from","type_to","name","description","example"], |
|
85 |
- ["type_","description_","example_"], |
|
86 |
- [ |
|
87 |
- "type_" => function ($values) {return [$values["type_from"], $values["type_to"]];}, |
|
88 |
- "description_" => function ($values) {return ["name" => $values["name"], "description" => $values["description"]];}, |
|
89 |
- "example_" => function ($values) {global $configuration; return ["original" => [$values["example"]["word"]], "translated" => $values["example"]["translations"][$configuration["target"]]];}, |
|
90 |
- ] |
|
91 |
- ) |
|
92 |
- ); |
|
93 |
- $table->generate(); |
|
94 |
- ?> |
|
4 |
+ {{fsdraft-table-1d:word_functions:affix/type_from/type_to/description/example}} |
|
95 | 5 |
<p> |
96 | 6 |
Some complex examples: |
97 | 7 |
<ul>{{list:section-word_functions.examples:word_functions-listentry.html.tpl}}</ul> |
... | ... |
@@ -193,6 +193,7 @@ a |
193 | 193 |
} |
194 | 194 |
} |
195 | 195 |
|
196 |
+ &.lang_gem, |
|
196 | 197 |
&.lang_eng, |
197 | 198 |
&.lang_afr, |
198 | 199 |
&.lang_nld, |
... | ... |
@@ -231,6 +232,7 @@ a |
231 | 232 |
} |
232 | 233 |
} |
233 | 234 |
|
235 |
+ &.lang_gem, |
|
234 | 236 |
&.lang_eng, |
235 | 237 |
&.lang_afr, |
236 | 238 |
&.lang_nld, |
... | ... |
@@ -272,6 +274,7 @@ a |
272 | 274 |
} |
273 | 275 |
} |
274 | 276 |
|
277 |
+ &.lang_gem, |
|
275 | 278 |
&.lang_eng, |
276 | 279 |
&.lang_afr, |
277 | 280 |
&.lang_nld, |
... | ... |
@@ -313,6 +316,7 @@ a |
313 | 316 |
} |
314 | 317 |
} |
315 | 318 |
|
319 |
+ &.lang_gem, |
|
316 | 320 |
&.lang_eng, |
317 | 321 |
&.lang_afr, |
318 | 322 |
&.lang_nld, |
... | ... |
@@ -0,0 +1,655 @@ |
1 |
+ |
|
2 |
+type int = number; |
|
3 |
+ |
|
4 |
+ |
|
5 |
+/** |
|
6 |
+ * @author kcf |
|
7 |
+ */ |
|
8 |
+const configuration = { |
|
9 |
+ "replace_fs_umlauts": false, |
|
10 |
+ "target": "eng", |
|
11 |
+}; |
|
12 |
+ |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * @author kcf |
|
16 |
+ */ |
|
17 |
+function mark( |
|
18 |
+ core, |
|
19 |
+ classes |
|
20 |
+) |
|
21 |
+{ |
|
22 |
+ const contains = ((list, entry) => (list.indexOf(entry) >= 0)); |
|
23 |
+ if (configuration["replace_fs_umlauts"]) { |
|
24 |
+ if ( |
|
25 |
+ contains(classes, "lang_flk") |
|
26 |
+ && |
|
27 |
+ ! contains(classes, "type_letter") |
|
28 |
+ ) { |
|
29 |
+ core = ( |
|
30 |
+ core |
|
31 |
+ .replace(new RegExp("ö", "g"), "oy") |
|
32 |
+ .replace(new RegExp("ü", "g"), "uy") |
|
33 |
+ ); |
|
34 |
+ } |
|
35 |
+ } |
|
36 |
+ return ('<span class="' + classes.join(" ") + '">' + core + '</span>'); |
|
37 |
+} |
|
38 |
+ |
|
39 |
+ |
|
40 |
+/** |
|
41 |
+ * @author kcf |
|
42 |
+ */ |
|
43 |
+function format_single( |
|
44 |
+ type, |
|
45 |
+ language |
|
46 |
+) |
|
47 |
+{ |
|
48 |
+ return ( |
|
49 |
+ function (piece) { |
|
50 |
+ return mark(piece, [type, "lang_" + language]); |
|
51 |
+ } |
|
52 |
+ ); |
|
53 |
+} |
|
54 |
+ |
|
55 |
+ |
|
56 |
+/** |
|
57 |
+ * @author kcf |
|
58 |
+ */ |
|
59 |
+function format_list( |
|
60 |
+ type, |
|
61 |
+ language |
|
62 |
+) |
|
63 |
+{ |
|
64 |
+ return ( |
|
65 |
+ function (pieces) { |
|
66 |
+ return ( |
|
67 |
+ (pieces.length <= 0) |
|
68 |
+ ? "?" |
|
69 |
+ : pieces.map(format_single(type, language)).join(", ") |
|
70 |
+ ); |
|
71 |
+ } |
|
72 |
+ ); |
|
73 |
+} |
|
74 |
+ |
|
75 |
+ |
|
76 |
+/** |
|
77 |
+ * @author kcf |
|
78 |
+ */ |
|
79 |
+function format_correlation( |
|
80 |
+ type, |
|
81 |
+ language_from = "flk", |
|
82 |
+ language_to = null |
|
83 |
+) |
|
84 |
+{ |
|
85 |
+ if (language_to === null) language_to = configuration["target"]; |
|
86 |
+ return ( |
|
87 |
+ function (source) { |
|
88 |
+ let output = ""; |
|
89 |
+ output += format_list(type, language_from)(source[language_from]); |
|
90 |
+ output += " ~ "; |
|
91 |
+ output += format_list(type, language_to)(source[language_to]); |
|
92 |
+ return output; |
|
93 |
+ } |
|
94 |
+ ); |
|
95 |
+} |
|
96 |
+ |
|
97 |
+ |
|
98 |
+/** |
|
99 |
+ * @author fenris |
|
100 |
+ */ |
|
101 |
+function objvals( |
|
102 |
+ objekt : {[key : string] : any} |
|
103 |
+) : Array<any> |
|
104 |
+{ |
|
105 |
+ return Object.keys(objekt).map(key => objekt[key]); |
|
106 |
+} |
|
107 |
+ |
|
108 |
+ |
|
109 |
+/** |
|
110 |
+ * @author fenris |
|
111 |
+ */ |
|
112 |
+function merge<typ_element>( |
|
113 |
+ liste_x : Array<typ_element>, |
|
114 |
+ liste_y : Array<typ_element>, |
|
115 |
+ ordnung : (x : typ_element, y : typ_element)=>boolean |
|
116 |
+) : Array<typ_element> |
|
117 |
+{ |
|
118 |
+ if (liste_x.length <= 0) { |
|
119 |
+ return liste_y; |
|
120 |
+ } |
|
121 |
+ else if (liste_y.length <= 0) { |
|
122 |
+ return liste_x; |
|
123 |
+ } |
|
124 |
+ else { |
|
125 |
+ return ( |
|
126 |
+ ordnung(liste_x[0], liste_y[0]) |
|
127 |
+ ? ([liste_x[0]].concat(merge(liste_x.slice(1), liste_y, ordnung))) |
|
128 |
+ : ([liste_y[0]].concat(merge(liste_x, liste_y.slice(1), ordnung))) |
|
129 |
+ ); |
|
130 |
+ } |
|
131 |
+} |
|
132 |
+ |
|
133 |
+ |
|
134 |
+/** |
|
135 |
+ * @author fenris |
|
136 |
+ */ |
|
137 |
+function mergesort<typ_element>( |
|
138 |
+ liste : Array<typ_element>, |
|
139 |
+ ordnung : (x : typ_element, y : typ_element)=>boolean |
|
140 |
+) : Array<typ_element> |
|
141 |
+{ |
|
142 |
+ if (liste.length <= 1) { |
|
143 |
+ return liste; |
|
144 |
+ } |
|
145 |
+ else { |
|
146 |
+ let n : int = <int>(Math.floor(liste.length/2)); |
|
147 |
+ return merge( |
|
148 |
+ mergesort(liste.slice(0, n), ordnung), |
|
149 |
+ mergesort(liste.slice(n), ordnung), |
|
150 |
+ ordnung |
|
151 |
+ ); |
|
152 |
+ } |
|
153 |
+} |
|
154 |
+ |
|
155 |
+ |
|
156 |
+/** |
|
157 |
+ * @author fenris |
|
158 |
+ */ |
|
159 |
+function order_list<typ_element>( |
|
160 |
+ liste : Array<typ_element>, |
|
161 |
+ kollation : (x : typ_element, y : typ_element)=>boolean = ((x, y) => (x === y)) |
|
162 |
+) : (x : typ_element, y : typ_element)=>boolean |
|
163 |
+{ |
|
164 |
+ return ( |
|
165 |
+ (x, y) => { |
|
166 |
+ let i : int = liste["findIndex"]((element) => kollation(x, element)); |
|
167 |
+ let j : int = liste["findIndex"]((element) => kollation(y, element)); |
|
168 |
+ return (i <= j); |
|
169 |
+ } |
|
170 |
+ ); |
|
171 |
+} |
|
172 |
+ |
|
173 |
+ |
|
174 |
+/** |
|
175 |
+ * @author fenris |
|
176 |
+ */ |
|
177 |
+function order_lex( |
|
178 |
+ ordnungen : Array<(x : any, y : any)=>boolean> |
|
179 |
+) : (x : Array<any>, y : Array<any>)=>boolean |
|
180 |
+{ |
|
181 |
+ return ( |
|
182 |
+ (x, y) => { |
|
183 |
+ if ( |
|
184 |
+ (ordnungen.length <= 0) |
|
185 |
+ || |
|
186 |
+ (x.length <= 0) |
|
187 |
+ || |
|
188 |
+ (y.length <= 0) |
|
189 |
+ ) { |
|
190 |
+ return true; |
|
191 |
+ } |
|
192 |
+ else { |
|
193 |
+ let le : boolean = ordnungen[0](x[0], y[0]); |
|
194 |
+ let ge : boolean = ordnungen[0](y[0], x[0]); |
|
195 |
+ if (le && !ge) { |
|
196 |
+ return true; |
|
197 |
+ } |
|
198 |
+ else if (!le && ge) { |
|
199 |
+ return false; |
|
200 |
+ } |
|
201 |
+ else { |
|
202 |
+ return order_lex(ordnungen.slice(1))(x.slice(1), y.slice(1)); |
|
203 |
+ } |
|
204 |
+ } |
|
205 |
+ } |
|
206 |
+ ); |
|
207 |
+} |
|
208 |
+ |
|
209 |
+ |
|
210 |
+/** |
|
211 |
+ * @author fenris |
|
212 |
+ */ |
|
213 |
+function kollation_satz( |
|
214 |
+ kollationen : {[name : string] : (x : any, y : any)=>boolean}, |
|
215 |
+ satz_x : {[namen : string] : any}, |
|
216 |
+ satz_y : {[namen : string] : any}, |
|
217 |
+ namen : Array<string> |
|
218 |
+) : boolean |
|
219 |
+{ |
|
220 |
+ return ( |
|
221 |
+ namen.every( |
|
222 |
+ (name) => kollationen[name](satz_x[name], satz_y[name]) |
|
223 |
+ ) |
|
224 |
+ ); |
|
225 |
+} |
|
226 |
+ |
|
227 |
+ |
|
228 |
+/** |
|
229 |
+ * @author fenris |
|
230 |
+ */ |
|
231 |
+function sammeln( |
|
232 |
+ kollationen : {[name : string] : (x : any, y : any)=>boolean}, |
|
233 |
+ ordnungen : {[name : string] : (x : any, y : any)=>boolean}, |
|
234 |
+ daten : Array<{[name : string] : any}>, |
|
235 |
+ namen : Array<string> |
|
236 |
+) : Array<{[name : string] : any}> |
|
237 |
+{ |
|
238 |
+ let liste : Array<{[name : string] : any}> = []; |
|
239 |
+ // Heraussuchen |
|
240 |
+ daten |
|
241 |
+ .forEach( |
|
242 |
+ (satz_urspruenglich) => { |
|
243 |
+ let satz_neu : {[name : string] : any} = {}; |
|
244 |
+ namen.forEach(name => {satz_neu[name] = satz_urspruenglich[name];}); |
|
245 |
+ let vorhanden : boolean = liste.some((satz_alt) => kollation_satz(kollationen, satz_alt, satz_neu, namen)); |
|
246 |
+ if (! vorhanden) { |
|
247 |
+ liste.push(satz_neu); |
|
248 |
+ } |
|
249 |
+ } |
|
250 |
+ ); |
|
251 |
+ // Sortieren |
|
252 |
+ liste = mergesort<{[name : string] : any}>( |
|
253 |
+ liste, |
|
254 |
+ (x, y) => { |
|
255 |
+ let x_ : Array<any> = namen.map(name => x[name]); |
|
256 |
+ let y_ : Array<any> = namen.map(name => y[name]); |
|
257 |
+ let ordnung : (x : any, y : any)=>boolean = order_lex(namen.map((name) => ordnungen[name])); |
|
258 |
+ return ordnung(x_, y_); |
|
259 |
+ } |
|
260 |
+ ); |
|
261 |
+ return liste; |
|
262 |
+} |
|
263 |
+ |
|
264 |
+ |
|
265 |
+/** |
|
266 |
+ * @author fenris |
|
267 |
+ */ |
|
268 |
+function anzeigen( |
|
269 |
+ { |
|
270 |
+ "daten": daten, |
|
271 |
+ "spalten": namen, |
|
272 |
+ "kollationen": kollationen = {}, |
|
273 |
+ "ordnungen": ordnungen = {}, |
|
274 |
+ "sortierung_propagieren": sortierung_propagieren = true, |
|
275 |
+ } |
|
276 |
+ : { |
|
277 |
+ daten : Array<{[name : string] : any}>; |
|
278 |
+ spalten : Array<string>; |
|
279 |
+ kollationen ?: {[name : string] : (x : any, y : any)=>boolean}; |
|
280 |
+ ordnungen ?: {[name : string] : (x : any, y : any)=>boolean}; |
|
281 |
+ sortierung_propagieren ?: boolean; |
|
282 |
+ } |
|
283 |
+) : {meta : any; data : Array<{[name : string] : any}>;} |
|
284 |
+{ |
|
285 |
+ // Kollationen und Ordnungen vervollständigen |
|
286 |
+ { |
|
287 |
+ namen |
|
288 |
+ .forEach( |
|
289 |
+ (name) => { |
|
290 |
+ // Kollation ergänzen |
|
291 |
+ if (! kollationen.hasOwnProperty(name)) { |
|
292 |
+ kollationen[name] = ((x, y) => (x === y)); |
|
293 |
+ } |
|
294 |
+ // Ordnung ergänzen |
|
295 |
+ if (! ordnungen.hasOwnProperty(name)) { |
|
296 |
+ ordnungen[name] = (sortierung_propagieren ? ((x, y) => false) : ((x, y) => (x <= y))); |
|
297 |
+ } |
|
298 |
+ } |
|
299 |
+ ); |
|
300 |
+ } |
|
301 |
+ const werte : Array<{[name : string] : any}> = sammeln(kollationen, ordnungen, daten, namen); |
|
302 |
+ /* |
|
303 |
+ let meta = { |
|
304 |
+ "x": {}, |
|
305 |
+ "y": {}, |
|
306 |
+ }; |
|
307 |
+ werte.forEach((satz, nummer) => {let name : string = ("y" + nummer.toFixed(0)); meta.y[name] = satz;}); |
|
308 |
+ werte_waagerecht.forEach((satz, nummer) => {let name : string = ("x" + nummer.toFixed(0)); meta.x[name] = satz;}); |
|
309 |
+ */ |
|
310 |
+ return { |
|
311 |
+ "meta": null, |
|
312 |
+ "data": werte, |
|
313 |
+ }; |
|
314 |
+} |
|
315 |
+ |
|
316 |
+ |
|
317 |
+/* |
|
318 |
+ |
|
319 |
+ +------+------+------+ |
|
320 |
+ | xA | xB | xC | |
|
321 |
+ +------+------+------+ |
|
322 |
+ | a2 | b1 | c3 | |
|
323 |
+ | a1 | b1 | c0 | |
|
324 |
+ | a1 | b3 | c2 | |
|
325 |
+ | a2 | b2 | c4 | |
|
326 |
+ | a1 | b2 | c1 | |
|
327 |
+ | a2 | b4 | c5 | |
|
328 |
+ +------+------+------+ |
|
329 |
+ |
|
330 |
+ +------+------+------+------+------+ |
|
331 |
+ | xA | xB:b1| xB:b2| xB:b3| xB:b4| |
|
332 |
+ +------+------+------+------+------+ |
|
333 |
+ | a1 | c0 | c1 | c2 | -- | |
|
334 |
+ | a2 | c3 | c4 | -- | c5 | |
|
335 |
+ +------+------+------+------+------+ |
|
336 |
+ |
|
337 |
+ */ |
|
338 |
+ |
|
339 |
+ |
|
340 |
+/** |
|
341 |
+ * @author fenris |
|
342 |
+ */ |
|
343 |
+function anordnen( |
|
344 |
+ { |
|
345 |
+ "daten": daten, |
|
346 |
+ "senkrecht": namen_senkrecht, |
|
347 |
+ "waagerecht": namen_waagerecht, |
|
348 |
+ "kollationen": kollationen = {}, |
|
349 |
+ "ordnungen": ordnungen = {}, |
|
350 |
+ "feldsatz_kuerzen": feldsatz_kuerzen = true, |
|
351 |
+ "sortierung_propagieren": sortierung_propagieren = true, |
|
352 |
+ } |
|
353 |
+ : { |
|
354 |
+ daten : Array<{[name : string] : any}>; |
|
355 |
+ waagerecht : Array<string>; |
|
356 |
+ senkrecht : Array<string>; |
|
357 |
+ kollationen ?: {[name : string] : (x : any, y : any)=>boolean}; |
|
358 |
+ ordnungen ?: {[name : string] : (x : any, y : any)=>boolean}; |
|
359 |
+ feldsatz_kuerzen ?: boolean; |
|
360 |
+ sortierung_propagieren ?: boolean; |
|
361 |
+ } |
|
362 |
+) : {meta : {x : {[name : string] : any}; y : {[name : string] : any};}; data : Array<{[name : string] : any}>;} |
|
363 |
+{ |
|
364 |
+ // Kollationen und Ordnungen vervollständigen |
|
365 |
+ { |
|
366 |
+ ([].concat(namen_senkrecht).concat(namen_waagerecht)) |
|
367 |
+ .forEach( |
|
368 |
+ (name) => { |
|
369 |
+ // Kollation ergänzen |
|
370 |
+ if (! kollationen.hasOwnProperty(name)) { |
|
371 |
+ kollationen[name] = ((x, y) => (x === y)); |
|
372 |
+ } |
|
373 |
+ // Ordnung ergänzen |
|
374 |
+ if (! ordnungen.hasOwnProperty(name)) { |
|
375 |
+ ordnungen[name] = (sortierung_propagieren ? ((x, y) => false) : ((x, y) => (x <= y))); |
|
376 |
+ } |
|
377 |
+ } |
|
378 |
+ ); |
|
379 |
+ } |
|
380 |
+ const werte_senkrecht : Array<{[name : string] : any}> = sammeln(kollationen, ordnungen, daten, namen_senkrecht); |
|
381 |
+ const werte_waagerecht : Array<{[name : string] : any}> = sammeln(kollationen, ordnungen, daten, namen_waagerecht); |
|
382 |
+ let meta = { |
|
383 |
+ "x": {}, |
|
384 |
+ "y": {}, |
|
385 |
+ }; |
|
386 |
+ werte_senkrecht.forEach((satz, nummer) => {let name : string = ("y" + nummer.toFixed(0)); meta.y[name] = satz;}); |
|
387 |
+ werte_waagerecht.forEach((satz, nummer) => {let name : string = ("x" + nummer.toFixed(0)); meta.x[name] = satz;}); |
|
388 |
+ let data : Array<{[name : string] : any}> = ( |
|
389 |
+ Object.keys(meta.y) |
|
390 |
+ .map( |
|
391 |
+ (label_senkrecht) => { |
|
392 |
+ let satz_senkrecht : {[name : string] : any} = meta.y[label_senkrecht]; |
|
393 |
+ let satz_ergebnis : {[name : string] : any} = {}; |
|
394 |
+ // Kopf |
|
395 |
+ { |
|
396 |
+ let name : string = "_"; |
|
397 |
+ satz_ergebnis[name] = label_senkrecht; |
|
398 |
+ } |
|
399 |
+ // Rumpf |
|
400 |
+ { |
|
401 |
+ Object.keys(meta.x) |
|
402 |
+ .forEach( |
|
403 |
+ (label_waagerecht) => { |
|
404 |
+ let satz_waagerecht : {[name : string] : any} = meta.x[label_waagerecht]; |
|
405 |
+ let saetze_feld : Array<{[name : string] : any}> = ( |
|
406 |
+ daten |
|
407 |
+ .filter( |
|
408 |
+ (satz_urspruenglich) => ( |
|
409 |
+ kollation_satz(kollationen, satz_urspruenglich, satz_senkrecht, namen_senkrecht) |
|
410 |
+ && |
|
411 |
+ kollation_satz(kollationen, satz_urspruenglich, satz_waagerecht, namen_waagerecht) |
|
412 |
+ ) |
|
413 |
+ ) |
|
414 |
+ .map( |
|
415 |
+ (satz_urspruenglich) => { |
|
416 |
+ let satz_neu : {[name : string] : any} = {}; |
|
417 |
+ Object.keys(satz_urspruenglich) |
|
418 |
+ .forEach( |
|
419 |
+ (name) => { |
|
420 |
+ if ( |
|
421 |
+ ! feldsatz_kuerzen |
|
422 |
+ || |
|
423 |
+ ( |
|
424 |
+ namen_senkrecht.every((name_) => (name !== name_)) |
|
425 |
+ && |
|
426 |
+ namen_waagerecht.every((name_) => (name !== name_)) |
|
427 |
+ ) |
|
428 |
+ ) { |
|
429 |
+ satz_neu[name] = satz_urspruenglich[name]; |
|
430 |
+ } |
|
431 |
+ } |
|
432 |
+ ); |
|
433 |
+ return satz_neu; |
|
434 |
+ } |
|
435 |
+ ) |
|
436 |
+ ); |
|
437 |
+ satz_ergebnis[label_waagerecht] = saetze_feld; |
|
438 |
+ } |
|
439 |
+ ); |
|
440 |
+ } |
|
441 |
+ return satz_ergebnis; |
|
442 |
+ } |
|
443 |
+ ) |
|
444 |
+ ); |
|
445 |
+ return { |
|
446 |
+ "meta": meta, |
|
447 |
+ "data": data, |
|
448 |
+ }; |
|
449 |
+} |
|
450 |
+ |
|
451 |
+ |
|
452 |
+/** |
|
453 |
+ * @author fenris |
|
454 |
+ */ |
|
455 |
+function xmlwrap( |
|
456 |
+ name : string, |
|
457 |
+ kern : string |
|
458 |
+) : string |
|
459 |
+{ |
|
460 |
+ return (("<" + name + ">") + kern + ("</" + name + ">") + "\n"); |
|
461 |
+} |
|
462 |
+ |
|
463 |
+ |
|
464 |
+/** |
|
465 |
+ * @author fenris |
|
466 |
+ */ |
|
467 |
+function htmltable( |
|
468 |
+ titel : Array<string>, |
|
469 |
+ daten : Array<Array<string>>, |
|
470 |
+ _2d : boolean = false |
|
471 |
+) |
|
472 |
+: string |
|
473 |
+{ |
|
474 |
+ return ( |
|
475 |
+ xmlwrap( |
|
476 |
+ "table", |
|
477 |
+ ( |
|
478 |
+ // kopf |
|
479 |
+ xmlwrap( |
|
480 |
+ "thead", |
|
481 |
+ xmlwrap( |
|
482 |
+ "tr", |
|
483 |
+ ( |
|
484 |
+ titel |
|
485 |
+ .map( |
|
486 |
+ (titel_) => xmlwrap("th", titel_) |
|
487 |
+ ) |
|
488 |
+ .join("") |
|
489 |
+ ) |
|
490 |
+ ) |
|
491 |
+ ) |
|
492 |
+ + |
|
493 |
+ // rumpf |
|
494 |
+ xmlwrap( |
|
495 |
+ "tbody", |
|
496 |
+ ( |
|
497 |
+ daten |
|
498 |
+ .map( |
|
499 |
+ (satz) => xmlwrap( |
|
500 |
+ "tr", |
|
501 |
+ satz.map( |
|
502 |
+ (feld, nummer) => ( |
|
503 |
+ (_2d && (nummer === 0)) |
|
504 |
+ ? xmlwrap("th", feld) |
|
505 |
+ : xmlwrap("td", feld) |
|
506 |
+ ) |
|
507 |
+ ) |
|
508 |
+ .join("") |
|
509 |
+ ) |
|
510 |
+ ) |
|
511 |
+ .join("") |
|
512 |
+ ) |
|
513 |
+ ) |
|
514 |
+ ) |
|
515 |
+ ) |
|
516 |
+ ); |
|
517 |
+} |
|
518 |
+ |
|
519 |
+ |
|
520 |
+/** |
|
521 |
+ * @author kcf |
|
522 |
+ */ |
|
523 |
+export function definieren( |
|
524 |
+) : any |
|
525 |
+{ |
|
526 |
+ return { |
|
527 |
+ "name": "fsdraft", |
|
528 |
+ "befehle": [ |
|
529 |
+ { |
|
530 |
+ "name": "fsdraft-mark", |
|
531 |
+ "funktion": (args) => (wert) => { |
|
532 |
+ let classes = args; |
|
533 |
+ return mark(wert, classes); |
|
534 |
+ } |
|
535 |
+ }, |
|
536 |
+ { |
|
537 |
+ "name": "fsdraft-correlation", |
|
538 |
+ "funktion": (args) => (wert) => { |
|
539 |
+ let type = args.shift(); |
|
540 |
+ return format_correlation(type)(wert); |
|
541 |
+ } |
|
542 |
+ }, |
|
543 |
+ { |
|
544 |
+ "name": "fsdraft-table-1d", |
|
545 |
+ "funktion": (args) => (wert) => { |
|
546 |
+ let namen_ : string = ( |
|
547 |
+ (args.length > 0) |
|
548 |
+ ? args.shift() |
|
549 |
+ : null |
|
550 |
+ ); |
|
551 |
+ let namen : Array<string> = namen_.split("/"); |
|
552 |
+ let tabelle : {meta : any; data : Array<{[name : string] : any}>;} = anzeigen( |
|
553 |
+ { |
|
554 |
+ "daten": wert, |
|
555 |
+ "spalten": namen, |
|
556 |
+ } |
|
557 |
+ ); |
|
558 |
+ let tabelle_ : {kopf : Array<string>; rumpf : Array<Array<string>>;} = { |
|
559 |
+ "kopf": ( |
|
560 |
+ namen |
|
561 |
+ ), |
|
562 |
+ "rumpf": tabelle.data.map( |
|
563 |
+ (satz) => ( |
|
564 |
+ Object.keys(satz).map( |
|
565 |
+ (label) => ( |
|
566 |
+ JSON.stringify(satz[label]) |
|
567 |
+ ) |
|
568 |
+ ) |
|
569 |
+ ) |
|
570 |
+ ), |
|
571 |
+ }; |
|
572 |
+ let tabelle__ : string = htmltable( |
|
573 |
+ tabelle_.kopf, |
|
574 |
+ tabelle_.rumpf, |
|
575 |
+ false |
|
576 |
+ ); |
|
577 |
+ let style = xmlwrap("style", "th,td {font-family: monospace; font-size: 0.875em;}"); |
|
578 |
+ return (style + tabelle__); |
|
579 |
+ }, |
|
580 |
+ }, |
|
581 |
+ { |
|
582 |
+ "name": "fsdraft-table-2d", |
|
583 |
+ "funktion": (args) => (wert) => { |
|
584 |
+ let senkrecht_ : string = ( |
|
585 |
+ (args.length > 0) |
|
586 |
+ ? args.shift() |
|
587 |
+ : null |
|
588 |
+ ); |
|
589 |
+ let waagerecht_ : string = ( |
|
590 |
+ (args.length > 0) |
|
591 |
+ ? args.shift() |
|
592 |
+ : null |
|
593 |
+ ); |
|
594 |
+ let senkrecht : Array<string> = ( |
|
595 |
+ (senkrecht_ !== null) |
|
596 |
+ ? senkrecht_.split("/") |
|
597 |
+ : [] |
|
598 |
+ ); |
|
599 |
+ let waagerecht : Array<string> = ( |
|
600 |
+ (waagerecht_ !== null) |
|
601 |
+ ? waagerecht_.split("/") |
|
602 |
+ : [] |
|
603 |
+ ); |
|
604 |
+ let tabelle : {meta : any; data : any;} = anordnen( |
|
605 |
+ { |
|
606 |
+ "daten": wert, |
|
607 |
+ "senkrecht": senkrecht, |
|
608 |
+ "waagerecht": waagerecht, |
|
609 |
+ } |
|
610 |
+ ); |
|
611 |
+ let tabelle_ : {kopf : Array<string>; rumpf : Array<Array<string>>;} = { |
|
612 |
+ "kopf": ( |
|
613 |
+ [""].concat( |
|
614 |
+ Object.keys(tabelle.meta.x).map( |
|
615 |
+ (label) => ( |
|
616 |
+ // JSON.stringify(tabelle.meta.x[label]) |
|
617 |
+ objvals(tabelle.meta.x[label]).join("/") |
|
618 |
+ ) |
|
619 |
+ ) |
|
620 |
+ ) |
|
621 |
+ ), |
|
622 |
+ "rumpf": tabelle.data.map( |
|
623 |
+ (satz) => ( |
|
624 |
+ Object.keys(satz).map( |
|
625 |
+ (label) => ( |
|
626 |
+ (label === "_") |
|
627 |
+ // ? JSON.stringify(tabelle.meta.y[satz[label]]) |
|
628 |
+ ? objvals(tabelle.meta.y[satz[label]]).join("/") |
|
629 |
+ : JSON.stringify(satz[label]) |
|
630 |
+ /* |
|
631 |
+ : ( |
|
632 |
+ satz[label] |
|
633 |
+ .filter(x => (x["language_id"] === "flk")) |
|
634 |
+ .map(x => x["words"].join(", ")) |
|
635 |
+ .join("; ") |
|
636 |
+ ) |
|
637 |
+ */ |
|
638 |
+ ) |
|
639 |
+ ) |
|
640 |
+ ) |
|
641 |
+ ), |
|
642 |
+ }; |
|
643 |
+ let tabelle__ : string = htmltable( |
|
644 |
+ tabelle_.kopf, |
|
645 |
+ tabelle_.rumpf, |
|
646 |
+ true |
|
647 |
+ ); |
|
648 |
+ let style = xmlwrap("style", "th,td {font-family: monospace; font-size: 0.875em;}"); |
|
649 |
+ return (style + tabelle__); |
|
650 |
+ } |
|
651 |
+ }, |
|
652 |
+ ], |
|
653 |
+ }; |
|
654 |
+} |
|
655 |
+ |
... | ... |
@@ -60,6 +60,7 @@ |
60 | 60 |
"source/content/word_functions.html.tpl", |
61 | 61 |
"source/content/word_functions-listentry.html.tpl", |
62 | 62 |
"source/content/adpositions.html.tpl", |
63 |
+ "source/content/adpositions-example.html.tpl", |
|
63 | 64 |
"source/content/pronouns.html.tpl", |
64 | 65 |
"source/content/dictionary.html.tpl", |
65 | 66 |
"source/content/examples.html.tpl", |
... | ... |
@@ -72,7 +73,22 @@ |
72 | 73 |
"build/draft.html" |
73 | 74 |
], |
74 | 75 |
"path": "tools/coin.sh" |
76 |
+ }, |
|
77 |
+ "sub": [ |
|
78 |
+ { |
|
79 |
+ "name": "vorlage-fsdraft", |
|
80 |
+ "type": "script", |
|
81 |
+ "parameters": { |
|
82 |
+ "inputs": [ |
|
83 |
+ "source/vorlage/fsdraft.ts" |
|
84 |
+ ], |
|
85 |
+ "outputs": [ |
|
86 |
+ "build/vorlage-fsdraft.js" |
|
87 |
+ ], |
|
88 |
+ "path": "tools/compile-vorlagemodul.sh" |
|
75 | 89 |
} |
90 |
+ } |
|
91 |
+ ] |
|
76 | 92 |
}, |
77 | 93 |
{ |
78 | 94 |
"name": "logic", |
... | ... |
@@ -1,262 +0,0 @@ |
1 |
-"use strict"; |
|
2 |
-exports.__esModule = true; |
|
3 |
-/** |
|
4 |
- * @author fenris |
|
5 |
- */ |
|
6 |
-function objvals(objekt) { |
|
7 |
- return Object.keys(objekt).map(function (key) { return objekt[key]; }); |
|
8 |
-} |
|
9 |
-/** |
|
10 |
- * @author fenris |
|
11 |
- */ |
|
12 |
-function merge(liste_x, liste_y, ordnung) { |
|
13 |
- if (liste_x.length <= 0) { |
|
14 |
- return liste_y; |
|
15 |
- } |
|
16 |
- else if (liste_y.length <= 0) { |
|
17 |
- return liste_x; |
|
18 |
- } |
|
19 |
- else { |
|
20 |
- return (ordnung(liste_x[0], liste_y[0]) |
|
21 |
- ? ([liste_x[0]].concat(merge(liste_x.slice(1), liste_y, ordnung))) |
|
22 |
- : ([liste_y[0]].concat(merge(liste_x, liste_y.slice(1), ordnung)))); |
|
23 |
- } |
|
24 |
-} |
|
25 |
-/** |
|
26 |
- * @author fenris |
|
27 |
- */ |
|
28 |
-function mergesort(liste, ordnung) { |
|
29 |
- if (liste.length <= 1) { |
|
30 |
- return liste; |
|
31 |
- } |
|
32 |
- else { |
|
33 |
- var n = (Math.floor(liste.length / 2)); |
|
34 |
- return merge(mergesort(liste.slice(0, n), ordnung), mergesort(liste.slice(n), ordnung), ordnung); |
|
35 |
- } |
|
36 |
-} |
|
37 |
-/** |
|
38 |
- * @author fenris |
|
39 |
- */ |
|
40 |
-function order_list(liste, kollation) { |
|
41 |
- if (kollation === void 0) { kollation = (function (x, y) { return (x === y); }); } |
|
42 |
- return (function (x, y) { |
|
43 |
- var i = liste["findIndex"](function (element) { return kollation(x, element); }); |
|
44 |
- var j = liste["findIndex"](function (element) { return kollation(y, element); }); |
|
45 |
- return (i <= j); |
|
46 |
- }); |
|
47 |
-} |
|
48 |
-/** |
|
49 |
- * @author fenris |
|
50 |
- */ |
|
51 |
-function order_lex(ordnungen) { |
|
52 |
- return (function (x, y) { |
|
53 |
- if ((ordnungen.length <= 0) |
|
54 |
- || |
|
55 |
- (x.length <= 0) |
|
56 |
- || |
|
57 |
- (y.length <= 0)) { |
|
58 |
- return true; |
|
59 |
- } |
|
60 |
- else { |
|
61 |
- var le = ordnungen[0](x[0], y[0]); |
|
62 |
- var ge = ordnungen[0](y[0], x[0]); |
|
63 |
- if (le && !ge) { |
|
64 |
- return true; |
|
65 |
- } |
|
66 |
- else if (!le && ge) { |
|
67 |
- return false; |
|
68 |
- } |
|
69 |
- else { |
|
70 |
- return order_lex(ordnungen.slice(1))(x.slice(1), y.slice(1)); |
|
71 |
- } |
|
72 |
- } |
|
73 |
- }); |
|
74 |
-} |
|
75 |
-/* |
|
76 |
- |
|
77 |
- +------+------+------+ |
|
78 |
- | xA | xB | xC | |
|
79 |
- +------+------+------+ |
|
80 |
- | a2 | b1 | c3 | |
|
81 |
- | a1 | b1 | c0 | |
|
82 |
- | a1 | b3 | c2 | |
|
83 |
- | a2 | b2 | c4 | |
|
84 |
- | a1 | b2 | c1 | |
|
85 |
- | a2 | b4 | c5 | |
|
86 |
- +------+------+------+ |
|
87 |
- |
|
88 |
- +------+------+------+------+------+ |
|
89 |
- | xA | xB:b1| xB:b2| xB:b3| xB:b4| |
|
90 |
- +------+------+------+------+------+ |
|
91 |
- | a1 | c0 | c1 | c2 | -- | |
|
92 |
- | a2 | c3 | c4 | -- | c5 | |
|
93 |
- +------+------+------+------+------+ |
|
94 |
- |
|
95 |
- */ |
|
96 |
-/** |
|
97 |
- * @author fenris |
|
98 |
- */ |
|
99 |
-function anordnen(_a) { |
|
100 |
- var daten = _a["daten"], namen_senkrecht = _a["senkrecht"], namen_waagerecht = _a["waagerecht"], _b = _a["kollationen"], kollationen = _b === void 0 ? {} : _b, _c = _a["ordnungen"], ordnungen = _c === void 0 ? {} : _c, _d = _a["feldsatz_kuerzen"], feldsatz_kuerzen = _d === void 0 ? true : _d, _e = _a["sortierung_propagieren"], sortierung_propagieren = _e === void 0 ? true : _e; |
|
101 |
- var kollation_satz = function (satz_x, satz_y, namen) { |
|
102 |
- return (namen.every(function (name) { return kollationen[name](satz_x[name], satz_y[name]); })); |
|
103 |
- }; |
|
104 |
- var sammeln = function (namen) { |
|
105 |
- var liste = []; |
|
106 |
- // Heraussuchen |
|
107 |
- daten |
|
108 |
- .forEach(function (satz_urspruenglich) { |
|
109 |
- var satz_neu = {}; |
|
110 |
- namen.forEach(function (name) { satz_neu[name] = satz_urspruenglich[name]; }); |
|
111 |
- var vorhanden = liste.some(function (satz_alt) { return kollation_satz(satz_alt, satz_neu, namen); }); |
|
112 |
- if (!vorhanden) { |
|
113 |
- liste.push(satz_neu); |
|
114 |
- } |
|
115 |
- }); |
|
116 |
- // Sortieren |
|
117 |
- liste = mergesort(liste, function (x, y) { |
|
118 |
- var x_ = namen.map(function (name) { return x[name]; }); |
|
119 |
- var y_ = namen.map(function (name) { return y[name]; }); |
|
120 |
- var ordnung = order_lex(namen.map(function (name) { return ordnungen[name]; })); |
|
121 |
- return ordnung(x_, y_); |
|
122 |
- }); |
|
123 |
- return liste; |
|
124 |
- }; |
|
125 |
- // Kollationen und Ordnungen vervollständigen |
|
126 |
- { |
|
127 |
- ([].concat(namen_senkrecht).concat(namen_waagerecht)) |
|
128 |
- .forEach(function (name) { |
|
129 |
- // Kollation ergänzen |
|
130 |
- if (!kollationen.hasOwnProperty(name)) { |
|
131 |
- kollationen[name] = (function (x, y) { return (x === y); }); |
|
132 |
- } |
|
133 |
- // Ordnung ergänzen |
|
134 |
- if (!ordnungen.hasOwnProperty(name)) { |
|
135 |
- ordnungen[name] = (sortierung_propagieren ? (function (x, y) { return false; }) : (function (x, y) { return (x <= y); })); |
|
136 |
- } |
|
137 |
- }); |
|
138 |
- } |
|
139 |
- var werte_senkrecht = sammeln(namen_senkrecht); |
|
140 |
- var werte_waagerecht = sammeln(namen_waagerecht); |
|
141 |
- var meta = { |
|
142 |
- "x": {}, |
|
143 |
- "y": {} |
|
144 |
- }; |
|
145 |
- werte_senkrecht.forEach(function (satz, nummer) { var name = ("y" + nummer.toFixed(0)); meta.y[name] = satz; }); |
|
146 |
- werte_waagerecht.forEach(function (satz, nummer) { var name = ("x" + nummer.toFixed(0)); meta.x[name] = satz; }); |
|
147 |
- var data = (Object.keys(meta.y) |
|
148 |
- .map(function (label_senkrecht) { |
|
149 |
- var satz_senkrecht = meta.y[label_senkrecht]; |
|
150 |
- var satz_ergebnis = {}; |
|
151 |
- // Kopf |
|
152 |
- { |
|
153 |
- var name_1 = "_"; |
|
154 |
- satz_ergebnis[name_1] = label_senkrecht; |
|
155 |
- } |
|
156 |
- // Rumpf |
|
157 |
- { |
|
158 |
- Object.keys(meta.x) |
|
159 |
- .forEach(function (label_waagerecht) { |
|
160 |
- var satz_waagerecht = meta.x[label_waagerecht]; |
|
161 |
- var saetze_feld = (daten |
|
162 |
- .filter(function (satz_urspruenglich) { return (kollation_satz(satz_urspruenglich, satz_senkrecht, namen_senkrecht) |
|
163 |
- && |
|
164 |
- kollation_satz(satz_urspruenglich, satz_waagerecht, namen_waagerecht)); }) |
|
165 |
- .map(function (satz_urspruenglich) { |
|
166 |
- var satz_neu = {}; |
|
167 |
- Object.keys(satz_urspruenglich) |
|
168 |
- .forEach(function (name) { |
|
169 |
- if (!feldsatz_kuerzen |
|
170 |
- || |
|
171 |
- (namen_senkrecht.every(function (name_) { return (name !== name_); }) |
|
172 |
- && |
|
173 |
- namen_waagerecht.every(function (name_) { return (name !== name_); }))) { |
|
174 |
- satz_neu[name] = satz_urspruenglich[name]; |
|
175 |
- } |
|
176 |
- }); |
|
177 |
- return satz_neu; |
|
178 |
- })); |
|
179 |
- satz_ergebnis[label_waagerecht] = saetze_feld; |
|
180 |
- }); |
|
181 |
- } |
|
182 |
- return satz_ergebnis; |
|
183 |
- })); |
|
184 |
- return { |
|
185 |
- "meta": meta, |
|
186 |
- "data": data |
|
187 |
- }; |
|
188 |
-} |
|
189 |
-/** |
|
190 |
- * @author fenris |
|
191 |
- */ |
|
192 |
-function xmlwrap(name, kern) { |
|
193 |
- return (("<" + name + ">") + kern + ("</" + name + ">") + "\n"); |
|
194 |
-} |
|
195 |
-/** |
|
196 |
- * @author fenris |
|
197 |
- */ |
|
198 |
-function htmltable(titel, daten, _2d) { |
|
199 |
- if (_2d === void 0) { _2d = false; } |
|
200 |
- return (xmlwrap("table", ( |
|
201 |
- // kopf |
|
202 |
- xmlwrap("thead", xmlwrap("tr", (titel |
|
203 |
- .map(function (titel_) { return xmlwrap("th", titel_); }) |
|
204 |
- .join("")))) |
|
205 |
- + |
|
206 |
- // rumpf |
|
207 |
- xmlwrap("tbody", (daten |
|
208 |
- .map(function (satz) { return xmlwrap("tr", satz.map(function (feld, nummer) { return ((_2d && (nummer === 0)) |
|
209 |
- ? xmlwrap("th", feld) |
|
210 |
- : xmlwrap("td", feld)); }) |
|
211 |
- .join("")); }) |
|
212 |
- .join("")))))); |
|
213 |
-} |
|
214 |
-/** |
|
215 |
- * @author kcf |
|
216 |
- */ |
|
217 |
-function definieren() { |
|
218 |
- return { |
|
219 |
- "name": "fold", |
|
220 |
- "befehle": [ |
|
221 |
- { |
|
222 |
- "name": "fold", |
|
223 |
- "funktion": function (args) { return function (wert) { |
|
224 |
- var senkrecht_ = ((args.length > 0) |
|
225 |
- ? args.shift() |
|
226 |
- : null); |
|
227 |
- var waagerecht_ = ((args.length > 0) |
|
228 |
- ? args.shift() |
|
229 |
- : null); |
|
230 |
- var senkrecht = ((senkrecht_ !== null) |
|
231 |
- ? senkrecht_.split("/") |
|
232 |
- : []); |
|
233 |
- var waagerecht = ((waagerecht_ !== null) |
|
234 |
- ? waagerecht_.split("/") |
|
235 |
- : []); |
|
236 |
- var tabelle = anordnen({ |
|
237 |
- "daten": wert, |
|
238 |
- "senkrecht": senkrecht, |
|
239 |
- "waagerecht": waagerecht |
|
240 |
- }); |
|
241 |
- var tabelle_ = { |
|
242 |
- "kopf": ([""].concat(Object.keys(tabelle.meta.x).map(function (label) { return ( |
|
243 |
- // JSON.stringify(tabelle.meta.x[label]) |
|
244 |
- objvals(tabelle.meta.x[label]).join("/")); }))), |
|
245 |
- "rumpf": tabelle.data.map(function (satz) { return (Object.keys(satz).map(function (label) { return ((label === "_") |
|
246 |
- // ? JSON.stringify(tabelle.meta.y[satz[label]]) |
|
247 |
- ? objvals(tabelle.meta.y[satz[label]]).join("/") |
|
248 |
- // : JSON.stringify(satz[label]) |
|
249 |
- : (satz[label] |
|
250 |
- .filter(function (x) { return (x["language_id"] === "flk"); }) |
|
251 |
- .map(function (x) { return x["words"].join(", "); }) |
|
252 |
- .join("; "))); })); }) |
|
253 |
- }; |
|
254 |
- var tabelle__ = htmltable(tabelle_.kopf, tabelle_.rumpf, true); |
|
255 |
- var style = xmlwrap("style", "td {font-style: italic;}"); |
|
256 |
- return (style + tabelle__); |
|
257 |
- }; } |
|
258 |
- }, |
|
259 |
- ] |
|
260 |
- }; |
|
261 |
-} |
|
262 |
-exports.definieren = definieren; |
... | ... |
@@ -17,7 +17,8 @@ const configuration = { |
17 | 17 |
function mark( |
18 | 18 |
core, |
19 | 19 |
classes |
20 |
-) { |
|
20 |
+) |
|
21 |
+{ |
|
21 | 22 |
const contains = ((list, entry) => (list.indexOf(entry) >= 0)); |
22 | 23 |
if (configuration["replace_fs_umlauts"]) { |
23 | 24 |
if ( |
... | ... |
@@ -41,7 +43,8 @@ function mark( |
41 | 43 |
function format_single( |
42 | 44 |
type, |
43 | 45 |
language |
44 |
-) { |
|
46 |
+) |
|
47 |
+{ |
|
45 | 48 |
return ( |
46 | 49 |
function (piece) { |
47 | 50 |
return mark(piece, [type, "lang_" + language]); |
... | ... |
@@ -56,7 +59,8 @@ function format_single( |
56 | 59 |
function format_list( |
57 | 60 |
type, |
58 | 61 |
language |
59 |
-) { |
|
62 |
+) |
|
63 |
+{ |
|
60 | 64 |
return ( |
61 | 65 |
function (pieces) { |
62 | 66 |
return ( |
... | ... |
@@ -76,7 +80,8 @@ function format_correlation( |
76 | 80 |
type, |
77 | 81 |
language_from = "flk", |
78 | 82 |
language_to = null |
79 |
-) { |
|
83 |
+) |
|
84 |
+{ |
|
80 | 85 |
if (language_to === null) language_to = configuration["target"]; |
81 | 86 |
return ( |
82 | 87 |
function (source) { |
... | ... |
@@ -99,20 +104,16 @@ function definieren() { |
99 | 104 |
"befehle": [ |
100 | 105 |
{ |
101 | 106 |
"name": "fsdraft_mark", |
102 |
- "funktion": function (args) { |
|
107 |
+ "funktion": (args) => (wert) => { |
|
103 | 108 |
let classes = rags; |
104 |
- return function (wert) { |
|
105 | 109 |
return mark(wert, classes); |
106 |
- }; |
|
107 | 110 |
} |
108 | 111 |
}, |
109 | 112 |
{ |
110 | 113 |
"name": "fsdraft_format_correlation", |
111 |
- "funktion": function (args) { |
|
114 |
+ "funktion": (args) => (wert) => { |
|
112 | 115 |
let type = args.shift(); |
113 |
- return function (wert) { |
|
114 | 116 |
return format_correlation(type)(wert); |
115 |
- }; |
|
116 | 117 |
} |
117 | 118 |
}, |
118 | 119 |
], |