-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhymns.php
38 lines (34 loc) · 1.17 KB
/
hymns.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
include __DIR__ . '/day.php';
function hymns() {
$parsedown = new Parsedown();
$rows = array_merge(
getPerehod(),
getNeperehod()
);
$troparions = [];
foreach($rows as $row) {
if (!isset($row['Заглавие тропарион'])) {
continue;
}
$id = md5($row['Заглавие тропарион']);
$langMap = [
'Рус' => 'ru',
'Цся' => 'csj'
];
$lang = $langMap[$row['Язык']];
$bodytext = styleHtml($parsedown->text(($row['Тропари'] ?? '')) . $parsedown->text(($row['Кондаки'] ?? '')) . $parsedown->text(($row['Величания'] ?? '')));
if (isset($troparions[$id]["bodytext"]) && !isset($troparions[$id]["bodytext"]["$lang"])) {
$troparions[$id]["bodytext"]["$lang"] = $bodytext;
} else {
$troparions[$id] = [
"id" => $id,
"title" => $row['Заглавие тропарион'],
"bodytext" => [
"$lang" => $bodytext
],
];
}
}
return array_values($troparions);
}