Add lang in config.ini
This commit is contained in:
parent
df1c147001
commit
fad5d68917
3 changed files with 60 additions and 52 deletions
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
|
||||
|
||||
|
@ -11,7 +11,7 @@ Optionnal files:
|
|||
* `/head.inc.html`
|
||||
* `/footer.inc.html`
|
||||
|
||||
`mkht.php <site path> <destination >`
|
||||
`mkht.php <site path> <destination>`
|
||||
|
||||
`destination` is optionnal and can be:
|
||||
* `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
|
||||
|
||||
| Name | Description | Source |
|
||||
| --------- | ------------------------ | ------------------------------------------ |
|
||||
| less.php | Less compiler in PHP | https://github.com/wikimedia/less.php |
|
||||
| parsedown | Markdown compiler in PHP | https://parsedown.org |
|
||||
| Name | Description | Repository |
|
||||
| --------------- | ---------------------------- | ----------------------------------------- |
|
||||
| less.php | Less compiler in PHP | https://github.com/wikimedia/less.php |
|
||||
| parsedown | Markdown compiler in PHP | https://github.com/erusev/parsedown |
|
||||
| parsedown-extra | Extension for Markdown Extra | https://github.com/erusev/parsedown-extra |
|
||||
|
||||
# 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.
|
||||
|
||||
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']))
|
||||
$config['centerIndex'] = false;
|
||||
|
||||
if (!isset($config['defaultLang']))
|
||||
$config['defaultLang'] = "en";
|
||||
|
||||
|
||||
// Less > CSS
|
||||
|
||||
|
@ -56,7 +59,10 @@ if ($config['trueBlack']) {
|
|||
$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"))
|
||||
$lessFiles = array(ROOT . '/style.less' => '', SITE . '/style.less' => '');
|
||||
|
@ -160,7 +166,16 @@ foreach ($pages as $page) {
|
|||
|
||||
?>
|
||||
<!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>
|
||||
<meta charset="UTF-8">
|
||||
<title><?php
|
||||
|
@ -185,14 +200,12 @@ foreach ($pages as $page) {
|
|||
?>
|
||||
<header>
|
||||
<a id="lienHeader" href="/">
|
||||
<div class="logo">
|
||||
<?php
|
||||
if (file_exists(SITE . "/img/logo.webp"))
|
||||
echo '<img src="img/logo.webp" ' . getimagesize(SITE . "/img/logo.webp")[3] . ' alt="' . $config['siteTitle'] . '" />';
|
||||
else
|
||||
echo $config['siteTitle'];
|
||||
?>
|
||||
</div>
|
||||
</a>
|
||||
</header>
|
||||
<?php
|
||||
|
@ -209,7 +222,7 @@ foreach ($pages as $page) {
|
|||
if ($config['centerIndex'] AND $pathParts['filename'] === "index") {
|
||||
echo "</div>";
|
||||
} else {
|
||||
echo "</main";
|
||||
echo "</main>";
|
||||
}
|
||||
if (file_exists(SITE . "/end.inc.html"))
|
||||
require SITE . "/end.inc.html";
|
||||
|
|
74
style.less
74
style.less
|
@ -1,12 +1,17 @@
|
|||
@light: ~"(prefers-color-scheme: light)";
|
||||
@dark: ~"(prefers-color-scheme: dark)";
|
||||
@fontSize: 30px;
|
||||
|
||||
* {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
font-family: system-ui, sans-serif;
|
||||
font-size: 30px;
|
||||
line-height: 50px;
|
||||
font-size: @fontSize;
|
||||
line-height: 42px;
|
||||
|
||||
&:hover, &:focus {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
@media @light {
|
||||
background-color: @lightColor;
|
||||
|
@ -32,9 +37,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 30px;
|
||||
padding-top: 15px;
|
||||
padding: 15px;
|
||||
|
||||
@media (max-width: 500px) {
|
||||
padding-left: 10px;
|
||||
|
@ -96,10 +104,6 @@ a, a:visited {
|
|||
padding: 0px 16px 0px 16px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
img {
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
|
@ -170,33 +174,15 @@ dd {
|
|||
}
|
||||
|
||||
p {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.centered {
|
||||
header, footer, .centered {
|
||||
text-align: 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 -----
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
|
@ -204,33 +190,41 @@ h1, h2, h3, h4, h5, h6 {
|
|||
line-height: 100%;
|
||||
}
|
||||
|
||||
h1, h1 > * {
|
||||
font-size: @fontSize + 40;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 250%;
|
||||
text-align: center;
|
||||
padding-bottom: 20px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
h2, h2 > * {
|
||||
font-size: @fontSize + 30;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 200%;
|
||||
margin-top: 50px;
|
||||
margin-top: 50px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h3, h3 > * {
|
||||
font-size: @fontSize + 25;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 160%;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 130%;
|
||||
h4, h4 > * {
|
||||
font-size: @fontSize + 18;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 115%;
|
||||
h5, h5 > * {
|
||||
font-size: @fontSize + 12;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 107%;
|
||||
h6, h6 > * {
|
||||
font-size: @fontSize + 6;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue