Add lang in config.ini
This commit is contained in:
parent
df1c147001
commit
fad5d68917
15
README.md
15
README.md
|
@ -1,4 +1,4 @@
|
||||||
mkht.php is a PHP script for building Gemini, Markdown and HTML/CSS sites from source documents in Gemini, Markdown, HTML, PHP, CSS and Less.
|
mkht.php is a PHP script for building Gemini, Markdown and HTML/CSS sites from source documents in Gemini, Markdown Extra, HTML, PHP, CSS and Less.
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ Optionnal files:
|
||||||
* `/head.inc.html`
|
* `/head.inc.html`
|
||||||
* `/footer.inc.html`
|
* `/footer.inc.html`
|
||||||
|
|
||||||
`mkht.php <site path> <destination >`
|
`mkht.php <site path> <destination>`
|
||||||
|
|
||||||
`destination` is optionnal and can be:
|
`destination` is optionnal and can be:
|
||||||
* `dns` if you want local links without exensions
|
* `dns` if you want local links without exensions
|
||||||
|
@ -39,10 +39,11 @@ Gemini > Markdown > HTML, which means that the last of these formats you will us
|
||||||
|
|
||||||
# Internal libraries used
|
# Internal libraries used
|
||||||
|
|
||||||
| Name | Description | Source |
|
| Name | Description | Repository |
|
||||||
| --------- | ------------------------ | ------------------------------------------ |
|
| --------------- | ---------------------------- | ----------------------------------------- |
|
||||||
| less.php | Less compiler in PHP | https://github.com/wikimedia/less.php |
|
| less.php | Less compiler in PHP | https://github.com/wikimedia/less.php |
|
||||||
| parsedown | Markdown compiler in PHP | https://parsedown.org |
|
| parsedown | Markdown compiler in PHP | https://github.com/erusev/parsedown |
|
||||||
|
| parsedown-extra | Extension for Markdown Extra | https://github.com/erusev/parsedown-extra |
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
|
@ -52,4 +53,4 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
23
mkht.php
23
mkht.php
|
@ -33,6 +33,9 @@ if (!isset($config['header']))
|
||||||
if (!isset($config['centerIndex']))
|
if (!isset($config['centerIndex']))
|
||||||
$config['centerIndex'] = false;
|
$config['centerIndex'] = false;
|
||||||
|
|
||||||
|
if (!isset($config['defaultLang']))
|
||||||
|
$config['defaultLang'] = "en";
|
||||||
|
|
||||||
|
|
||||||
// Less > CSS
|
// Less > CSS
|
||||||
|
|
||||||
|
@ -56,7 +59,10 @@ if ($config['trueBlack']) {
|
||||||
$colorScheme['darkerColor'] = "#000000";
|
$colorScheme['darkerColor'] = "#000000";
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array('cache_dir' => SITE . '/css', 'compress' => true);
|
$options = array(
|
||||||
|
'cache_dir' => SITE . '/css',
|
||||||
|
'compress' => true,
|
||||||
|
);
|
||||||
|
|
||||||
if (file_exists(SITE . "/style.less"))
|
if (file_exists(SITE . "/style.less"))
|
||||||
$lessFiles = array(ROOT . '/style.less' => '', SITE . '/style.less' => '');
|
$lessFiles = array(ROOT . '/style.less' => '', SITE . '/style.less' => '');
|
||||||
|
@ -160,7 +166,16 @@ foreach ($pages as $page) {
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr">
|
<html lang="<?php
|
||||||
|
|
||||||
|
preg_match("#\.([a-zA-Z-]{2,5})\.#", $pathParts['basename'], $lang);
|
||||||
|
|
||||||
|
if (isset($lang[1]))
|
||||||
|
echo $lang[1];
|
||||||
|
else
|
||||||
|
echo $config['defaultLang'];
|
||||||
|
|
||||||
|
?>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title><?php
|
<title><?php
|
||||||
|
@ -185,14 +200,12 @@ foreach ($pages as $page) {
|
||||||
?>
|
?>
|
||||||
<header>
|
<header>
|
||||||
<a id="lienHeader" href="/">
|
<a id="lienHeader" href="/">
|
||||||
<div class="logo">
|
|
||||||
<?php
|
<?php
|
||||||
if (file_exists(SITE . "/img/logo.webp"))
|
if (file_exists(SITE . "/img/logo.webp"))
|
||||||
echo '<img src="img/logo.webp" ' . getimagesize(SITE . "/img/logo.webp")[3] . ' alt="' . $config['siteTitle'] . '" />';
|
echo '<img src="img/logo.webp" ' . getimagesize(SITE . "/img/logo.webp")[3] . ' alt="' . $config['siteTitle'] . '" />';
|
||||||
else
|
else
|
||||||
echo $config['siteTitle'];
|
echo $config['siteTitle'];
|
||||||
?>
|
?>
|
||||||
</div>
|
|
||||||
</a>
|
</a>
|
||||||
</header>
|
</header>
|
||||||
<?php
|
<?php
|
||||||
|
@ -209,7 +222,7 @@ foreach ($pages as $page) {
|
||||||
if ($config['centerIndex'] AND $pathParts['filename'] === "index") {
|
if ($config['centerIndex'] AND $pathParts['filename'] === "index") {
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
} else {
|
} else {
|
||||||
echo "</main";
|
echo "</main>";
|
||||||
}
|
}
|
||||||
if (file_exists(SITE . "/end.inc.html"))
|
if (file_exists(SITE . "/end.inc.html"))
|
||||||
require SITE . "/end.inc.html";
|
require SITE . "/end.inc.html";
|
||||||
|
|
74
style.less
74
style.less
|
@ -1,12 +1,17 @@
|
||||||
@light: ~"(prefers-color-scheme: light)";
|
@light: ~"(prefers-color-scheme: light)";
|
||||||
@dark: ~"(prefers-color-scheme: dark)";
|
@dark: ~"(prefers-color-scheme: dark)";
|
||||||
|
@fontSize: 30px;
|
||||||
|
|
||||||
* {
|
* {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
font-family: system-ui, sans-serif;
|
font-family: system-ui, sans-serif;
|
||||||
font-size: 30px;
|
font-size: @fontSize;
|
||||||
line-height: 50px;
|
line-height: 42px;
|
||||||
|
|
||||||
|
&:hover, &:focus {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
@media @light {
|
@media @light {
|
||||||
background-color: @lightColor;
|
background-color: @lightColor;
|
||||||
|
@ -32,9 +37,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
padding: 30px;
|
padding: 15px;
|
||||||
padding-top: 15px;
|
|
||||||
|
|
||||||
@media (max-width: 500px) {
|
@media (max-width: 500px) {
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
|
@ -96,10 +104,6 @@ a, a:visited {
|
||||||
padding: 0px 16px 0px 16px;
|
padding: 0px 16px 0px 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
img {
|
||||||
height: auto;
|
height: auto;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
@ -170,33 +174,15 @@ dd {
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
padding-top: 10px;
|
padding-top: 8px;
|
||||||
padding-bottom: 10px;
|
padding-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.centered {
|
header, footer, .centered {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FOOTER
|
|
||||||
|
|
||||||
.textefooter {
|
|
||||||
margin: 30px;
|
|
||||||
line-height: 1.5em;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
|
||||||
text-align: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----- TITLES -----
|
// ----- TITLES -----
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
@ -204,33 +190,41 @@ h1, h2, h3, h4, h5, h6 {
|
||||||
line-height: 100%;
|
line-height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h1, h1 > * {
|
||||||
|
font-size: @fontSize + 40;
|
||||||
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 250%;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-bottom: 20px;
|
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h2, h2 > * {
|
||||||
|
font-size: @fontSize + 30;
|
||||||
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 200%;
|
margin-top: 50px;
|
||||||
margin-top: 50px;
|
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h3, h3 > * {
|
||||||
|
font-size: @fontSize + 25;
|
||||||
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
font-size: 160%;
|
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h4 {
|
h4, h4 > * {
|
||||||
font-size: 130%;
|
font-size: @fontSize + 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
h5 {
|
h5, h5 > * {
|
||||||
font-size: 115%;
|
font-size: @fontSize + 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
h6 {
|
h6, h6 > * {
|
||||||
font-size: 107%;
|
font-size: @fontSize + 6;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue