77d8eec65a6d272eeee78097bf5a526d3a45059d
fenris foo

fenris authored 8 years ago

source/structure/word_functions.html.php   1) <?php
source/structure/word_functions.html.php   2) 	global $configuration;
bfadmin-master advanced

bfadmin-master authored 8 years ago

source/structure/word_functions.html.php   3) 	include_once("source/logic/server/misc.php");
fenris foo

fenris authored 8 years ago

source/structure/word_functions.html.php   4) 	include_once("source/logic/server/data.php");
source/structure/word_functions.html.php   5) 	include_once("source/logic/server/table.php");
source/structure/word_functions.html.php   6)  ?>
bfadmin-master advanced

bfadmin-master authored 8 years ago

source/structure/word_functions.html.php   7) <section class="section" id="word_functions">
fenris foo

fenris authored 8 years ago

source/structure/word_functions.html.php   8) 	<header>Word Functions</header>
bfadmin-master advanced

bfadmin-master authored 8 years ago

source/structure/word_functions.html.php   9) 	<div class="note_error">This section is only a proposal yet; not part of the draft.</div>
fenris foo

fenris authored 8 years ago

source/structure/word_functions.html.php  10) <?php
source/structure/word_functions.html.php  11) 	$table = new class_table
source/structure/word_functions.html.php  12) 	(
source/structure/word_functions.html.php  13) 		[
source/structure/word_functions.html.php  14) 			new class_column
source/structure/word_functions.html.php  15) 			(
source/structure/word_functions.html.php  16) 				"Affix",
source/structure/word_functions.html.php  17) 				function ($row)
source/structure/word_functions.html.php  18) 				{
source/structure/word_functions.html.php  19) 					return $row["affix"];
source/structure/word_functions.html.php  20) 				},
source/structure/word_functions.html.php  21) 				function ($value)
source/structure/word_functions.html.php  22) 				{
source/structure/word_functions.html.php  23) 					return mark($value, ["word", "lang_fs"]);
source/structure/word_functions.html.php  24) 				}
source/structure/word_functions.html.php  25) 			),
source/structure/word_functions.html.php  26) 			new class_column
source/structure/word_functions.html.php  27) 			(
source/structure/word_functions.html.php  28) 				"Type",
source/structure/word_functions.html.php  29) 				function ($row)
source/structure/word_functions.html.php  30) 				{
source/structure/word_functions.html.php  31) 					return [$row["type_from"], $row["type_to"]];
source/structure/word_functions.html.php  32) 				},
source/structure/word_functions.html.php  33) 				function ($value)
source/structure/word_functions.html.php  34) 				{
source/structure/word_functions.html.php  35) 					return (
source/structure/word_functions.html.php  36) 						implode
source/structure/word_functions.html.php  37) 						(
source/structure/word_functions.html.php  38) 							" → ",
source/structure/word_functions.html.php  39) 							array_map
source/structure/word_functions.html.php  40) 							(
source/structure/word_functions.html.php  41) 								function ($group)
source/structure/word_functions.html.php  42) 								{
source/structure/word_functions.html.php  43) 				 					return ("{" . implode(",", $group) . "}");
source/structure/word_functions.html.php  44) 								},
source/structure/word_functions.html.php  45) 								$value
source/structure/word_functions.html.php  46) 							)
source/structure/word_functions.html.php  47) 						)
source/structure/word_functions.html.php  48) 					);
source/structure/word_functions.html.php  49) 				}
source/structure/word_functions.html.php  50) 			),
source/structure/word_functions.html.php  51) 			new class_column
source/structure/word_functions.html.php  52) 			(
source/structure/word_functions.html.php  53) 				"Description",
source/structure/word_functions.html.php  54) 				function ($row)
source/structure/word_functions.html.php  55) 				{
source/structure/word_functions.html.php  56) 					return ["name" => $row["name"], "description" => $row["description"]];
source/structure/word_functions.html.php  57) 				},
source/structure/word_functions.html.php  58) 				function ($value)
source/structure/word_functions.html.php  59) 				{
source/structure/word_functions.html.php  60) 					$output = "";
source/structure/word_functions.html.php  61) 					if ($value["name"] != null) $output .= (mark($value["name"], ["grammarterm"]) . ": ");
source/structure/word_functions.html.php  62) 					if ($value["description"] != null) $output .= ($value["description"]);
source/structure/word_functions.html.php  63) 					return $output;
source/structure/word_functions.html.php  64) 				}
source/structure/word_functions.html.php  65) 			),
source/structure/word_functions.html.php  66) 			/*
source/structure/word_functions.html.php  67) 			new class_column
source/structure/word_functions.html.php  68) 			(
source/structure/word_functions.html.php  69) 				"Cognates",
source/structure/word_functions.html.php  70) 				function ($row)
source/structure/word_functions.html.php  71) 				{
source/structure/word_functions.html.php  72) 					return $row["cognates"];
source/structure/word_functions.html.php  73) 				},
source/structure/word_functions.html.php  74) 				function ($value)
source/structure/word_functions.html.php  75) 				{
source/structure/word_functions.html.php  76) 					return implode(", ", array_map(function ($entry) {return ($entry["language"] . ": " . mark($entry["affix"], ["word", "lang_" . $entry["language"]]));}, $value));
source/structure/word_functions.html.php  77) 				}
source/structure/word_functions.html.php  78) 			),
source/structure/word_functions.html.php  79) 			 */
source/structure/word_functions.html.php  80) 			new class_column
source/structure/word_functions.html.php  81) 			(
source/structure/word_functions.html.php  82) 				"Example",
source/structure/word_functions.html.php  83) 				function ($row)
source/structure/word_functions.html.php  84) 				{
source/structure/word_functions.html.php  85) 					global $configuration;
bfadmin-master advanced

bfadmin-master authored 8 years ago

source/structure/word_functions.html.php  86) 					return ["original" => [$row["example"]["word"]], "translated" => $row["example"]["translations"][$configuration["target"]]];
source/structure/word_functions.html.php  87) 				},
source/structure/word_functions.html.php  88) 				_bar("word")
fenris foo

fenris authored 8 years ago

source/structure/word_functions.html.php  89) 			),
source/structure/word_functions.html.php  90) 		],
source/structure/word_functions.html.php  91) 		read_json("source/data/word_functions.json")
source/structure/word_functions.html.php  92) 	);
source/structure/word_functions.html.php  93) 	$table->generate();
source/structure/word_functions.html.php  94)  ?>
source/structure/word_functions.html.php  95) <p>
source/structure/word_functions.html.php  96) 	Some complex examples:
source/structure/word_functions.html.php  97) 	<ul>
bfadmin-master advanced

bfadmin-master authored 8 years ago

source/structure/word_functions.html.php  98) 		<?php $fun = _bar("word"); ?>
source/structure/word_functions.html.php  99) 		<li><?php echo($fun(["original" => ["unmanlikhed"], "translated" => ["inhumanity"]])); ?></li>
source/structure/word_functions.html.php 100) 		<li><?php echo($fun(["original" => ["seberenung"], "translated" => ["visualization"]])); ?></li>
source/structure/word_functions.html.php 101) 		<li><?php echo($fun(["original" => ["kraftigenar"], "translated" => ["fortifier"]])); ?></li>