commit 96ee2c4b7910b5e6c5815467cd6ac6927bf84422 Author: Yusur Princeps Date: Thu Feb 12 13:30:53 2026 +0100 0.1.0 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3a2a900 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +vendor/ +node_modules/ +.*.swp +**~ +.\#* +\#*\# +.ht* +!.htaccess +composer.lock \ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..e9b4600 --- /dev/null +++ b/.htaccess @@ -0,0 +1,3 @@ + + +Options -Indexes \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..8a33b72 --- /dev/null +++ b/composer.json @@ -0,0 +1,20 @@ +{ + "name": "yusurko/caluta7", + "type": "project", + "version": "0.1.0", + "require": { + "league/commonmark": "^2.8", + "symfony/yaml": "^8.0" + }, + "autoload": { + "psr-4": { + "Yusurko\\Caluta7\\": "src/" + } + }, + "authors": [ + { + "name": "Yusur Princeps", + "email": "sakuragasaki46@gmail.com" + } + ] +} diff --git a/index.php b/index.php new file mode 100644 index 0000000..96e13ea --- /dev/null +++ b/index.php @@ -0,0 +1,60 @@ +load($link); + +?> + + + + + + Caluta, Inc. + + + + +
+
+
+

getTitle()); ?>

+
+ getHtml(); ?> +
+
+ + \ No newline at end of file diff --git a/pages/.htaccess b/pages/.htaccess new file mode 100644 index 0000000..a7a56f7 --- /dev/null +++ b/pages/.htaccess @@ -0,0 +1 @@ +Require all denied \ No newline at end of file diff --git a/pages/dict.md b/pages/dict.md new file mode 100644 index 0000000..4a44205 --- /dev/null +++ b/pages/dict.md @@ -0,0 +1,38 @@ +Jytky Kalpy: Lemeryj + +(r9: dictionary for the language of Jytlynd) + +* **-s** / part. / suffix for genitive +* **-tza** / part. / suffix for past +* **-tzu** / part. / suffix for continuous or te-form +* **am** / pp. / by, to (dative) +* **amgwan** / v. / to remember (used at past tense) +* **atempty** / v. / to attempt +* **em** / v. / to be +* **ersjalky** / a. / Imerchali +* **gryvary** / n. / script, alphabet +* **gryvy** / v. / to grief, vandalize +* **hynd** / n. / dog +* **i** / pp. / in +* **je** / p. / I +* **jotky** / a. / Jutish (of Jotlond) +* **jytky** / a. / Jutish (of Jytlynd) +* **kalpy** / n. / tongue, language +* **kedo** / c. / but +* **kopy** / v. / to buy +* **lem** / a. / seven +* **lemeryj** / n. / dictionary +* **lemy** / n. / word +* **lynd** / a. / land, territory +* **man** / n. / man, male +* **nym** / n. / name +* **oj** / p. / it +* **oksygyn** / n. / oxygen +* **pergwan** / v. / to forget (used at past tense) +* **som** / a. / some +* **supry** / a. / good, super +* **trok** / n. / crime +* **tzyjar** / n. / animal (also as insult) +* **vatry** / a. / bad, gross, not aight +* **yky** / v. / to go +* **yvyly** / a. / evil, silly diff --git a/pages/index.md b/pages/index.md new file mode 100644 index 0000000..350fbbc --- /dev/null +++ b/pages/index.md @@ -0,0 +1,5 @@ + + +Lorem ipsum dolor sit amet + +«𝐴 π‘šπ‘Žπ‘™π‘– π‘’π‘ π‘‘π‘Ÿπ‘’π‘šπ‘–, π‘’π‘ π‘‘π‘Ÿπ‘’π‘šπ‘Ž π‘‘π‘’π‘ π‘‘π‘Ÿπ‘ŽΒ» (π½π‘œβ„Žπ‘Žπ‘› πΏπ‘–π‘’π‘π‘’π‘Ÿπ‘‘) \ No newline at end of file diff --git a/src/PageLoader.php b/src/PageLoader.php new file mode 100644 index 0000000..34464e4 --- /dev/null +++ b/src/PageLoader.php @@ -0,0 +1,132 @@ +error = 'BAD_ARGUMENT'; + return false; + } + + $this->name = $name; + + $filename = PAGES_PATH . "/$name.md"; + + if (!file_exists($filename)) { + $this->error = "NOT_FOUND"; + return false; + } + + $this->updatedAt = filemtime($filename); + + $fp = fopen($filename, 'r'); + if (!$fp) { + $this->error = "FORBIDDEN"; + return false; + } + + $title_line = false; + $raw_meta_lines = array(); + $into_meta = false; + + while (($line = trim(fgets($fp))) !== false) { + if ($title_line === false && $line !== '---') { + $title_line = $line; + } elseif ($line === '---') { + $into_meta = !$into_meta; + } elseif ($into_meta) { + $raw_meta_lines[] = $line; + } else { + if (!$title_line) { + $title_line = $name; + } + break; + } + } + + if ($full) { + $raw_content = ''; + while($chunk = fread($fp, 8192)) { + $raw_content .= $chunk; + } + $this->raw_content = $raw_content; + } + + $this->title = $title_line; + + $raw_meta = implode("\n", $raw_meta_lines); + $this->meta = @Yaml::parse($raw_meta); + + if ($this->raw_content) { + //$this->preprocess($this->raw_content); + } + + return true; + } + + public function getHtml() { + if (!$this->raw_content) return false; + $md = new CommonMarkConverter(); + $content = $md->convert($this->raw_content); + return "
$content
"; + } + + public function getTitle() { + return $this->title; + } + + public function getUrl() { + if ($this->isIndex()) { + return "/"; + } + + return "/{$this->name}"; + } + + public function getError() { + if (!$this->error) { + return false; + } elseif ($this->error === 'NOT_FOUND') { + return [ + 'status' => 404, + 'message' => 'Not found' + ]; + } elseif ($this->error === 'FORBIDDEN') { + return [ + 'status' => 403, + 'message' => 'Access Denied' + ]; + } elseif ($this->error === 'BAD_ARGUMENT') { + return [ + 'status' => 400, + 'message' => 'Bad Request' + ]; + } else { + return [ + 'status' => 500, + 'message' => 'Unknown Error' + ]; + } + } + + public function isIndex () { + return $this->name === 'index'; + } +} \ No newline at end of file