Christian Fraß commited on 2018-08-21 21:40:56
Zeige 54 geänderte Dateien mit 1619 Einfügungen und 459 Löschungen.
| ... | ... |
@@ -1,99 +0,0 @@ |
| 1 |
-<?php |
|
| 2 |
- include_once("source/logic/server/data.php");
|
|
| 3 |
- include_once("source/logic/server/table.php");
|
|
| 4 |
- include_once("source/logic/server/misc.php");
|
|
| 5 |
- ?> |
|
| 6 |
-<section class="section" id="adpositions"> |
|
| 7 |
- <header>Adpositions</header> |
|
| 8 |
- <?php proposal(); ?> |
|
| 9 |
- <!-- |
|
| 10 |
- <p>The following list gives an overview over prepositions:</p> |
|
| 11 |
- --> |
|
| 12 |
-<?php |
|
| 13 |
- $data_adpositions = read_json("source/data/adpositions.json");
|
|
| 14 |
- // $data = $data_adpositions["words"]; |
|
| 15 |
- $data = $data_adpositions["situations"]; |
|
| 16 |
- {
|
|
| 17 |
- /* |
|
| 18 |
- {
|
|
| 19 |
- $data = sql_cross($data, $data_adpositions["situations"]); |
|
| 20 |
- $data = sql_select($data, function ($row) {return ($row["situation_id"] == $row["id"]);});
|
|
| 21 |
- $data = sql_order($data, function ($x, $y) {return ($x["situation_id"] >= $y["situation_id"]);});
|
|
| 22 |
- $data = sql_delete($data, ["situation_id", "id"]); |
|
| 23 |
- $data = sql_rename($data, "name", "situation_name"); |
|
| 24 |
- } |
|
| 25 |
- */ |
|
| 26 |
- {
|
|
| 27 |
- $data = sql_cross($data, $data_adpositions["words"]); |
|
| 28 |
- $data = sql_select($data, function ($row) {return ($row["situation_id"] == $row["id"]);});
|
|
| 29 |
- $data = sql_delete($data, ["situation_id", "id"]); |
|
| 30 |
- $data = sql_rename($data, "name", "situation_name"); |
|
| 31 |
- } |
|
| 32 |
- {
|
|
| 33 |
- $data = sql_cross($data, $data_adpositions["types"]); |
|
| 34 |
- $data = sql_select($data, function ($row) {return ($row["type_id"] == $row["id"]);});
|
|
| 35 |
- $data = sql_delete($data, ["type_id", "id"]); |
|
| 36 |
- $data = sql_rename($data, "name", "type_name"); |
|
| 37 |
- } |
|
| 38 |
- {
|
|
| 39 |
- $data = sql_cross($data, $data_adpositions["references"]); |
|
| 40 |
- $data = sql_select($data, function ($row) {return ($row["reference_id"] == $row["id"]);});
|
|
| 41 |
- $data = sql_delete($data, ["reference_id", "id"]); |
|
| 42 |
- $data = sql_rename($data, "name", "reference_name"); |
|
| 43 |
- } |
|
| 44 |
- } |
|
| 45 |
- |
|
| 46 |
- $table = new class_table |
|
| 47 |
- ( |
|
| 48 |
- [ |
|
| 49 |
- new class_column("Language", "language_id"),
|
|
| 50 |
- new class_column("Situation", "situation_name"),
|
|
| 51 |
- new class_column("Type", "type_name"),
|
|
| 52 |
- new class_column("Reference", "reference_name"),
|
|
| 53 |
- new class_column("Words", "words", function ($x) {return json_encode($x);}),
|
|
| 54 |
- ], |
|
| 55 |
- $data |
|
| 56 |
- ); |
|
| 57 |
- $table_ = $table->snap |
|
| 58 |
- ( |
|
| 59 |
- [ |
|
| 60 |
- "label_vertical" => function ($column) {return "";},
|
|
| 61 |
- "columns_vertical" => |
|
| 62 |
- [ |
|
| 63 |
- $table->columns_get()[1], |
|
| 64 |
- ], |
|
| 65 |
- "label_horizontal" => function ($column, $value) {return $value;},
|
|
| 66 |
- "columns_horizontal" => |
|
| 67 |
- [ |
|
| 68 |
- $table->columns_get()[2], |
|
| 69 |
- $table->columns_get()[3], |
|
| 70 |
- ], |
|
| 71 |
- "columns_data" => |
|
| 72 |
- [ |
|
| 73 |
- $table->columns_get()[0], |
|
| 74 |
- $table->columns_get()[4], |
|
| 75 |
- ], |
|
| 76 |
- "data_aggregator" => function ($values) |
|
| 77 |
- {
|
|
| 78 |
- return $values; |
|
| 79 |
- }, |
|
| 80 |
- "data_formatter" => function_chain |
|
| 81 |
- ( |
|
| 82 |
- [ |
|
| 83 |
- object_from_array("language_id"),
|
|
| 84 |
- object_map(object_attribute("words")),
|
|
| 85 |
- format_correlation("type_word"),
|
|
| 86 |
- ] |
|
| 87 |
- ), |
|
| 88 |
- ] |
|
| 89 |
- ); |
|
| 90 |
- $table_->generate(); |
|
| 91 |
- ?> |
|
| 92 |
- <p><?php echo(format_correlation("type_sentence")(["flk" => ["Ek skal varte foran."], "eng" => ["I will wait in front."]])); ?></p>
|
|
| 93 |
- <p><?php echo(format_correlation("type_sentence")(["flk" => ["Du mut blive bakan."], "eng" => ["You must stay in the back."]])); ?></p>
|
|
| 94 |
- <p><?php echo(format_correlation("type_sentence")(["flk" => ["Han sta nedan de brüg."], "eng" => ["He stands under the bridge."]])); ?></p>
|
|
| 95 |
- <p><?php echo(format_correlation("type_sentence")(["flk" => ["Hun flüg uvan de volker."], "eng" => ["She flies above the clouds."]])); ?></p>
|
|
| 96 |
- <p><?php echo(format_correlation("type_sentence")(["flk" => ["Vi kan gae in de timer."], "eng" => ["We can go into the room."]])); ?></p>
|
|
| 97 |
- <p><?php echo(format_correlation("type_sentence")(["flk" => ["Je skal löpe ut de hus."], "eng" => ["You shall run out of the house."]])); ?></p>
|
|
| 98 |
-</section> |
|
| 99 |
- |
| ... | ... |
@@ -0,0 +1,15 @@ |
| 1 |
+<section class="section" id="adpositions"> |
|
| 2 |
+ <header>Adpositions</header> |
|
| 3 |
+ {{call::_proposal.html.tpl}}
|
|
| 4 |
+ <!-- |
|
| 5 |
+ <p>The following list gives an overview over prepositions:</p> |
|
| 6 |
+ --> |
|
| 7 |
+ {{fold:adpositions.words:situation_id:type_id/reference_id}}
|
|
| 8 |
+ <p><?php echo(format_correlation("type_sentence")(["flk" => ["Ek skal varte foran."], "eng" => ["I will wait in front."]])); ?></p>
|
|
| 9 |
+ <p><?php echo(format_correlation("type_sentence")(["flk" => ["Du mut blive bakan."], "eng" => ["You must stay in the back."]])); ?></p>
|
|
| 10 |
+ <p><?php echo(format_correlation("type_sentence")(["flk" => ["Han sta nedan de brüg."], "eng" => ["He stands under the bridge."]])); ?></p>
|
|
| 11 |
+ <p><?php echo(format_correlation("type_sentence")(["flk" => ["Hun flüg uvan de volker."], "eng" => ["She flies above the clouds."]])); ?></p>
|
|
| 12 |
+ <p><?php echo(format_correlation("type_sentence")(["flk" => ["Vi kan gae in de timer."], "eng" => ["We can go into the room."]])); ?></p>
|
|
| 13 |
+ <p><?php echo(format_correlation("type_sentence")(["flk" => ["Je skal löpe ut de hus."], "eng" => ["You shall run out of the house."]])); ?></p>
|
|
| 14 |
+</section> |
|
| 15 |
+ |
| ... | ... |
@@ -1,78 +0,0 @@ |
| 1 |
-<?php |
|
| 2 |
- include_once("source/logic/server/data.php");
|
|
| 3 |
- include_once("source/logic/server/table.php");
|
|
| 4 |
- include_once("source/logic/server/misc.php");
|
|
| 5 |
- include_once("source/logic/server/sql.php");
|
|
| 6 |
- ?> |
|
| 7 |
-<section class="subsection" id="correlatives"> |
|
| 8 |
- <header>Correlatives</header> |
|
| 9 |
- <?php proposal(); ?> |
|
| 10 |
-<?php |
|
| 11 |
- $data_correlatives = read_json("source/data/correlatives.json");
|
|
| 12 |
- $data = $data_correlatives["words"]; |
|
| 13 |
- {
|
|
| 14 |
- {
|
|
| 15 |
- $data = sql_cross($data, $data_correlatives["domains"]); |
|
| 16 |
- $data = sql_select($data, function ($row) {return ($row["domain_id"] == $row["id"]);});
|
|
| 17 |
- $data = sql_delete($data, ["domain_id", "id"]); |
|
| 18 |
- $data = sql_rename($data, "name", "domain_name"); |
|
| 19 |
- } |
|
| 20 |
- {
|
|
| 21 |
- $data = sql_cross($data, $data_correlatives["types"]); |
|
| 22 |
- $data = sql_select($data, function ($row) {return ($row["type_id"] == $row["id"]);});
|
|
| 23 |
- $data = sql_delete($data, ["type_id", "id"]); |
|
| 24 |
- $data = sql_rename($data, "name", "type_name"); |
|
| 25 |
- } |
|
| 26 |
- } |
|
| 27 |
- |
|
| 28 |
- $table = new class_table |
|
| 29 |
- ( |
|
| 30 |
- [ |
|
| 31 |
- new class_column("Language", "language_id"),
|
|
| 32 |
- new class_column("Domain", "domain_name"),
|
|
| 33 |
- new class_column("Type", "type_name"),
|
|
| 34 |
- new class_column("Words", "words", function ($x) {return json_encode($x);}),
|
|
| 35 |
- ], |
|
| 36 |
- $data |
|
| 37 |
- ); |
|
| 38 |
- $table_ = $table->snap |
|
| 39 |
- ( |
|
| 40 |
- [ |
|
| 41 |
- "label_vertical" => function ($column) {return "";},
|
|
| 42 |
- "columns_vertical" => |
|
| 43 |
- [ |
|
| 44 |
- $table->columns_get()[1], |
|
| 45 |
- ], |
|
| 46 |
- "label_horizontal" => function ($column, $value) {return $value;},
|
|
| 47 |
- "columns_horizontal" => |
|
| 48 |
- [ |
|
| 49 |
- $table->columns_get()[2], |
|
| 50 |
- ], |
|
| 51 |
- "columns_data" => |
|
| 52 |
- [ |
|
| 53 |
- $table->columns_get()[0], |
|
| 54 |
- $table->columns_get()[3], |
|
| 55 |
- ], |
|
| 56 |
- "data_aggregator" => function ($values) |
|
| 57 |
- {
|
|
| 58 |
- return $values; |
|
| 59 |
- }, |
|
| 60 |
- "data_formatter" => function_chain |
|
| 61 |
- ( |
|
| 62 |
- [ |
|
| 63 |
- object_from_array("language_id"),
|
|
| 64 |
- object_map(object_attribute("words")),
|
|
| 65 |
- format_correlation("type_word"),
|
|
| 66 |
- ] |
|
| 67 |
- ), |
|
| 68 |
- ] |
|
| 69 |
- ); |
|
| 70 |
- $table_->generate(); |
|
| 71 |
- ?> |
|
| 72 |
- <div class="note note_information"> |
|
| 73 |
- <span class="note_content"> |
|
| 74 |
- <p>Some of these words are very unlikely to ever get used (e.g. <?php echo(mark("ni slag", ["type_word", "lang_flk"])); ?>). Nevertheless they exist and are listed for completeness.</p>
|
|
| 75 |
- </span> |
|
| 76 |
- </div> |
|
| 77 |
-</section> |
|
| 78 |
- |
| ... | ... |
@@ -0,0 +1,11 @@ |
| 1 |
+<section class="subsection" id="correlatives"> |
|
| 2 |
+ <header>Correlatives</header> |
|
| 3 |
+ {{call::_proposal.html.tpl}}
|
|
| 4 |
+ {{fold:correlatives.words:domain_id:type_id}}
|
|
| 5 |
+ <div class="note note_information"> |
|
| 6 |
+ <span class="note_content"> |
|
| 7 |
+ <p>Some of these words are very unlikely to ever get used (e.g. [[show:correlative_example|mark:type_word:lang_flk]]). Nevertheless they exist and are listed for completeness.</p> |
|
| 8 |
+ </span> |
|
| 9 |
+ </div> |
|
| 10 |
+</section> |
|
| 11 |
+ |
| ... | ... |
@@ -1,10 +1,12 @@ |
| 1 | 1 |
<!DOCTYPE HTML> |
| 2 |
-<?php include_once("source/logic/server/settings.php"); ?>
|
|
| 3 |
-<?php include_once("source/logic/server/misc.php"); ?>
|
|
| 4 | 2 |
<html> |
| 5 | 3 |
<head> |
| 6 | 4 |
<title>Folksprak -- Draft</title> |
| 7 |
- <?php include("source/content/meta.html.php"); ?>
|
|
| 5 |
+ <meta charset="utf-8"/> |
|
| 6 |
+ <meta name="author" content="Fenris Wolf"/> |
|
| 7 |
+ <meta name="description" content="draft for the constructed germanic zonal auxlang 'Folksprak'"/> |
|
| 8 |
+ <meta name="language" content="english"/> |
|
| 9 |
+ <meta name="keywords" content="language,germanic,constructed"/> |
|
| 8 | 10 |
<link rel="shortcut icon" type="image/png" href="favicon.png"/> |
| 9 | 11 |
<link rel="stylesheet" type="text/css" href="draft.css"/> |
| 10 | 12 |
<script type="text/javascript" src="draft.js"></script> |
| ... | ... |
@@ -20,34 +22,11 @@ |
| 20 | 22 |
<!-- |
| 21 | 23 |
titlepage |
| 22 | 24 |
--> |
| 23 |
-<?php |
|
| 24 |
- /* |
|
| 25 |
- echo |
|
| 26 |
- ( |
|
| 27 |
- function_chain |
|
| 28 |
- ( |
|
| 29 |
- [ |
|
| 30 |
- function ($x) {return $x+1;},
|
|
| 31 |
- function ($x) {return $x*2;},
|
|
| 32 |
- function ($x) {return $x/3;},
|
|
| 33 |
- ] |
|
| 34 |
- ) |
|
| 35 |
- (5) |
|
| 36 |
- ); |
|
| 37 |
- */ |
|
| 38 |
- compose |
|
| 39 |
- ( |
|
| 40 |
- [ |
|
| 41 |
- "introduction", |
|
| 42 |
- "basics", |
|
| 43 |
- "vocabulary", |
|
| 44 |
- "grammar", |
|
| 45 |
- "examples", |
|
| 46 |
- ] |
|
| 47 |
- ); |
|
| 48 |
- /* |
|
| 49 |
- */ |
|
| 50 |
- ?> |
|
| 25 |
+ {{call::introduction.html.tpl}}
|
|
| 26 |
+ {{call::basics.html.tpl}}
|
|
| 27 |
+ {{call::vocabulary.html.tpl}}
|
|
| 28 |
+ [[call::grammar.html.tpl]] |
|
| 29 |
+ [[call::examples.html.tpl]] |
|
| 51 | 30 |
</div> |
| 52 | 31 |
</body> |
| 53 | 32 |
</html> |
| ... | ... |
@@ -1,167 +0,0 @@ |
| 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 |
-/* |
|
| 8 |
-function convert_persona($persona) {return [0 => "impersonal", 1 => "1st person", 2 => "2nd person", 3 => "3rd person"][$persona];}
|
|
| 9 |
-function convert_numerus($numerus) {return [0 => null, 1 => "singular", 2 => "plural"][$numerus];}
|
|
| 10 |
-function convert_genus($genus) {return [0 => "common", 1 => "masculine", 2 => "feminine", 3 => "neuter"][$genus];}
|
|
| 11 |
- */ |
|
| 12 |
- ?> |
|
| 13 |
-<section class="subsection" id="personal_pronouns"> |
|
| 14 |
- <header>Personal Pronouns</header> |
|
| 15 |
-<?php |
|
| 16 |
- $data_common = read_json("source/data/common.json");
|
|
| 17 |
- $data_pronouns = read_json("source/data/personal_pronouns.json");
|
|
| 18 |
- |
|
| 19 |
- $data = $data_pronouns["words"]; |
|
| 20 |
- {
|
|
| 21 |
- {
|
|
| 22 |
- if (false) |
|
| 23 |
- {
|
|
| 24 |
- $data = sql_cross($data, $data_common["counts"]); |
|
| 25 |
- $data = sql_select($data, function ($row) {return ($row["count_id"] == $row["id"]);});
|
|
| 26 |
- $data = sql_delete($data, ["count_id", "id"]); |
|
| 27 |
- $data = sql_rename($data, "name", "count_name"); |
|
| 28 |
- } |
|
| 29 |
- else |
|
| 30 |
- {
|
|
| 31 |
- $data = sql_rename($data, "count_id", "count_name"); |
|
| 32 |
- } |
|
| 33 |
- } |
|
| 34 |
- {
|
|
| 35 |
- if (false) |
|
| 36 |
- {
|
|
| 37 |
- $data = sql_cross($data, $data_common["persons"]); |
|
| 38 |
- $data = sql_select($data, function ($row) {return ($row["person_id"] == $row["id"]);});
|
|
| 39 |
- $data = sql_delete($data, ["person_id", "id"]); |
|
| 40 |
- $data = sql_rename($data, "name", "person_name"); |
|
| 41 |
- } |
|
| 42 |
- else |
|
| 43 |
- {
|
|
| 44 |
- $data = sql_rename($data, "person_id", "person_name"); |
|
| 45 |
- } |
|
| 46 |
- } |
|
| 47 |
- {
|
|
| 48 |
- if (false) |
|
| 49 |
- {
|
|
| 50 |
- $data = sql_cross($data, $data_common["genders"]); |
|
| 51 |
- $data = sql_select($data, function ($row) {return ($row["gender_id"] == $row["id"]);});
|
|
| 52 |
- $data = sql_delete($data, ["gender_id", "id"]); |
|
| 53 |
- $data = sql_rename($data, "name", "gender_name"); |
|
| 54 |
- } |
|
| 55 |
- else |
|
| 56 |
- {
|
|
| 57 |
- $data = sql_rename($data, "gender_id", "gender_name"); |
|
| 58 |
- } |
|
| 59 |
- } |
|
| 60 |
- {
|
|
| 61 |
- if (false) |
|
| 62 |
- {
|
|
| 63 |
- $data = sql_cross($data, $data_pronouns["types"]); |
|
| 64 |
- $data = sql_select($data, function ($row) {return ($row["type_id"] == $row["id"]);});
|
|
| 65 |
- $data = sql_delete($data, ["type_id", "id"]); |
|
| 66 |
- $data = sql_rename($data, "name", "type_name"); |
|
| 67 |
- } |
|
| 68 |
- else |
|
| 69 |
- {
|
|
| 70 |
- $data = sql_rename($data, "type_id", "type_name"); |
|
| 71 |
- } |
|
| 72 |
- } |
|
| 73 |
- {
|
|
| 74 |
- if (false) |
|
| 75 |
- {
|
|
| 76 |
- $data = sql_cross($data, $data_common["cases"]); |
|
| 77 |
- $data = sql_select($data, function ($row) {return ($row["case_id"] == $row["id"]);});
|
|
| 78 |
- $data = sql_delete($data, ["case_id", "id"]); |
|
| 79 |
- $data = sql_rename($data, "name", "case_name"); |
|
| 80 |
- } |
|
| 81 |
- else |
|
| 82 |
- {
|
|
| 83 |
- $data = sql_rename($data, "case_id", "case_name"); |
|
| 84 |
- } |
|
| 85 |
- } |
|
| 86 |
- } |
|
| 87 |
- |
|
| 88 |
- {
|
|
| 89 |
- // $data = sql_select($data, function ($row) {return ($row["type_name"] == "nor");});
|
|
| 90 |
- $data = sql_select($data, function ($row) {global $configuration; return (($row["language_id"] == "flk") or ($row["language_id"] == $configuration["target"]));});
|
|
| 91 |
- } |
|
| 92 |
- |
|
| 93 |
- $table = new class_table |
|
| 94 |
- ( |
|
| 95 |
- [ |
|
| 96 |
- new class_column("Language", "language_id"),
|
|
| 97 |
- new class_column("Count", "count_name"),
|
|
| 98 |
- new class_column("Person", "person_name"),
|
|
| 99 |
- new class_column("Gender", "gender_name"),
|
|
| 100 |
- new class_column("Type", "type_name"),
|
|
| 101 |
- new class_column("Case", "case_name"),
|
|
| 102 |
- new class_column("Words", "words", function ($x) {return json_encode($x);}),
|
|
| 103 |
- ], |
|
| 104 |
- $data |
|
| 105 |
- ); |
|
| 106 |
- |
|
| 107 |
- $table->snap |
|
| 108 |
- ( |
|
| 109 |
- [ |
|
| 110 |
- "label_vertical" => function ($column) {return "";},
|
|
| 111 |
- "columns_vertical" => |
|
| 112 |
- [ |
|
| 113 |
- $table->columns_get()[1], |
|
| 114 |
- $table->columns_get()[2], |
|
| 115 |
- $table->columns_get()[3], |
|
| 116 |
- ], |
|
| 117 |
- "label_horizontal" => function ($column, $value) {return $value;},
|
|
| 118 |
- "columns_horizontal" => |
|
| 119 |
- [ |
|
| 120 |
- $table->columns_get()[4], |
|
| 121 |
- $table->columns_get()[5], |
|
| 122 |
- ], |
|
| 123 |
- "columns_data" => |
|
| 124 |
- [ |
|
| 125 |
- $table->columns_get()[0], |
|
| 126 |
- $table->columns_get()[6], |
|
| 127 |
- ], |
|
| 128 |
- "data_aggregator" => function ($values) |
|
| 129 |
- {
|
|
| 130 |
- return $values; |
|
| 131 |
- }, |
|
| 132 |
- "data_formatter" => function_chain |
|
| 133 |
- ( |
|
| 134 |
- [ |
|
| 135 |
- object_from_array("language_id"),
|
|
| 136 |
- object_map(object_attribute("words")),
|
|
| 137 |
- format_correlation("type_word"),
|
|
| 138 |
- ] |
|
| 139 |
- ), |
|
| 140 |
- ] |
|
| 141 |
- )->generate(); |
|
| 142 |
- ?> |
|
| 143 |
- <div class="note note_information"> |
|
| 144 |
- <span class="note_content"> |
|
| 145 |
- <p>Since the word <?php echo(mark("man", ["type_word", "lang_flk"])); ?> simply means <?php echo(mark("human being", ["type_word", "lang_en"])); ?>, it can be understood as an implicit way to express an abstract actor; similar words like <?php echo(mark("lüd", ["type_word", "lang_flk"])); ?> (<?php echo(mark("people", ["type_word", "lang_en"])); ?>) or <?php echo(mark("di", ["type_word", "lang_flk"])); ?> can be used as well.</p>
|
|
| 146 |
- </span> |
|
| 147 |
- </div> |
|
| 148 |
- <div class="note note_information"> |
|
| 149 |
- <span class="note_content"> |
|
| 150 |
- <p>The honorific salutation is expressed by the plural form <?php echo(mark("je", ["type_word", "lang_flk"])); ?>; however it should be avoided in usual speech in favor of the singular form <?php echo(mark("du", ["type_word", "lang_flk"])); ?>.</p>
|
|
| 151 |
- </span> |
|
| 152 |
- </div> |
|
| 153 |
- <div class="note note_information"> |
|
| 154 |
- <span class="note_content"> |
|
| 155 |
- <p>A reflexive genitive can be formed by inserting the word <?php echo(mark("egen", ["word", "lang_flk"])); ?> (<?php echo(mark("own", ["type_word", "lang_en"])); ?>), for example <?php echo(format_correlation("type_sentence")(["flk" => ["Han (A) hav givt to ham (B) hans egen buk."], "eng" => ["He (A) has given (to) him (B) his own book."]])); ?> (A's book was given to B).</p>
|
|
| 156 |
- </span> |
|
| 157 |
- </div> |
|
| 158 |
- <div class="note note_reasoning"> |
|
| 159 |
- <input type="checkbox" class="note_hide" title="click to show/hide" id="note_02"/> |
|
| 160 |
- <label class="note_label note_label_show" for="note_02">show</label> |
|
| 161 |
- <label class="note_label note_label_hide" for="note_02">hide</label> |
|
| 162 |
- <span class="note_content"> |
|
| 163 |
- <p>When finding appropriate personal pronouns, the most intricate cases were the 3rd person singular and the 2nd person plural; both turned out to be very diverse among the modern Germanic languages. While for the 2nd person plural we could find a sufficient satisfying solution after a while, the 3rd person singular kept defying. In the end we came to the settlement to use a Swedish-like solution including the pronoun <?php echo(mark("hen", ["type_word", "lang_flk"])); ?>, which is not bound to any sexus so that it can be used for actors in general.</p>
|
|
| 164 |
- </span> |
|
| 165 |
- </div> |
|
| 166 |
-</section> |
|
| 167 |
- |
| ... | ... |
@@ -0,0 +1,28 @@ |
| 1 |
+<section class="subsection" id="personal_pronouns"> |
|
| 2 |
+ <header>Personal Pronouns</header> |
|
| 3 |
+ {{fold:personal_pronouns.words:count_id/person_id/gender_id:type_id/case_id}}
|
|
| 4 |
+ <div class="note note_information"> |
|
| 5 |
+ <span class="note_content"> |
|
| 6 |
+ <p>Since the word <?php echo(mark("man", ["type_word", "lang_flk"])); ?> simply means <?php echo(mark("human being", ["type_word", "lang_en"])); ?>, it can be understood as an implicit way to express an abstract actor; similar words like <?php echo(mark("lüd", ["type_word", "lang_flk"])); ?> (<?php echo(mark("people", ["type_word", "lang_en"])); ?>) or <?php echo(mark("di", ["type_word", "lang_flk"])); ?> can be used as well.</p>
|
|
| 7 |
+ </span> |
|
| 8 |
+ </div> |
|
| 9 |
+ <div class="note note_information"> |
|
| 10 |
+ <span class="note_content"> |
|
| 11 |
+ <p>The honorific salutation is expressed by the plural form <?php echo(mark("je", ["type_word", "lang_flk"])); ?>; however it should be avoided in usual speech in favor of the singular form <?php echo(mark("du", ["type_word", "lang_flk"])); ?>.</p>
|
|
| 12 |
+ </span> |
|
| 13 |
+ </div> |
|
| 14 |
+ <div class="note note_information"> |
|
| 15 |
+ <span class="note_content"> |
|
| 16 |
+ <p>A reflexive genitive can be formed by inserting the word <?php echo(mark("egen", ["word", "lang_flk"])); ?> (<?php echo(mark("own", ["type_word", "lang_en"])); ?>), for example <?php echo(format_correlation("type_sentence")(["flk" => ["Han (A) hav givt to ham (B) hans egen buk."], "eng" => ["He (A) has given (to) him (B) his own book."]])); ?> (A's book was given to B).</p>
|
|
| 17 |
+ </span> |
|
| 18 |
+ </div> |
|
| 19 |
+ <div class="note note_reasoning"> |
|
| 20 |
+ <input type="checkbox" class="note_hide" title="click to show/hide" id="note_02"/> |
|
| 21 |
+ <label class="note_label note_label_show" for="note_02">show</label> |
|
| 22 |
+ <label class="note_label note_label_hide" for="note_02">hide</label> |
|
| 23 |
+ <span class="note_content"> |
|
| 24 |
+ <p>When finding appropriate personal pronouns, the most intricate cases were the 3rd person singular and the 2nd person plural; both turned out to be very diverse among the modern Germanic languages. While for the 2nd person plural we could find a sufficient satisfying solution after a while, the 3rd person singular kept defying. In the end we came to the settlement to use a Swedish-like solution including the pronoun <?php echo(mark("hen", ["type_word", "lang_flk"])); ?>, which is not bound to any sexus so that it can be used for actors in general.</p>
|
|
| 25 |
+ </span> |
|
| 26 |
+ </div> |
|
| 27 |
+</section> |
|
| 28 |
+ |
| ... | ... |
@@ -2,6 +2,6 @@ |
| 2 | 2 |
<header>Preface</header> |
| 3 | 3 |
<p>Folksprak is the name of a project that aims to construct an inter-Germanic zonal auxiliary language, which means a language that can be easily understood by any speaker of a Germanic language (a group numbering over 465 million native speakers with an additional 300 to 900 million speaking English as a second language) without ever having learned it.</p> |
| 4 | 4 |
<p>Folksprak is not meant to be designed by any one individual, but rather a collective work created by all interested parties; so you're welcome to participate.</p> |
| 5 |
- <p>The content of this document is the result of a collaboration between people from different parts on earth, connected by the internet. Its not a final specification for Folksprak, but a draft as a base to work on. Please let us know what you think about it and how you would improve it! You can find us in the IRC-Channel <span class="code">##folksprak</span> on <a href="irc://irc.freenode.net">irc.freenode.net</a>. You can also write an E-Mail to <a href="mailto:admin@folksprak.org">admin@folksprak.org</a>.</p> |
|
| 5 |
+ <p>The content of this document is the result of a collaboration between people from different parts on earth, connected by the internet. Its not a final specification for Folksprak, but a draft as a base to work on. Please let us know what you think about it and how you would improve it! You can find us in the IRC-Channel <span class="code">##folksprak</span> on <a href="irc://irc.freenode.net">irc.freenode.net</a>. You can also write an E-Mail to <a href="mailto:admin@folksprak.org">admin@folksprak.org</a> or leave thoughts at <a href="https://public.etherpad-mozilla.org/p/fs-draft">this Etherpad</a>.</p> |
|
| 6 | 6 |
</section> |
| 7 | 7 |
|
| ... | ... |
@@ -0,0 +1,20 @@ |
| 1 |
+const _fs = require("fs");
|
|
| 2 |
+ |
|
| 3 |
+let data_master = {};
|
|
| 4 |
+const dir_source = "source/data"; |
|
| 5 |
+_fs.readdir( |
|
| 6 |
+ dir_source, |
|
| 7 |
+ (error, names) => {
|
|
| 8 |
+ names.forEach( |
|
| 9 |
+ (name) => {
|
|
| 10 |
+ const path = (dir_source + "/" + name); |
|
| 11 |
+ const content = _fs.readFileSync(path); |
|
| 12 |
+ const data_segment = JSON.parse(content); |
|
| 13 |
+ const key = name.split(".")[0];
|
|
| 14 |
+ data_master[key] = data_segment; |
|
| 15 |
+ } |
|
| 16 |
+ ); |
|
| 17 |
+ console.info(JSON.stringify(data_master)); |
|
| 18 |
+ } |
|
| 19 |
+); |
|
| 20 |
+ |
| ... | ... |
@@ -7,9 +7,8 @@ |
| 7 | 7 |
"sub": [ |
| 8 | 8 |
{
|
| 9 | 9 |
"name": "structure", |
| 10 |
- "type": "php", |
|
| 10 |
+ "type": "script", |
|
| 11 | 11 |
"parameters": {
|
| 12 |
- "only_last": true, |
|
| 13 | 12 |
"inputs": [ |
| 14 | 13 |
"source/data/adpositions.json", |
| 15 | 14 |
"source/data/common.json", |
| ... | ... |
@@ -26,39 +25,42 @@ |
| 26 | 25 |
"source/logic/server/settings.php", |
| 27 | 26 |
"source/logic/server/table.php", |
| 28 | 27 |
"source/logic/server/sql.php", |
| 29 |
- "source/content/meta.html.php", |
|
| 30 |
- "source/content/introduction.html.php", |
|
| 31 |
- "source/content/preface.html.php", |
|
| 32 |
- "source/content/key_parameters.html.php", |
|
| 33 |
- "source/content/toc.html.php", |
|
| 34 |
- "source/content/basics.html.php", |
|
| 35 |
- "source/content/phonology_and_orthography.html.php", |
|
| 36 |
- "source/content/grammar.html.php", |
|
| 37 |
- "source/content/personal_pronouns.html.php", |
|
| 38 |
- "source/content/correlatives.html.php", |
|
| 39 |
- "source/content/conjugation.html.php", |
|
| 40 |
- "source/content/infinite_verbforms.html.php", |
|
| 41 |
- "source/content/modal_verbs.html.php", |
|
| 42 |
- "source/content/tempora_and_modi.html.php", |
|
| 43 |
- "source/content/negation.html.php", |
|
| 44 |
- "source/content/declension.html.php", |
|
| 45 |
- "source/content/numeri.html.php", |
|
| 46 |
- "source/content/cases.html.php", |
|
| 47 |
- "source/content/definiteness.html.php", |
|
| 48 |
- "source/content/attributes.html.php", |
|
| 49 |
- "source/content/sentence_structure.html.php", |
|
| 50 |
- "source/content/vocabulary.html.php", |
|
| 51 |
- "source/content/principles.html.php", |
|
| 52 |
- "source/content/word_functions.html.php", |
|
| 53 |
- "source/content/adpositions.html.php", |
|
| 54 |
- "source/content/pronouns.html.php", |
|
| 55 |
- "source/content/dictionary.html.php", |
|
| 56 |
- "source/content/examples.html.php", |
|
| 57 |
- "source/content/example_sentences.html.php", |
|
| 58 |
- "source/content/example_texts.html.php", |
|
| 59 |
- "source/content/draft.html.php" |
|
| 28 |
+ "source/content/meta.html.tpl", |
|
| 29 |
+ "source/content/introduction.html.tpl", |
|
| 30 |
+ "source/content/preface.html.tpl", |
|
| 31 |
+ "source/content/key_parameters.html.tpl", |
|
| 32 |
+ "source/content/toc.html.tpl", |
|
| 33 |
+ "source/content/basics.html.tpl", |
|
| 34 |
+ "source/content/phonology_and_orthography.html.tpl", |
|
| 35 |
+ "source/content/grammar.html.tpl", |
|
| 36 |
+ "source/content/personal_pronouns.html.tpl", |
|
| 37 |
+ "source/content/correlatives.html.tpl", |
|
| 38 |
+ "source/content/conjugation.html.tpl", |
|
| 39 |
+ "source/content/infinite_verbforms.html.tpl", |
|
| 40 |
+ "source/content/modal_verbs.html.tpl", |
|
| 41 |
+ "source/content/tempora_and_modi.html.tpl", |
|
| 42 |
+ "source/content/negation.html.tpl", |
|
| 43 |
+ "source/content/declension.html.tpl", |
|
| 44 |
+ "source/content/numeri.html.tpl", |
|
| 45 |
+ "source/content/cases.html.tpl", |
|
| 46 |
+ "source/content/definiteness.html.tpl", |
|
| 47 |
+ "source/content/attributes.html.tpl", |
|
| 48 |
+ "source/content/sentence_structure.html.tpl", |
|
| 49 |
+ "source/content/vocabulary.html.tpl", |
|
| 50 |
+ "source/content/principles.html.tpl", |
|
| 51 |
+ "source/content/word_functions.html.tpl", |
|
| 52 |
+ "source/content/adpositions.html.tpl", |
|
| 53 |
+ "source/content/pronouns.html.tpl", |
|
| 54 |
+ "source/content/dictionary.html.tpl", |
|
| 55 |
+ "source/content/examples.html.tpl", |
|
| 56 |
+ "source/content/example_sentences.html.tpl", |
|
| 57 |
+ "source/content/example_texts.html.tpl", |
|
| 58 |
+ "source/content/draft.html.tpl" |
|
| 60 | 59 |
], |
| 61 |
- "output": "build/draft.html" |
|
| 60 |
+ "outputs": [ |
|
| 61 |
+ "build/draft.html" |
|
| 62 |
+ ], |
|
| 63 |
+ "path": "tools/coin.sh" |
|
| 62 | 64 |
} |
| 63 | 65 |
}, |
| 64 | 66 |
{
|
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+"use strict"; |
|
| 2 |
+exports.__esModule = true; |
|
| 3 |
+/** |
|
| 4 |
+ * @author kcf |
|
| 5 |
+ */ |
|
| 6 |
+function encode(wert) {
|
|
| 7 |
+ return lib_code.base64_encode(wert); |
|
| 8 |
+} |
|
| 9 |
+/** |
|
| 10 |
+ * @author kcf |
|
| 11 |
+ */ |
|
| 12 |
+function definieren() {
|
|
| 13 |
+ return {
|
|
| 14 |
+ "name": "base64", |
|
| 15 |
+ "modifikatoren": {
|
|
| 16 |
+ "encode": [ |
|
| 17 |
+ {
|
|
| 18 |
+ "name": "base64", |
|
| 19 |
+ "funktion": function () { return function (wert) {
|
|
| 20 |
+ return encode(wert); |
|
| 21 |
+ }; } |
|
| 22 |
+ }, |
|
| 23 |
+ ] |
|
| 24 |
+ } |
|
| 25 |
+ }; |
|
| 26 |
+} |
|
| 27 |
+exports.definieren = definieren; |
| ... | ... |
@@ -0,0 +1,262 @@ |
| 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; |
| ... | ... |
@@ -0,0 +1,105 @@ |
| 1 |
+"use strict"; |
|
| 2 |
+exports.__esModule = true; |
|
| 3 |
+/** |
|
| 4 |
+ * @author fenris |
|
| 5 |
+ */ |
|
| 6 |
+function zeichenkette_zufaellig(laenge) {
|
|
| 7 |
+ var interpolieren = function (x, y, t) {
|
|
| 8 |
+ return (((1 - t) * x) + ((t) * y)); |
|
| 9 |
+ }; |
|
| 10 |
+ var zeichenkette = ""; |
|
| 11 |
+ for (var i = 0; i < laenge; ++i) {
|
|
| 12 |
+ var code = Math.floor(interpolieren(32, 128, Math.random())); |
|
| 13 |
+ zeichenkette += String.fromCharCode(code); |
|
| 14 |
+ } |
|
| 15 |
+ return zeichenkette; |
|
| 16 |
+} |
|
| 17 |
+/** |
|
| 18 |
+ * @author kcf |
|
| 19 |
+ */ |
|
| 20 |
+function escape_(wert) {
|
|
| 21 |
+ return (wert |
|
| 22 |
+ .replace(new RegExp("&", "g"), "&")
|
|
| 23 |
+ .replace(new RegExp("<", "g"), "<")
|
|
| 24 |
+ .replace(new RegExp(">", "g"), ">")
|
|
| 25 |
+ .replace(new RegExp("\"", "g"), """)
|
|
| 26 |
+ .replace(new RegExp("'", "g"), "'"));
|
|
| 27 |
+} |
|
| 28 |
+/** |
|
| 29 |
+ * @author kcf |
|
| 30 |
+ */ |
|
| 31 |
+function squelch(zeichenkette, laenge) {
|
|
| 32 |
+ var stuecke = []; |
|
| 33 |
+ var position = 0; |
|
| 34 |
+ var ende = zeichenkette.length; |
|
| 35 |
+ while (position < ende) {
|
|
| 36 |
+ var stueck = zeichenkette.slice(position, Math.min(ende, position + laenge)); |
|
| 37 |
+ stuecke.push(stueck); |
|
| 38 |
+ position += laenge; |
|
| 39 |
+ } |
|
| 40 |
+ return ("<span class=\"ninja\">"
|
|
| 41 |
+ + |
|
| 42 |
+ (stuecke |
|
| 43 |
+ .map(function (stueck) { return ([
|
|
| 44 |
+ ("<span>" + escape_(zeichenkette_zufaellig(laenge)) + "</span>"),
|
|
| 45 |
+ ("<span>" + escape_(stueck) + "</span>"),
|
|
| 46 |
+ ]); }) |
|
| 47 |
+ .reduce(function (x, y) { return x.concat(y); }, [])
|
|
| 48 |
+ .join(""))
|
|
| 49 |
+ + |
|
| 50 |
+ "</span>"); |
|
| 51 |
+} |
|
| 52 |
+/** |
|
| 53 |
+ * @author kcf |
|
| 54 |
+ */ |
|
| 55 |
+function habitus(modifikatoren) {
|
|
| 56 |
+ if (!(modifikatoren |
|
| 57 |
+ .some(function (modifikator) { return (((modifikator.art === "escape")
|
|
| 58 |
+ && |
|
| 59 |
+ (modifikator.angaben["ziel"] === "html")) |
|
| 60 |
+ || |
|
| 61 |
+ ((modifikator.art === "squelch") |
|
| 62 |
+ && |
|
| 63 |
+ (modifikator.angaben["ziel"] === "html"))); }))) {
|
|
| 64 |
+ return modifikatoren.concat([{ "art": "escape", "angaben": { "ziel": "html" } }]);
|
|
| 65 |
+ } |
|
| 66 |
+ else {
|
|
| 67 |
+ return modifikatoren; |
|
| 68 |
+ } |
|
| 69 |
+} |
|
| 70 |
+/** |
|
| 71 |
+ * @author kcf |
|
| 72 |
+ */ |
|
| 73 |
+function definieren() {
|
|
| 74 |
+ return {
|
|
| 75 |
+ "name": "html", |
|
| 76 |
+ "modifikatoren": {
|
|
| 77 |
+ "escape": [ |
|
| 78 |
+ {
|
|
| 79 |
+ "name": "html", |
|
| 80 |
+ "funktion": function () { return function (wert) {
|
|
| 81 |
+ return escape_(wert); |
|
| 82 |
+ }; } |
|
| 83 |
+ }, |
|
| 84 |
+ ], |
|
| 85 |
+ "squelch": [ |
|
| 86 |
+ {
|
|
| 87 |
+ "name": "html", |
|
| 88 |
+ "funktion": function (args) { return function (wert) {
|
|
| 89 |
+ var laenge = ((args.length > 0) ? parseInt(args.shift()) : 2); |
|
| 90 |
+ return squelch(wert, laenge); |
|
| 91 |
+ }; } |
|
| 92 |
+ }, |
|
| 93 |
+ ] |
|
| 94 |
+ }, |
|
| 95 |
+ "habiti": [ |
|
| 96 |
+ {
|
|
| 97 |
+ "name": "html", |
|
| 98 |
+ "funktion": function (modifikatoren) {
|
|
| 99 |
+ return habitus(modifikatoren); |
|
| 100 |
+ } |
|
| 101 |
+ }, |
|
| 102 |
+ ] |
|
| 103 |
+ }; |
|
| 104 |
+} |
|
| 105 |
+exports.definieren = definieren; |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+"use strict"; |
|
| 2 |
+exports.__esModule = true; |
|
| 3 |
+/** |
|
| 4 |
+ * @author kcf |
|
| 5 |
+ */ |
|
| 6 |
+function encode(wert) {
|
|
| 7 |
+ return lib_code.json_encode(wert); |
|
| 8 |
+} |
|
| 9 |
+/** |
|
| 10 |
+ * @author kcf |
|
| 11 |
+ */ |
|
| 12 |
+function definieren() {
|
|
| 13 |
+ return {
|
|
| 14 |
+ "name": "json", |
|
| 15 |
+ "modifikatoren": {
|
|
| 16 |
+ "encode": [ |
|
| 17 |
+ {
|
|
| 18 |
+ "name": "json", |
|
| 19 |
+ "funktion": function () { return function (wert) {
|
|
| 20 |
+ return encode(wert); |
|
| 21 |
+ }; } |
|
| 22 |
+ }, |
|
| 23 |
+ ] |
|
| 24 |
+ } |
|
| 25 |
+ }; |
|
| 26 |
+} |
|
| 27 |
+exports.definieren = definieren; |
| ... | ... |
@@ -0,0 +1,52 @@ |
| 1 |
+"use strict"; |
|
| 2 |
+exports.__esModule = true; |
|
| 3 |
+/** |
|
| 4 |
+ * @author kcf |
|
| 5 |
+ */ |
|
| 6 |
+function escape_(wert) {
|
|
| 7 |
+ return (wert |
|
| 8 |
+ .replace(new RegExp("\\\\", "g"), "\\\\")
|
|
| 9 |
+ .replace(new RegExp("%", "g"), "\\%")
|
|
| 10 |
+ .replace(new RegExp("&", "g"), "\\&"));
|
|
| 11 |
+} |
|
| 12 |
+/** |
|
| 13 |
+ * @author kcf |
|
| 14 |
+ */ |
|
| 15 |
+function habitus(modifikatoren) {
|
|
| 16 |
+ if (!(modifikatoren |
|
| 17 |
+ .some(function (modifikator) { return ((modifikator.art === "escape")
|
|
| 18 |
+ && |
|
| 19 |
+ (modifikator.angaben["ziel"] === "latex")); }))) {
|
|
| 20 |
+ return modifikatoren.concat([{ "art": "escape", "angaben": { "ziel": "latex" } }]);
|
|
| 21 |
+ } |
|
| 22 |
+ else {
|
|
| 23 |
+ return modifikatoren; |
|
| 24 |
+ } |
|
| 25 |
+} |
|
| 26 |
+/** |
|
| 27 |
+ * @author kcf |
|
| 28 |
+ */ |
|
| 29 |
+function definieren() {
|
|
| 30 |
+ return {
|
|
| 31 |
+ "name": "latex", |
|
| 32 |
+ "modifikatoren": {
|
|
| 33 |
+ "escape": [ |
|
| 34 |
+ {
|
|
| 35 |
+ "name": "latex", |
|
| 36 |
+ "funktion": function () { return function (wert) {
|
|
| 37 |
+ return escape_(wert); |
|
| 38 |
+ }; } |
|
| 39 |
+ }, |
|
| 40 |
+ ] |
|
| 41 |
+ }, |
|
| 42 |
+ "habiti": [ |
|
| 43 |
+ {
|
|
| 44 |
+ "name": "latex", |
|
| 45 |
+ "funktion": function (modifikatoren) {
|
|
| 46 |
+ return habitus(modifikatoren); |
|
| 47 |
+ } |
|
| 48 |
+ }, |
|
| 49 |
+ ] |
|
| 50 |
+ }; |
|
| 51 |
+} |
|
| 52 |
+exports.definieren = definieren; |
| ... | ... |
@@ -0,0 +1,52 @@ |
| 1 |
+"use strict"; |
|
| 2 |
+exports.__esModule = true; |
|
| 3 |
+/** |
|
| 4 |
+ * @author kcf |
|
| 5 |
+ */ |
|
| 6 |
+function escape_(wert) {
|
|
| 7 |
+ return (wert |
|
| 8 |
+ .replace(new RegExp("\\\\", "g"), "\\\\")
|
|
| 9 |
+ .replace(new RegExp("%", "g"), "\\%")
|
|
| 10 |
+ .replace(new RegExp("&", "g"), "\\&"));
|
|
| 11 |
+} |
|
| 12 |
+/** |
|
| 13 |
+ * @author kcf |
|
| 14 |
+ */ |
|
| 15 |
+function habitus(modifikatoren) {
|
|
| 16 |
+ if (!(modifikatoren |
|
| 17 |
+ .some(function (modifikator) { return ((modifikator.art === "escape")
|
|
| 18 |
+ && |
|
| 19 |
+ (modifikator.angaben["ziel"] === "markdown")); }))) {
|
|
| 20 |
+ return modifikatoren.concat([{ "art": "escape", "angaben": { "ziel": "markdown" } }]);
|
|
| 21 |
+ } |
|
| 22 |
+ else {
|
|
| 23 |
+ return modifikatoren; |
|
| 24 |
+ } |
|
| 25 |
+} |
|
| 26 |
+/** |
|
| 27 |
+ * @author kcf |
|
| 28 |
+ */ |
|
| 29 |
+function definieren() {
|
|
| 30 |
+ return {
|
|
| 31 |
+ "name": "markdown", |
|
| 32 |
+ "modifikatoren": {
|
|
| 33 |
+ "escape": [ |
|
| 34 |
+ {
|
|
| 35 |
+ "name": "markdown", |
|
| 36 |
+ "funktion": function () { return function (wert) {
|
|
| 37 |
+ return escape_(wert); |
|
| 38 |
+ }; } |
|
| 39 |
+ }, |
|
| 40 |
+ ] |
|
| 41 |
+ }, |
|
| 42 |
+ "habiti": [ |
|
| 43 |
+ {
|
|
| 44 |
+ "name": "markdown", |
|
| 45 |
+ "funktion": function (modifikatoren) {
|
|
| 46 |
+ return habitus(modifikatoren); |
|
| 47 |
+ } |
|
| 48 |
+ }, |
|
| 49 |
+ ] |
|
| 50 |
+ }; |
|
| 51 |
+} |
|
| 52 |
+exports.definieren = definieren; |
| ... | ... |
@@ -0,0 +1,50 @@ |
| 1 |
+"use strict"; |
|
| 2 |
+exports.__esModule = true; |
|
| 3 |
+/** |
|
| 4 |
+ * @author kcf |
|
| 5 |
+ */ |
|
| 6 |
+function escape_(wert) {
|
|
| 7 |
+ return (wert |
|
| 8 |
+ .replace("\'", "\\\'"));
|
|
| 9 |
+} |
|
| 10 |
+/** |
|
| 11 |
+ * @author kcf |
|
| 12 |
+ */ |
|
| 13 |
+function habitus(modifikatoren) {
|
|
| 14 |
+ if (!(modifikatoren |
|
| 15 |
+ .some(function (modifikator) { return ((modifikator.art === "escape")
|
|
| 16 |
+ && |
|
| 17 |
+ (modifikator.angaben["ziel"] === "sql")); }))) {
|
|
| 18 |
+ return modifikatoren.concat([{ "art": "escape", "angaben": { "ziel": "sql" } }]);
|
|
| 19 |
+ } |
|
| 20 |
+ else {
|
|
| 21 |
+ return modifikatoren; |
|
| 22 |
+ } |
|
| 23 |
+} |
|
| 24 |
+/** |
|
| 25 |
+ * @author kcf |
|
| 26 |
+ */ |
|
| 27 |
+function definieren() {
|
|
| 28 |
+ return {
|
|
| 29 |
+ "name": "sql", |
|
| 30 |
+ "modifikatoren": {
|
|
| 31 |
+ "escape": [ |
|
| 32 |
+ {
|
|
| 33 |
+ "name": "sql", |
|
| 34 |
+ "funktion": function () { return function (wert) {
|
|
| 35 |
+ return escape_(wert); |
|
| 36 |
+ }; } |
|
| 37 |
+ }, |
|
| 38 |
+ ] |
|
| 39 |
+ }, |
|
| 40 |
+ "habiti": [ |
|
| 41 |
+ {
|
|
| 42 |
+ "name": "sql", |
|
| 43 |
+ "funktion": function (modifikatoren) {
|
|
| 44 |
+ return habitus(modifikatoren); |
|
| 45 |
+ } |
|
| 46 |
+ }, |
|
| 47 |
+ ] |
|
| 48 |
+ }; |
|
| 49 |
+} |
|
| 50 |
+exports.definieren = definieren; |
| ... | ... |
@@ -0,0 +1,869 @@ |
| 1 |
+; |
|
| 2 |
+var lib_code; |
|
| 3 |
+(function (lib_code) {
|
|
| 4 |
+ /** |
|
| 5 |
+ * @author fenris |
|
| 6 |
+ */ |
|
| 7 |
+ function base64_encode(x) {
|
|
| 8 |
+ return (new Buffer(x)).toString("base64");
|
|
| 9 |
+ } |
|
| 10 |
+ lib_code.base64_encode = base64_encode; |
|
| 11 |
+ /** |
|
| 12 |
+ * @author fenris |
|
| 13 |
+ */ |
|
| 14 |
+ function json_encode(x) {
|
|
| 15 |
+ return JSON.stringify(x); |
|
| 16 |
+ } |
|
| 17 |
+ lib_code.json_encode = json_encode; |
|
| 18 |
+ /** |
|
| 19 |
+ * @author fenris |
|
| 20 |
+ */ |
|
| 21 |
+ function json_decode(x) {
|
|
| 22 |
+ return JSON.parse(x); |
|
| 23 |
+ } |
|
| 24 |
+ lib_code.json_decode = json_decode; |
|
| 25 |
+})(lib_code || (lib_code = {}));
|
|
| 26 |
+var lib_objekt; |
|
| 27 |
+(function (lib_objekt) {
|
|
| 28 |
+ /** |
|
| 29 |
+ * @author fenris |
|
| 30 |
+ */ |
|
| 31 |
+ function pfad_lesen(objekt, pfad) {
|
|
| 32 |
+ var schritte = ((pfad === "") |
|
| 33 |
+ ? [] |
|
| 34 |
+ : pfad.split("."));
|
|
| 35 |
+ var position = objekt; |
|
| 36 |
+ schritte |
|
| 37 |
+ .some(function (schritt) {
|
|
| 38 |
+ if (position.hasOwnProperty(schritt)) {
|
|
| 39 |
+ position = position[schritt]; |
|
| 40 |
+ return false; |
|
| 41 |
+ } |
|
| 42 |
+ else {
|
|
| 43 |
+ position = null; |
|
| 44 |
+ return true; |
|
| 45 |
+ } |
|
| 46 |
+ }); |
|
| 47 |
+ return position; |
|
| 48 |
+ } |
|
| 49 |
+ lib_objekt.pfad_lesen = pfad_lesen; |
|
| 50 |
+})(lib_objekt || (lib_objekt = {}));
|
|
| 51 |
+var lib_datei; |
|
| 52 |
+(function (lib_datei) {
|
|
| 53 |
+ /** |
|
| 54 |
+ * @author fenris |
|
| 55 |
+ */ |
|
| 56 |
+ function lesen(pfad) {
|
|
| 57 |
+ var _fs = require("fs");
|
|
| 58 |
+ var inhalt_ = _fs.readFileSync(pfad); |
|
| 59 |
+ var inhalt = inhalt_.toString(); |
|
| 60 |
+ return inhalt; |
|
| 61 |
+ } |
|
| 62 |
+ lib_datei.lesen = lesen; |
|
| 63 |
+})(lib_datei || (lib_datei = {}));
|
|
| 64 |
+var lib_regexp; |
|
| 65 |
+(function (lib_regexp) {
|
|
| 66 |
+ /** |
|
| 67 |
+ * @author fenris |
|
| 68 |
+ */ |
|
| 69 |
+ function erstellen_symbol(symbol) {
|
|
| 70 |
+ return { "art": "symbol", "angaben": { "symbol": symbol } };
|
|
| 71 |
+ } |
|
| 72 |
+ lib_regexp.erstellen_symbol = erstellen_symbol; |
|
| 73 |
+ /** |
|
| 74 |
+ * @author fenris |
|
| 75 |
+ */ |
|
| 76 |
+ function erstellen_joker() {
|
|
| 77 |
+ return { "art": "joker", "angaben": {} };
|
|
| 78 |
+ } |
|
| 79 |
+ lib_regexp.erstellen_joker = erstellen_joker; |
|
| 80 |
+ /** |
|
| 81 |
+ * @author fenris |
|
| 82 |
+ */ |
|
| 83 |
+ function erstellen_sequenz(teile) {
|
|
| 84 |
+ return { "art": "sequenz", "angaben": { "teile": teile } };
|
|
| 85 |
+ } |
|
| 86 |
+ lib_regexp.erstellen_sequenz = erstellen_sequenz; |
|
| 87 |
+ /** |
|
| 88 |
+ * @author fenris |
|
| 89 |
+ */ |
|
| 90 |
+ function erstellen_alternative(teile) {
|
|
| 91 |
+ return { "art": "alternative", "angaben": { "teile": teile } };
|
|
| 92 |
+ } |
|
| 93 |
+ lib_regexp.erstellen_alternative = erstellen_alternative; |
|
| 94 |
+ /** |
|
| 95 |
+ * @author fenris |
|
| 96 |
+ */ |
|
| 97 |
+ function erstellen_wiederholung(subjekt, min_, max_) {
|
|
| 98 |
+ return { "art": "wiederholung", "angaben": { "subjekt": subjekt, "min": min_, "max": max_ } };
|
|
| 99 |
+ } |
|
| 100 |
+ lib_regexp.erstellen_wiederholung = erstellen_wiederholung; |
|
| 101 |
+ /** |
|
| 102 |
+ * @author fenris |
|
| 103 |
+ */ |
|
| 104 |
+ function erstellen_klasse(modus, teile) {
|
|
| 105 |
+ return { "art": "klasse", "angaben": { "modus": modus, "teile": teile } };
|
|
| 106 |
+ } |
|
| 107 |
+ lib_regexp.erstellen_klasse = erstellen_klasse; |
|
| 108 |
+ /** |
|
| 109 |
+ * @author fenris |
|
| 110 |
+ */ |
|
| 111 |
+ function erstellen_gruppe(kern, greedy) {
|
|
| 112 |
+ if (greedy === void 0) { greedy = false; }
|
|
| 113 |
+ return { "art": "gruppe", "angaben": { "kern": kern, "greedy": greedy } };
|
|
| 114 |
+ } |
|
| 115 |
+ lib_regexp.erstellen_gruppe = erstellen_gruppe; |
|
| 116 |
+ /** |
|
| 117 |
+ * @author fenris |
|
| 118 |
+ */ |
|
| 119 |
+ function umwandeln(ausdruck, tiefe) {
|
|
| 120 |
+ if (tiefe === void 0) { tiefe = 0; }
|
|
| 121 |
+ var kern = null; |
|
| 122 |
+ switch (ausdruck.art) {
|
|
| 123 |
+ case "symbol": {
|
|
| 124 |
+ kern = (ausdruck.angaben["symbol"] |
|
| 125 |
+ .replace("?", "\\?")
|
|
| 126 |
+ .replace("+", "\\+")
|
|
| 127 |
+ .replace("*", "\\*")
|
|
| 128 |
+ .replace(".", "\\.")
|
|
| 129 |
+ .replace("\\", "\\\\")
|
|
| 130 |
+ .replace("(", "\\(")
|
|
| 131 |
+ .replace(")", "\\)")
|
|
| 132 |
+ .replace("[", "\\[")
|
|
| 133 |
+ .replace("]", "\\]")
|
|
| 134 |
+ .replace("{", "\\{")
|
|
| 135 |
+ .replace("}", "\\}"));
|
|
| 136 |
+ break; |
|
| 137 |
+ } |
|
| 138 |
+ case "joker": {
|
|
| 139 |
+ kern = "."; |
|
| 140 |
+ break; |
|
| 141 |
+ } |
|
| 142 |
+ case "sequenz": {
|
|
| 143 |
+ kern = (ausdruck.angaben["teile"] |
|
| 144 |
+ .map(function (x) { return umwandeln(x, tiefe + 1); })
|
|
| 145 |
+ .join(""));
|
|
| 146 |
+ break; |
|
| 147 |
+ } |
|
| 148 |
+ case "alternative": {
|
|
| 149 |
+ kern = (ausdruck.angaben["teile"] |
|
| 150 |
+ .map(function (x) { return umwandeln(x, tiefe + 1); })
|
|
| 151 |
+ .join("|"));
|
|
| 152 |
+ break; |
|
| 153 |
+ } |
|
| 154 |
+ case "wiederholung": {
|
|
| 155 |
+ var nachsatz = void 0; |
|
| 156 |
+ if (((ausdruck.angaben["min"] === null) |
|
| 157 |
+ || |
|
| 158 |
+ (ausdruck.angaben["min"] === 0)) |
|
| 159 |
+ && |
|
| 160 |
+ (ausdruck.angaben["max"] === 1)) {
|
|
| 161 |
+ nachsatz = "?"; |
|
| 162 |
+ } |
|
| 163 |
+ else if (((ausdruck.angaben["min"] === null) |
|
| 164 |
+ || |
|
| 165 |
+ (ausdruck.angaben["min"] === 0)) |
|
| 166 |
+ && |
|
| 167 |
+ (ausdruck.angaben["max"] === null)) {
|
|
| 168 |
+ nachsatz = "*"; |
|
| 169 |
+ } |
|
| 170 |
+ else if (((ausdruck.angaben["min"] === 1)) |
|
| 171 |
+ && |
|
| 172 |
+ (ausdruck.angaben["max"] === null)) {
|
|
| 173 |
+ nachsatz = "+"; |
|
| 174 |
+ } |
|
| 175 |
+ else {
|
|
| 176 |
+ nachsatz = ("{" + ausdruck.angaben["min"].toFixed(0) + "," + ausdruck.angaben["max"].toFixed(0) + "}");
|
|
| 177 |
+ } |
|
| 178 |
+ kern = (umwandeln(ausdruck.angaben["subjekt"], tiefe + 1) + nachsatz); |
|
| 179 |
+ break; |
|
| 180 |
+ } |
|
| 181 |
+ case "klasse": {
|
|
| 182 |
+ kern = ("["
|
|
| 183 |
+ + (ausdruck.angaben["modus"] ? "" : "^") |
|
| 184 |
+ + (ausdruck.angaben["teile"] |
|
| 185 |
+ .map(function (x) { return umwandeln(x, tiefe + 1); })
|
|
| 186 |
+ .join(""))
|
|
| 187 |
+ + "]"); |
|
| 188 |
+ break; |
|
| 189 |
+ } |
|
| 190 |
+ case "gruppe": {
|
|
| 191 |
+ kern = ("("
|
|
| 192 |
+ + umwandeln(ausdruck.angaben["kern"], tiefe + 1) |
|
| 193 |
+ + (ausdruck.angaben["greedy"] ? "?" : "") |
|
| 194 |
+ + ")"); |
|
| 195 |
+ break; |
|
| 196 |
+ } |
|
| 197 |
+ default: {
|
|
| 198 |
+ kern = "FCKU"; |
|
| 199 |
+ break; |
|
| 200 |
+ } |
|
| 201 |
+ } |
|
| 202 |
+ return ((tiefe === 0) |
|
| 203 |
+ ? ("" + kern + "")
|
|
| 204 |
+ : kern); |
|
| 205 |
+ } |
|
| 206 |
+ lib_regexp.umwandeln = umwandeln; |
|
| 207 |
+ /** |
|
| 208 |
+ * @author fenris |
|
| 209 |
+ */ |
|
| 210 |
+ function suchen_umgewandelt(ausdruck_, kette) {
|
|
| 211 |
+ var regexp = (new RegExp(ausdruck_, "g")); |
|
| 212 |
+ var funde = []; |
|
| 213 |
+ while (true) {
|
|
| 214 |
+ var ergebnis = regexp.exec(kette); |
|
| 215 |
+ if (ergebnis === null) {
|
|
| 216 |
+ break; |
|
| 217 |
+ } |
|
| 218 |
+ else {
|
|
| 219 |
+ funde.push({ "bereich": ergebnis[0], "kern": ergebnis[1] });
|
|
| 220 |
+ } |
|
| 221 |
+ } |
|
| 222 |
+ return funde; |
|
| 223 |
+ } |
|
| 224 |
+ lib_regexp.suchen_umgewandelt = suchen_umgewandelt; |
|
| 225 |
+ /** |
|
| 226 |
+ * @author fenris |
|
| 227 |
+ */ |
|
| 228 |
+ function suchen(ausdruck, kette) {
|
|
| 229 |
+ var ausdruck_ = umwandeln(ausdruck); |
|
| 230 |
+ // console.info(ausdruck_ + "\n") |
|
| 231 |
+ return suchen_umgewandelt(ausdruck_, kette); |
|
| 232 |
+ } |
|
| 233 |
+ lib_regexp.suchen = suchen; |
|
| 234 |
+})(lib_regexp || (lib_regexp = {}));
|
|
| 235 |
+var lib_args; |
|
| 236 |
+(function (lib_args) {
|
|
| 237 |
+ /** |
|
| 238 |
+ * @author fenris |
|
| 239 |
+ */ |
|
| 240 |
+ var muster_positioniert = (new RegExp("(.*)"));
|
|
| 241 |
+ var muster_benannt_lang = (new RegExp("--([^=]+)(?:=(.+))?"));
|
|
| 242 |
+ /** |
|
| 243 |
+ * @author fenris |
|
| 244 |
+ */ |
|
| 245 |
+ function zerlegen(kette) {
|
|
| 246 |
+ var ergebnis = {
|
|
| 247 |
+ "benannt": {},
|
|
| 248 |
+ "positioniert": [] |
|
| 249 |
+ }; |
|
| 250 |
+ var teile = (kette |
|
| 251 |
+ .split(new RegExp("\\s", "g"))
|
|
| 252 |
+ .filter(function (x) { return (x.length > 0); }));
|
|
| 253 |
+ teile |
|
| 254 |
+ .forEach(function (teil) {
|
|
| 255 |
+ // benannt |
|
| 256 |
+ {
|
|
| 257 |
+ var foo = muster_benannt_lang.exec(teil); |
|
| 258 |
+ if (foo !== null) {
|
|
| 259 |
+ var name_1 = foo[1]; |
|
| 260 |
+ var wert = foo[2]; |
|
| 261 |
+ if (!ergebnis.benannt.hasOwnProperty(name_1)) |
|
| 262 |
+ ergebnis.benannt[name_1] = []; |
|
| 263 |
+ ergebnis.benannt[name_1].push(wert); |
|
| 264 |
+ return; |
|
| 265 |
+ } |
|
| 266 |
+ } |
|
| 267 |
+ // positioniert |
|
| 268 |
+ {
|
|
| 269 |
+ var foo = muster_positioniert.exec(teil); |
|
| 270 |
+ if (foo !== null) {
|
|
| 271 |
+ var wert = foo[1]; |
|
| 272 |
+ ergebnis.positioniert.push(wert); |
|
| 273 |
+ return; |
|
| 274 |
+ } |
|
| 275 |
+ } |
|
| 276 |
+ }); |
|
| 277 |
+ return ergebnis; |
|
| 278 |
+ } |
|
| 279 |
+ /** |
|
| 280 |
+ * @author fenris |
|
| 281 |
+ */ |
|
| 282 |
+ function erzeugen(liste) {
|
|
| 283 |
+ return liste; |
|
| 284 |
+ } |
|
| 285 |
+ lib_args.erzeugen = erzeugen; |
|
| 286 |
+ /** |
|
| 287 |
+ * @author fenris |
|
| 288 |
+ */ |
|
| 289 |
+ function parsen(argdesc, args) {
|
|
| 290 |
+ var args_ = zerlegen(args.join(" "));
|
|
| 291 |
+ var args__ = {};
|
|
| 292 |
+ Object.keys(argdesc) |
|
| 293 |
+ .forEach(function (id) {
|
|
| 294 |
+ var eintrag = argdesc[id]; |
|
| 295 |
+ switch (eintrag["art"]) {
|
|
| 296 |
+ case "positioniert": {
|
|
| 297 |
+ if (args_.positioniert.length > eintrag["index"]) {
|
|
| 298 |
+ var rawval = args_.positioniert[eintrag["index"]]; |
|
| 299 |
+ var entnahme = (eintrag.hasOwnProperty("entnahme")
|
|
| 300 |
+ ? eintrag["entnahme"] |
|
| 301 |
+ : (function (x) { return x; }));
|
|
| 302 |
+ var wert = entnahme(rawval); |
|
| 303 |
+ args__[id] = wert; |
|
| 304 |
+ } |
|
| 305 |
+ else {
|
|
| 306 |
+ throw (new Error("zu wenig positionierte Argumente übergeben"));
|
|
| 307 |
+ } |
|
| 308 |
+ break; |
|
| 309 |
+ } |
|
| 310 |
+ case "benannt": {
|
|
| 311 |
+ var rawvals = (args_.benannt.hasOwnProperty(eintrag["kennung"]) |
|
| 312 |
+ ? args_.benannt[eintrag["kennung"]] |
|
| 313 |
+ : []); |
|
| 314 |
+ var entnahme = (eintrag.hasOwnProperty("entnahme")
|
|
| 315 |
+ ? eintrag["entnahme"] |
|
| 316 |
+ : (function (x) { return x; }));
|
|
| 317 |
+ var wert = entnahme(rawvals); |
|
| 318 |
+ args__[id] = wert; |
|
| 319 |
+ break; |
|
| 320 |
+ } |
|
| 321 |
+ default: {
|
|
| 322 |
+ console.warn("unbehandelt");
|
|
| 323 |
+ break; |
|
| 324 |
+ } |
|
| 325 |
+ } |
|
| 326 |
+ }); |
|
| 327 |
+ return args__; |
|
| 328 |
+ } |
|
| 329 |
+ lib_args.parsen = parsen; |
|
| 330 |
+ /** |
|
| 331 |
+ * @author fenris |
|
| 332 |
+ */ |
|
| 333 |
+ function hilfe(argdesc) {
|
|
| 334 |
+ /* |
|
| 335 |
+ Object.keys(argdesc) |
|
| 336 |
+ .forEach( |
|
| 337 |
+ |
|
| 338 |
+ ) |
|
| 339 |
+ */ |
|
| 340 |
+ return "SYNTAX: vorlage.js <pfad-zur-vorlagedatei> [--habitus=<habitus>] [--zeichen-auf=<zeichen-auf>] [--zeichen-zu=<zeichen-zu>] [--modul=<pfad-zu-modul>] [--modul=<pfad-zu-modul>] [--modul=<pfad-zu-modul>] …"; |
|
| 341 |
+ } |
|
| 342 |
+ lib_args.hilfe = hilfe; |
|
| 343 |
+})(lib_args || (lib_args = {}));
|
|
| 344 |
+var mod_kern; |
|
| 345 |
+(function (mod_kern) {
|
|
| 346 |
+ /** |
|
| 347 |
+ * @author fenris |
|
| 348 |
+ */ |
|
| 349 |
+ var _befehle = {};
|
|
| 350 |
+ /** |
|
| 351 |
+ * @author fenris |
|
| 352 |
+ */ |
|
| 353 |
+ var _modifikatoren_encode = {};
|
|
| 354 |
+ /** |
|
| 355 |
+ * @author fenris |
|
| 356 |
+ */ |
|
| 357 |
+ var _modifikatoren_escape = {};
|
|
| 358 |
+ /** |
|
| 359 |
+ * @author fenris |
|
| 360 |
+ */ |
|
| 361 |
+ var _modifikatoren_squelch = {};
|
|
| 362 |
+ /** |
|
| 363 |
+ * @author fenris |
|
| 364 |
+ */ |
|
| 365 |
+ var _habiti = {};
|
|
| 366 |
+ /** |
|
| 367 |
+ * @author fenris |
|
| 368 |
+ */ |
|
| 369 |
+ var _erweiterungen = {};
|
|
| 370 |
+ /** |
|
| 371 |
+ * @author fenris |
|
| 372 |
+ */ |
|
| 373 |
+ function befehl_hinzufuegen(name, funktion) {
|
|
| 374 |
+ _befehle[name] = funktion; |
|
| 375 |
+ } |
|
| 376 |
+ mod_kern.befehl_hinzufuegen = befehl_hinzufuegen; |
|
| 377 |
+ /** |
|
| 378 |
+ * @author fenris |
|
| 379 |
+ */ |
|
| 380 |
+ function modifikator_id_ermitteln(weg) {
|
|
| 381 |
+ return weg.join(".");
|
|
| 382 |
+ } |
|
| 383 |
+ /** |
|
| 384 |
+ * @author fenris |
|
| 385 |
+ */ |
|
| 386 |
+ function modifikator_hinzufuegen_escape(name, funktion) {
|
|
| 387 |
+ _modifikatoren_escape[name] = funktion; |
|
| 388 |
+ } |
|
| 389 |
+ mod_kern.modifikator_hinzufuegen_escape = modifikator_hinzufuegen_escape; |
|
| 390 |
+ /** |
|
| 391 |
+ * @author fenris |
|
| 392 |
+ */ |
|
| 393 |
+ function modifikator_hinzufuegen_squelch(name, funktion) {
|
|
| 394 |
+ _modifikatoren_squelch[name] = funktion; |
|
| 395 |
+ } |
|
| 396 |
+ mod_kern.modifikator_hinzufuegen_squelch = modifikator_hinzufuegen_squelch; |
|
| 397 |
+ /** |
|
| 398 |
+ * @author fenris |
|
| 399 |
+ */ |
|
| 400 |
+ function modifikator_hinzufuegen_encode(name, funktion) {
|
|
| 401 |
+ _modifikatoren_encode[name] = funktion; |
|
| 402 |
+ } |
|
| 403 |
+ mod_kern.modifikator_hinzufuegen_encode = modifikator_hinzufuegen_encode; |
|
| 404 |
+ /** |
|
| 405 |
+ * @author fenris |
|
| 406 |
+ */ |
|
| 407 |
+ function habitus_hinzufuegen(name, funktion) {
|
|
| 408 |
+ _habiti[name] = funktion; |
|
| 409 |
+ } |
|
| 410 |
+ mod_kern.habitus_hinzufuegen = habitus_hinzufuegen; |
|
| 411 |
+ /** |
|
| 412 |
+ * @author fenris |
|
| 413 |
+ */ |
|
| 414 |
+ function erweiterung_erfassen(name, einrichtung) {
|
|
| 415 |
+ _erweiterungen[name] = einrichtung; |
|
| 416 |
+ } |
|
| 417 |
+ mod_kern.erweiterung_erfassen = erweiterung_erfassen; |
|
| 418 |
+ /** |
|
| 419 |
+ * @author fenris |
|
| 420 |
+ */ |
|
| 421 |
+ function erweiterung_laden(name) {
|
|
| 422 |
+ if (_erweiterungen.hasOwnProperty(name)) {
|
|
| 423 |
+ _erweiterungen[name](); |
|
| 424 |
+ } |
|
| 425 |
+ else {
|
|
| 426 |
+ var nachricht = ("keine Erweiterung namens '" + name + "' gefunden");
|
|
| 427 |
+ throw (new Error(nachricht)); |
|
| 428 |
+ } |
|
| 429 |
+ } |
|
| 430 |
+ mod_kern.erweiterung_laden = erweiterung_laden; |
|
| 431 |
+ /** |
|
| 432 |
+ * @author kcf |
|
| 433 |
+ */ |
|
| 434 |
+ function erweiterung_einrichten(raw) {
|
|
| 435 |
+ erweiterung_erfassen(raw["name"], function () {
|
|
| 436 |
+ // befehle |
|
| 437 |
+ {
|
|
| 438 |
+ (raw["befehle"] || []) |
|
| 439 |
+ .forEach(function (raw_cmd) {
|
|
| 440 |
+ befehl_hinzufuegen(raw_cmd["name"], raw_cmd["funktion"]); |
|
| 441 |
+ }); |
|
| 442 |
+ } |
|
| 443 |
+ // modifikator_encode |
|
| 444 |
+ {
|
|
| 445 |
+ if (raw.hasOwnProperty("modifikatoren")
|
|
| 446 |
+ && |
|
| 447 |
+ raw["modifikatoren"].hasOwnProperty("encode")) {
|
|
| 448 |
+ raw["modifikatoren"]["encode"] |
|
| 449 |
+ .forEach(function (raw_mod) {
|
|
| 450 |
+ modifikator_hinzufuegen_encode(raw_mod["name"], raw_mod["funktion"]); |
|
| 451 |
+ }); |
|
| 452 |
+ } |
|
| 453 |
+ else {
|
|
| 454 |
+ // nichts tun |
|
| 455 |
+ } |
|
| 456 |
+ } |
|
| 457 |
+ // modifikator_escape |
|
| 458 |
+ {
|
|
| 459 |
+ if (raw.hasOwnProperty("modifikatoren")
|
|
| 460 |
+ && |
|
| 461 |
+ raw["modifikatoren"].hasOwnProperty("escape")) {
|
|
| 462 |
+ raw["modifikatoren"]["escape"] |
|
| 463 |
+ .forEach(function (raw_mod) {
|
|
| 464 |
+ modifikator_hinzufuegen_escape(raw_mod["name"], raw_mod["funktion"]); |
|
| 465 |
+ }); |
|
| 466 |
+ } |
|
| 467 |
+ else {
|
|
| 468 |
+ // nichts tun |
|
| 469 |
+ } |
|
| 470 |
+ } |
|
| 471 |
+ // modifikator_squelch |
|
| 472 |
+ {
|
|
| 473 |
+ if (raw.hasOwnProperty("modifikatoren")
|
|
| 474 |
+ && |
|
| 475 |
+ raw["modifikatoren"].hasOwnProperty("squelch")) {
|
|
| 476 |
+ raw["modifikatoren"]["squelch"] |
|
| 477 |
+ .forEach(function (raw_mod) {
|
|
| 478 |
+ modifikator_hinzufuegen_squelch(raw_mod["name"], raw_mod["funktion"]); |
|
| 479 |
+ }); |
|
| 480 |
+ } |
|
| 481 |
+ else {
|
|
| 482 |
+ // nichts tun |
|
| 483 |
+ } |
|
| 484 |
+ } |
|
| 485 |
+ // modifikator_habitus |
|
| 486 |
+ {
|
|
| 487 |
+ if (raw.hasOwnProperty("habiti")) {
|
|
| 488 |
+ raw["habiti"] |
|
| 489 |
+ .forEach(function (raw_hab) {
|
|
| 490 |
+ habitus_hinzufuegen(raw_hab["name"], raw_hab["funktion"]); |
|
| 491 |
+ }); |
|
| 492 |
+ } |
|
| 493 |
+ else {
|
|
| 494 |
+ // nichts tun |
|
| 495 |
+ } |
|
| 496 |
+ } |
|
| 497 |
+ }); |
|
| 498 |
+ // erweiterung_laden(raw["name"]); |
|
| 499 |
+ } |
|
| 500 |
+ mod_kern.erweiterung_einrichten = erweiterung_einrichten; |
|
| 501 |
+ /** |
|
| 502 |
+ * @author fenris |
|
| 503 |
+ */ |
|
| 504 |
+ function befehl_show(angaben, vardesc, modifikatoren, habitus) {
|
|
| 505 |
+ var wert = lib_objekt.pfad_lesen(angaben, vardesc); |
|
| 506 |
+ if (!(wert === null)) {
|
|
| 507 |
+ // habitus |
|
| 508 |
+ {
|
|
| 509 |
+ if (!(habitus === null)) {
|
|
| 510 |
+ if (_habiti.hasOwnProperty(habitus)) {
|
|
| 511 |
+ modifikatoren = _habiti[habitus](modifikatoren); |
|
| 512 |
+ } |
|
| 513 |
+ else {
|
|
| 514 |
+ var nachricht = ("-- unbekannter Habitus \"" + habitus + "\"");
|
|
| 515 |
+ console.warn(nachricht + "\n"); |
|
| 516 |
+ } |
|
| 517 |
+ } |
|
| 518 |
+ else {
|
|
| 519 |
+ // nichts tun |
|
| 520 |
+ } |
|
| 521 |
+ } |
|
| 522 |
+ // modifikatoren |
|
| 523 |
+ {
|
|
| 524 |
+ modifikatoren |
|
| 525 |
+ .forEach(function (modifikator) {
|
|
| 526 |
+ switch (modifikator.art) {
|
|
| 527 |
+ case "format": {
|
|
| 528 |
+ var nachricht = "-- Formatierung nicht korrekt implemtiert"; |
|
| 529 |
+ console.error(nachricht + "\n"); |
|
| 530 |
+ var format = modifikator.angaben["format"]; |
|
| 531 |
+ // wert = (format_ % wert) |
|
| 532 |
+ wert = String(wert); |
|
| 533 |
+ break; |
|
| 534 |
+ } |
|
| 535 |
+ case "encode": {
|
|
| 536 |
+ var kodierung = modifikator.angaben["kodierung"]; |
|
| 537 |
+ if (_modifikatoren_encode.hasOwnProperty(kodierung)) {
|
|
| 538 |
+ wert = _modifikatoren_encode[kodierung](modifikator.angaben["argumente"])(wert); |
|
| 539 |
+ } |
|
| 540 |
+ else {
|
|
| 541 |
+ var nachricht = ("-- unbekannte Kodierung \"" + kodierung + "\"");
|
|
| 542 |
+ console.warn(nachricht + "\n"); |
|
| 543 |
+ } |
|
| 544 |
+ break; |
|
| 545 |
+ } |
|
| 546 |
+ case "escape": {
|
|
| 547 |
+ var ziel = modifikator.angaben["ziel"]; |
|
| 548 |
+ if (_modifikatoren_escape.hasOwnProperty(ziel)) {
|
|
| 549 |
+ wert = _modifikatoren_escape[ziel](modifikator.angaben["argumente"])(wert); |
|
| 550 |
+ } |
|
| 551 |
+ else {
|
|
| 552 |
+ var nachricht = ("-- unbekanntes Ziel \"" + ziel + "\"");
|
|
| 553 |
+ console.warn(nachricht + "\n"); |
|
| 554 |
+ } |
|
| 555 |
+ break; |
|
| 556 |
+ } |
|
| 557 |
+ case "squelch": {
|
|
| 558 |
+ var ziel = modifikator.angaben["ziel"]; |
|
| 559 |
+ if (_modifikatoren_squelch.hasOwnProperty(ziel)) {
|
|
| 560 |
+ wert = _modifikatoren_squelch[ziel](modifikator.angaben["argumente"])(wert); |
|
| 561 |
+ } |
|
| 562 |
+ else {
|
|
| 563 |
+ var nachricht = ("-- unbekanntes Ziel \"" + ziel + "\"");
|
|
| 564 |
+ console.warn(nachricht + "\n"); |
|
| 565 |
+ } |
|
| 566 |
+ break; |
|
| 567 |
+ } |
|
| 568 |
+ default: {
|
|
| 569 |
+ var nachricht = ("-- unbekannter Modifikator \"" + modifikator.art + "\"");
|
|
| 570 |
+ console.warn(nachricht + "\n"); |
|
| 571 |
+ break; |
|
| 572 |
+ } |
|
| 573 |
+ } |
|
| 574 |
+ }); |
|
| 575 |
+ } |
|
| 576 |
+ if (!(typeof (wert) === "string")) {
|
|
| 577 |
+ wert = String(wert); |
|
| 578 |
+ var nachricht = ("-- implizite Konversion zu Zeichenkette bei \"" + vardesc + "\"");
|
|
| 579 |
+ console.warn(nachricht + "\n"); |
|
| 580 |
+ } |
|
| 581 |
+ else {
|
|
| 582 |
+ // nichts tun |
|
| 583 |
+ } |
|
| 584 |
+ return wert; |
|
| 585 |
+ } |
|
| 586 |
+ else {
|
|
| 587 |
+ var nachricht = ("-- fehlende Angabe: \"" + vardesc + "\"");
|
|
| 588 |
+ console.warn(nachricht + "\n"); |
|
| 589 |
+ return null; |
|
| 590 |
+ } |
|
| 591 |
+ } |
|
| 592 |
+ /** |
|
| 593 |
+ * @author fenris |
|
| 594 |
+ */ |
|
| 595 |
+ function befehl_dataurl(angaben, vardesc, mimetype) {
|
|
| 596 |
+ var wert = lib_objekt.pfad_lesen(angaben, vardesc); |
|
| 597 |
+ if (!(wert === null)) {
|
|
| 598 |
+ wert = ("data" + ":" + mimetype + ";" + "base64" + "," + lib_code.base64_encode(wert));
|
|
| 599 |
+ return wert; |
|
| 600 |
+ } |
|
| 601 |
+ else {
|
|
| 602 |
+ var nachricht = ("-- fehlende Angabe: \"" + vardesc + "\"");
|
|
| 603 |
+ console.warn(nachricht + "\n"); |
|
| 604 |
+ return null; |
|
| 605 |
+ } |
|
| 606 |
+ } |
|
| 607 |
+ /** |
|
| 608 |
+ * @author fenris |
|
| 609 |
+ */ |
|
| 610 |
+ function befehl_call(einstellungen, angaben, vardesc, pfad) {
|
|
| 611 |
+ var wert = lib_objekt.pfad_lesen(angaben, vardesc); |
|
| 612 |
+ if (!(wert === null)) {
|
|
| 613 |
+ var angaben_ = wert; |
|
| 614 |
+ var ergebnis = ausfuellen(einstellungen, pfad, angaben_); |
|
| 615 |
+ return ergebnis; |
|
| 616 |
+ } |
|
| 617 |
+ else {
|
|
| 618 |
+ var nachricht = ("-- fehlende Angabe: \"" + vardesc + "\"");
|
|
| 619 |
+ console.warn(nachricht + "\n"); |
|
| 620 |
+ return null; |
|
| 621 |
+ } |
|
| 622 |
+ } |
|
| 623 |
+ /** |
|
| 624 |
+ * @author fenris |
|
| 625 |
+ */ |
|
| 626 |
+ function befehl_branch(einstellungen, angaben, vardesc_bedingung, pfad_falls, vardesc_falls, pfad_sonst, vardesc_sonst) {
|
|
| 627 |
+ var wert = lib_objekt.pfad_lesen(angaben, vardesc_bedingung); |
|
| 628 |
+ if (!(wert === null)) {
|
|
| 629 |
+ if (typeof (wert) === "boolean") {
|
|
| 630 |
+ var wert_ = (wert); |
|
| 631 |
+ var pfad_ = void 0; |
|
| 632 |
+ var angaben_ = void 0; |
|
| 633 |
+ if (wert_) {
|
|
| 634 |
+ pfad_ = pfad_falls; |
|
| 635 |
+ angaben_ = angaben[vardesc_falls]; |
|
| 636 |
+ } |
|
| 637 |
+ else {
|
|
| 638 |
+ pfad_ = pfad_sonst; |
|
| 639 |
+ angaben_ = angaben[vardesc_sonst]; |
|
| 640 |
+ } |
|
| 641 |
+ var ergebnis = ausfuellen(einstellungen, pfad_, angaben_); |
|
| 642 |
+ return ergebnis; |
|
| 643 |
+ } |
|
| 644 |
+ else {
|
|
| 645 |
+ var nachricht = ("-- kein Boolean: \"" + vardesc_bedingung + "\"");
|
|
| 646 |
+ console.warn(nachricht + "\n"); |
|
| 647 |
+ return null; |
|
| 648 |
+ } |
|
| 649 |
+ } |
|
| 650 |
+ else {
|
|
| 651 |
+ var nachricht = ("-- fehlende Angabe: \"" + vardesc_bedingung + "\"");
|
|
| 652 |
+ console.warn(nachricht + "\n"); |
|
| 653 |
+ return null; |
|
| 654 |
+ } |
|
| 655 |
+ } |
|
| 656 |
+ /** |
|
| 657 |
+ * @author fenris |
|
| 658 |
+ */ |
|
| 659 |
+ function befehl_list(einstellungen, angaben, vardesc, pfad_) {
|
|
| 660 |
+ var wert = lib_objekt.pfad_lesen(angaben, vardesc); |
|
| 661 |
+ if (!(wert === null)) {
|
|
| 662 |
+ if ((typeof (wert) === "object") && (wert instanceof Array)) {
|
|
| 663 |
+ var ergebnis = (wert |
|
| 664 |
+ .map(function (angaben_) { return (ausfuellen(einstellungen, pfad_, angaben_)); })
|
|
| 665 |
+ .join(""));
|
|
| 666 |
+ return ergebnis; |
|
| 667 |
+ } |
|
| 668 |
+ else {
|
|
| 669 |
+ var nachricht = ("-- kein Array: \"" + vardesc + "\"");
|
|
| 670 |
+ console.warn(nachricht + "\n"); |
|
| 671 |
+ return null; |
|
| 672 |
+ } |
|
| 673 |
+ } |
|
| 674 |
+ else {
|
|
| 675 |
+ var nachricht = ("-- fehlende Angabe: \"" + vardesc + "\"");
|
|
| 676 |
+ console.warn(nachricht + "\n"); |
|
| 677 |
+ return null; |
|
| 678 |
+ } |
|
| 679 |
+ } |
|
| 680 |
+ /** |
|
| 681 |
+ * @author fenris |
|
| 682 |
+ */ |
|
| 683 |
+ function ausfuellen(einstellungen, pfad, angaben) {
|
|
| 684 |
+ var vorlage = lib_datei.lesen(pfad); |
|
| 685 |
+ var funde = lib_regexp.suchen_umgewandelt(einstellungen["ausdruck_umgewandelt"], vorlage); |
|
| 686 |
+ funde |
|
| 687 |
+ .forEach(function (_a) {
|
|
| 688 |
+ var bereich = _a["bereich"], kern = _a["kern"]; |
|
| 689 |
+ // let fund : string = (einstellungen["zeichen_auf"] + kern + einstellungen["zeichen_zu"]); |
|
| 690 |
+ var teile = kern.split("|").map(function (x) { return x.split(":"); });
|
|
| 691 |
+ var befehl = teile.shift(); |
|
| 692 |
+ var art = befehl.shift(); |
|
| 693 |
+ switch (art) {
|
|
| 694 |
+ case "show": {
|
|
| 695 |
+ var vardesc = befehl.shift(); |
|
| 696 |
+ var modifikatoren_1 = []; |
|
| 697 |
+ teile |
|
| 698 |
+ .forEach(function (teil) {
|
|
| 699 |
+ var art = teil.shift(); |
|
| 700 |
+ switch (art) {
|
|
| 701 |
+ case "format": {
|
|
| 702 |
+ var format = teil.shift(); |
|
| 703 |
+ modifikatoren_1.push({ "art": art, "angaben": { "format": format } });
|
|
| 704 |
+ break; |
|
| 705 |
+ } |
|
| 706 |
+ case "encode": {
|
|
| 707 |
+ var kodierung = teil.shift(); |
|
| 708 |
+ modifikatoren_1.push({ "art": art, "angaben": { "kodierung": kodierung } });
|
|
| 709 |
+ break; |
|
| 710 |
+ } |
|
| 711 |
+ case "escape": {
|
|
| 712 |
+ var ziel = teil.shift(); |
|
| 713 |
+ modifikatoren_1.push({ "art": art, "angaben": { "ziel": ziel, "argumente": teil } });
|
|
| 714 |
+ break; |
|
| 715 |
+ } |
|
| 716 |
+ case "squelch": {
|
|
| 717 |
+ var ziel = teil.shift(); |
|
| 718 |
+ modifikatoren_1.push({ "art": art, "angaben": { "ziel": ziel, "argumente": teil } });
|
|
| 719 |
+ break; |
|
| 720 |
+ } |
|
| 721 |
+ default: {
|
|
| 722 |
+ var nachricht = ("-- unbekannter Modifikator \"" + teil + "\"");
|
|
| 723 |
+ console.warn(nachricht + "\n"); |
|
| 724 |
+ } |
|
| 725 |
+ } |
|
| 726 |
+ }); |
|
| 727 |
+ var ersetzung = befehl_show(angaben, vardesc, modifikatoren_1, einstellungen["habitus"]); |
|
| 728 |
+ if (!(ersetzung === null)) |
|
| 729 |
+ vorlage = vorlage.replace(bereich, ersetzung); |
|
| 730 |
+ break; |
|
| 731 |
+ } |
|
| 732 |
+ case "dataurl": {
|
|
| 733 |
+ var vardesc = befehl.shift(); |
|
| 734 |
+ var mimetype = ((befehl.length > 0) ? befehl.shift() : "text/plain"); |
|
| 735 |
+ var ersetzung = befehl_dataurl(angaben, vardesc, mimetype); |
|
| 736 |
+ if (!(ersetzung === null)) |
|
| 737 |
+ vorlage = vorlage.replace(bereich, ersetzung); |
|
| 738 |
+ break; |
|
| 739 |
+ } |
|
| 740 |
+ case "call": {
|
|
| 741 |
+ var vardesc = befehl.shift(); |
|
| 742 |
+ var pfad_ = befehl.shift(); |
|
| 743 |
+ var ersetzung = befehl_call(einstellungen, angaben, vardesc, pfad_); |
|
| 744 |
+ if (!(ersetzung === null)) |
|
| 745 |
+ vorlage = vorlage.replace(bereich, ersetzung); |
|
| 746 |
+ break; |
|
| 747 |
+ } |
|
| 748 |
+ case "branch": {
|
|
| 749 |
+ var vardesc_bedingung = befehl.shift(); |
|
| 750 |
+ var pfad_falls = befehl.shift(); |
|
| 751 |
+ var vardesc_falls = befehl.shift(); |
|
| 752 |
+ var pfad_sonst = befehl.shift(); |
|
| 753 |
+ var vardesc_sonst = befehl.shift(); |
|
| 754 |
+ var ersetzung = befehl_branch(einstellungen, angaben, vardesc_bedingung, pfad_falls, vardesc_falls, pfad_sonst, vardesc_sonst); |
|
| 755 |
+ if (!(ersetzung === null)) |
|
| 756 |
+ vorlage = vorlage.replace(bereich, ersetzung); |
|
| 757 |
+ break; |
|
| 758 |
+ } |
|
| 759 |
+ case "list": {
|
|
| 760 |
+ var vardesc = befehl.shift(); |
|
| 761 |
+ var pfad_ = befehl.shift(); |
|
| 762 |
+ var ersetzung = befehl_list(einstellungen, angaben, vardesc, pfad_); |
|
| 763 |
+ if (!(ersetzung === null)) |
|
| 764 |
+ vorlage = vorlage.replace(bereich, ersetzung); |
|
| 765 |
+ break; |
|
| 766 |
+ } |
|
| 767 |
+ default: {
|
|
| 768 |
+ if (_befehle.hasOwnProperty(art)) {
|
|
| 769 |
+ var vardesc = befehl.shift(); |
|
| 770 |
+ var wert = lib_objekt.pfad_lesen(angaben, vardesc); |
|
| 771 |
+ var ersetzung = _befehle[art](befehl)(wert); |
|
| 772 |
+ if (!(ersetzung === null)) |
|
| 773 |
+ vorlage = vorlage.replace(bereich, ersetzung); |
|
| 774 |
+ } |
|
| 775 |
+ else {
|
|
| 776 |
+ var nachricht = ("-- unbehandelte Art \"" + art + "\"");
|
|
| 777 |
+ // raise ValueError(nachricht) |
|
| 778 |
+ console.warn(nachricht + "\n"); |
|
| 779 |
+ } |
|
| 780 |
+ break; |
|
| 781 |
+ } |
|
| 782 |
+ } |
|
| 783 |
+ }); |
|
| 784 |
+ return vorlage; |
|
| 785 |
+ } |
|
| 786 |
+ /** |
|
| 787 |
+ * @author fenris |
|
| 788 |
+ */ |
|
| 789 |
+ function anwenden(einstellungen, pfad, angaben) {
|
|
| 790 |
+ var ausdruck_umgewandelt = (lib_regexp.umwandeln(lib_regexp.erstellen_sequenz([] |
|
| 791 |
+ .concat(einstellungen["zeichen_auf"].split("").map(function (x) { return lib_regexp.erstellen_symbol(x); }))
|
|
| 792 |
+ .concat([ |
|
| 793 |
+ lib_regexp.erstellen_gruppe(lib_regexp.erstellen_wiederholung(lib_regexp.erstellen_klasse(false, einstellungen["zeichen_zu"].split("").map(function (x) { return lib_regexp.erstellen_symbol(x); })), 1, null))
|
|
| 794 |
+ ]) |
|
| 795 |
+ .concat(einstellungen["zeichen_zu"].split("").map(function (x) { return lib_regexp.erstellen_symbol(x); })))));
|
|
| 796 |
+ einstellungen["ausdruck_umgewandelt"] = ausdruck_umgewandelt; |
|
| 797 |
+ var pfad_teile = pfad.split("/");
|
|
| 798 |
+ var dirname = ((pfad_teile.length === 1) ? "." : pfad_teile.slice(0, -1).join("/"));
|
|
| 799 |
+ var basename = pfad_teile.slice(-1)[0]; |
|
| 800 |
+ process.chdir(dirname); |
|
| 801 |
+ var ergebnis = ausfuellen(einstellungen, basename, angaben); |
|
| 802 |
+ return ergebnis; |
|
| 803 |
+ } |
|
| 804 |
+ mod_kern.anwenden = anwenden; |
|
| 805 |
+})(mod_kern || (mod_kern = {}));
|
|
| 806 |
+/** |
|
| 807 |
+ * @author fenris |
|
| 808 |
+ */ |
|
| 809 |
+function haupt(args) {
|
|
| 810 |
+ var argdesc = lib_args.erzeugen({
|
|
| 811 |
+ "pfad": {
|
|
| 812 |
+ "art": "positioniert", |
|
| 813 |
+ "index": 0 |
|
| 814 |
+ }, |
|
| 815 |
+ "habitus": {
|
|
| 816 |
+ "art": "benannt", |
|
| 817 |
+ "kennung": "habitus", |
|
| 818 |
+ "entnahme": function (x) { return ((x.length > 0)
|
|
| 819 |
+ ? x.slice(-1)[0] |
|
| 820 |
+ : null); } |
|
| 821 |
+ }, |
|
| 822 |
+ "zeichen_auf": {
|
|
| 823 |
+ "art": "benannt", |
|
| 824 |
+ "kennung": "zeichen-auf", |
|
| 825 |
+ "entnahme": function (x) { return ((x.length > 0)
|
|
| 826 |
+ ? x.slice(-1)[0] |
|
| 827 |
+ : "{{"); }
|
|
| 828 |
+ }, |
|
| 829 |
+ "zeichen_zu": {
|
|
| 830 |
+ "art": "benannt", |
|
| 831 |
+ "kennung": "zeichen-zu", |
|
| 832 |
+ "entnahme": function (x) { return ((x.length > 0)
|
|
| 833 |
+ ? x.slice(-1)[0] |
|
| 834 |
+ : "}}"); } |
|
| 835 |
+ }, |
|
| 836 |
+ "modul": {
|
|
| 837 |
+ "art": "benannt", |
|
| 838 |
+ "kennung": "modul" |
|
| 839 |
+ } |
|
| 840 |
+ }); |
|
| 841 |
+ var args_; |
|
| 842 |
+ try {
|
|
| 843 |
+ args_ = lib_args.parsen(argdesc, args); |
|
| 844 |
+ } |
|
| 845 |
+ catch (exception) {
|
|
| 846 |
+ console.error(lib_args.hilfe(argdesc)); |
|
| 847 |
+ process.exit(-1); |
|
| 848 |
+ } |
|
| 849 |
+ // Module laden |
|
| 850 |
+ {
|
|
| 851 |
+ (args_["modul"]) |
|
| 852 |
+ .forEach(function (pfad_) {
|
|
| 853 |
+ var erweiterung = require(/*"./" + */ pfad_); |
|
| 854 |
+ var definition = erweiterung.definieren(); |
|
| 855 |
+ mod_kern.erweiterung_einrichten(definition); |
|
| 856 |
+ mod_kern.erweiterung_laden(definition["name"]); |
|
| 857 |
+ }); |
|
| 858 |
+ } |
|
| 859 |
+ // let inhalt : string; process.stdin.resume(); inhalt = lib_datei.lesen(process.stdin.fd); process.stdin.pause(); |
|
| 860 |
+ var inhalt = lib_datei.lesen("/dev/stdin");
|
|
| 861 |
+ var angaben = lib_code.json_decode(inhalt); |
|
| 862 |
+ var ergebnis = mod_kern.anwenden({
|
|
| 863 |
+ "zeichen_auf": args_["zeichen_auf"], |
|
| 864 |
+ "zeichen_zu": args_["zeichen_zu"], |
|
| 865 |
+ "habitus": args_["habitus"] |
|
| 866 |
+ }, args_["pfad"], angaben); |
|
| 867 |
+ console.info(ergebnis); |
|
| 868 |
+} |
|
| 869 |
+haupt(process.argv.slice(2)); |
|
| 0 | 870 |