Updated static generator for Carsten

This commit is contained in:
markseu 2024-05-09 17:10:05 +02:00
parent 811de1e89f
commit 8f6fd9a1c4
7 changed files with 58 additions and 54 deletions

View file

@ -45,14 +45,14 @@ system/themes/berlin-opensans-light.woff: berlin-opensans-light.woff, create, up
system/themes/berlin-opensans-regular.woff: berlin-opensans-regular.woff, create, update, careful
Extension: Blog
Version: 0.9.2
Version: 0.9.4
Description: Blog for your website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-blog/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-blog
DocumentationLanguage: en, de, sv
Published: 2024-04-30 18:03:27
Published: 2024-05-09 16:44:32
Status: available
system/workers/blog.php: blog.php, create, update
system/layouts/blog.html: blog.html, create, update, careful
@ -149,14 +149,14 @@ system/themes/copenhagen.css: copenhagen.css, create, update, careful
system/themes/copenhagen.png: copenhagen.png, create
Extension: Core
Version: 0.9.9
Version: 0.9.10
Description: Core functionality of your website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-core
DocumentationLanguage: en, de, sv
Published: 2024-05-02 16:35:25
Published: 2024-05-09 16:15:59
Status: available
system/workers/core.php: core.php, create, update
system/extensions/core.php: corepatch.txt, update
@ -213,14 +213,14 @@ Status: available
system/workers/dutch.php: dutch.php, create, update
Extension: Edit
Version: 0.9.8
Version: 0.9.9
Description: Edit your website in a web browser.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-edit/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-edit
DocumentationLanguage: en, de, sv
Published: 2024-05-07 07:20:40
Published: 2024-05-09 16:45:47
Status: available
system/workers/edit.php: edit.php, create, update
system/workers/edit.css: edit.css, create, update
@ -262,14 +262,14 @@ Status: available
system/workers/english.php: english.php, create, update
Extension: Feed
Version: 0.9.2
Version: 0.9.3
Description: Feed with recent changes.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-feed/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-feed
DocumentationLanguage: en, de, sv
Published: 2024-04-25 13:08:57
Published: 2024-05-09 16:28:24
Status: available
system/workers/feed.php: feed.php, create, update
system/layouts/feed.html: feed.html, create, update, careful
@ -305,14 +305,14 @@ system/workers/gallery-default-skin.svg: gallery-default-skin.svg, create, updat
system/workers/gallery-preloader.gif: gallery-preloader.gif, create, update
Extension: Generate
Version: 0.9.5
Version: 0.9.6
Description: Generate a static website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-generate/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-generate
DocumentationLanguage: en, de, sv
Published: 2024-04-25 15:39:34
Published: 2024-05-09 16:39:21
Status: available
system/workers/generate.php: generate.php, create, update
@ -665,14 +665,14 @@ Status: available
system/workers/serve.php: serve.php, create, update
Extension: Sitemap
Version: 0.9.2
Version: 0.9.3
Description: Sitemap with all pages.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-sitemap/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-sitemap
DocumentationLanguage: en, de, sv
Published: 2024-04-25 13:09:09
Published: 2024-05-09 16:28:15
Status: available
system/workers/sitemap.php: sitemap.php, create, update
system/layouts/sitemap.html: sitemap.html, create, update, careful
@ -792,14 +792,14 @@ system/workers/update.php: update.php, create, update
system/workers/updatepatch.bin: updatepatch.php, create, additional
Extension: Wiki
Version: 0.9.3
Version: 0.9.4
Description: Wiki for your website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-wiki/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-wiki
DocumentationLanguage: en, de, sv
Published: 2024-04-30 16:45:31
Published: 2024-05-09 15:43:40
Status: available
system/workers/wiki.php: wiki.php, create, update
system/layouts/wiki.html: wiki.html, create, update, careful

View file

@ -1,14 +1,14 @@
# Datenstrom Yellow extension settings
Extension: Core
Version: 0.9.9
Version: 0.9.10
Description: Core functionality of your website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-core
DocumentationLanguage: en, de, sv
Published: 2024-05-02 16:35:25
Published: 2024-05-09 16:15:59
Status: available
system/workers/core.php: core.php, create, update
system/extensions/core.php: corepatch.txt, update
@ -20,14 +20,14 @@ system/layouts/navigation.html: navigation.html, create, update, careful
system/layouts/pagination.html: pagination.html, create, update, careful
Extension: Edit
Version: 0.9.8
Version: 0.9.9
Description: Edit your website in a web browser.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-edit/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-edit
DocumentationLanguage: en, de, sv
Published: 2024-05-07 07:20:40
Published: 2024-05-09 16:45:47
Status: available
system/workers/edit.php: edit.php, create, update
system/workers/edit.css: edit.css, create, update
@ -36,14 +36,14 @@ system/workers/edit-stack.svg: edit-stack.svg, create, update
content/shared/page-new-default.md: page-new-default.md, create, optional
Extension: Generate
Version: 0.9.5
Version: 0.9.6
Description: Generate a static website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-generate/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-generate
DocumentationLanguage: en, de, sv
Published: 2024-04-25 15:39:34
Published: 2024-05-09 16:39:21
Status: available
system/workers/generate.php: generate.php, create, update

View file

@ -2,7 +2,7 @@
// Core extension, https://github.com/annaesvensson/yellow-core
class YellowCore {
const VERSION = "0.9.9";
const VERSION = "0.9.10";
const RELEASE = "0.9";
public $content; // content files
public $media; // media files
@ -1535,6 +1535,11 @@ class YellowLookup {
return $output;
}
// Normalise CSS class
public function normaliseClass($text) {
return str_replace(array(" ", "_"), array("-", "-"), strtoloweru($text));
}
// Normalise relative path tokens
public function normalisePath($text) {
$textFiltered = "";
@ -1593,10 +1598,15 @@ class YellowLookup {
}
// Normalise location arguments
public function normaliseArguments($text, $appendSlash = true, $filterStrict = true) {
if ($appendSlash) $text .= "/";
public function normaliseArguments($text, $filterStrict = true) {
if ($filterStrict) $text = str_replace(" ", "-", strtoloweru($text));
$text = str_replace(":", $this->yellow->toolbox->getLocationArgumentsSeparator(), $text);
$separator = $this->yellow->toolbox->getLocationArgumentsSeparator();
$text = str_replace(":", $separator, $text);
if (preg_match("/^(.*\/)?page$separator.*$/", $text)) {
$text = rtrim($text, "/");
} else {
$text = rtrim($text, "/")."/";
}
return str_replace(array("%2F","%3A","%3D"), array("/",":","="), rawurlencode($text));
}
@ -1940,8 +1950,7 @@ class YellowToolbox {
$locationArguments .= "$key:$value";
}
if (!is_string_empty($locationArguments)) {
$locationArguments = $this->yellow->lookup->normaliseArguments($locationArguments, false, false);
if (!$this->isLocationArgumentsPagination($locationArguments)) $locationArguments .= "/";
$locationArguments = $this->yellow->lookup->normaliseArguments($locationArguments);
}
return $locationArguments;
}
@ -1958,8 +1967,7 @@ class YellowToolbox {
}
}
if (!is_string_empty($locationArguments)) {
$locationArguments = $this->yellow->lookup->normaliseArguments($locationArguments, false, false);
if (!$this->isLocationArgumentsPagination($locationArguments)) $locationArguments .= "/";
$locationArguments = $this->yellow->lookup->normaliseArguments($locationArguments);
}
return $locationArguments;
}
@ -2982,7 +2990,7 @@ class YellowToolbox {
// Check if there are pagination arguments in current HTTP request
public function isLocationArgumentsPagination($location) {
$separator = $this->getLocationArgumentsSeparator();
return preg_match("/^(.*\/)?page$separator.*$/", $location);
return preg_match("/^(.*\/)?page$separator\d+$/", $location);
}
// Check if unmodified since last HTTP request

View file

@ -2,7 +2,7 @@
// Edit extension, https://github.com/annaesvensson/yellow-edit
class YellowEdit {
const VERSION = "0.9.8";
const VERSION = "0.9.9";
public $yellow; // access to API
public $response; // web response
public $merge; // text merge
@ -1594,7 +1594,7 @@ class YellowEditResponse {
$expire = time() + 60*60*24;
$actionToken = $this->createActionToken($email, $action, $expire);
$locationArguments = "/action:$action/email:$email/expire:$expire/language:$userLanguage/actiontoken:$actionToken/";
$url = "$scheme://$address$base".$this->yellow->lookup->normaliseArguments($locationArguments, false, false);
$url = "$scheme://$address$base".$this->yellow->lookup->normaliseArguments($locationArguments, false);
}
$prefix = "edit".ucfirst($action);
$message = $this->yellow->language->getText("{$prefix}Message", $userLanguage);

View file

@ -2,12 +2,12 @@
// Generate extension, https://github.com/annaesvensson/yellow-generate
class YellowGenerate {
const VERSION = "0.9.5";
public $yellow; // access to API
public $files; // number of files
public $errors; // number of errors
public $locationsArguments; // locations with location arguments detected
public $locationsArgumentsPagination; // locations with pagination arguments detected
const VERSION = "0.9.6";
public $yellow; // access to API
public $files; // number of files
public $errors; // number of errors
public $locationsWithArguments; // locations with arguments detected
public $locationsWithPagination; // locations with pagination detected
// Handle initialisation
public function onLoad($yellow) {
@ -82,7 +82,7 @@ class YellowGenerate {
// Generate static content
public function generateStaticContent($path, $locationFilter, $progressText, $increments, $max) {
$statusCode = 200;
$this->locationsArguments = $this->locationsArgumentsPagination = array();
$this->locationsWithArguments = $this->locationsWithPagination = array();
$staticUrl = $this->yellow->system->get("generateStaticUrl");
list($scheme, $address, $base) = $this->yellow->lookup->getUrlInformation($staticUrl);
$locations = $this->getContentLocations();
@ -92,18 +92,15 @@ class YellowGenerate {
if (!preg_match("#^$base$locationFilter#", "$base$location")) continue;
$statusCode = max($statusCode, $this->generateStaticFile($path, $location, true));
}
foreach ($this->locationsArguments as $location) {
foreach ($this->locationsWithArguments as $location) {
echo "$progressText ".$this->getProgressPercent($this->files, $filesEstimated, $increments, $max/1.5)."%... ";
if (!preg_match("#^$base$locationFilter#", "$base$location")) continue;
$statusCode = max($statusCode, $this->generateStaticFile($path, $location, true));
}
$filesEstimated = $this->files + count($this->locationsArguments) + count($this->locationsArgumentsPagination);
foreach ($this->locationsArgumentsPagination as $location) {
$filesEstimated = $this->files + count($this->locationsWithArguments) + count($this->locationsWithPagination);
foreach ($this->locationsWithPagination as $location) {
echo "$progressText ".$this->getProgressPercent($this->files, $filesEstimated, $increments, $max)."%... ";
if (!preg_match("#^$base$locationFilter#", "$base$location")) continue;
if (substru($location, -1)!=$this->yellow->toolbox->getLocationArgumentsSeparator()) {
$statusCode = max($statusCode, $this->generateStaticFile($path, $location, false, true));
}
for ($pageNumber=2; $pageNumber<=999; ++$pageNumber) {
$statusCodeLocation = $this->generateStaticFile($path, $location.$pageNumber, false, true);
$statusCode = max($statusCode, $statusCodeLocation);
@ -155,7 +152,7 @@ class YellowGenerate {
} else {
$statusCode = $this->copyStaticFile($path, $location);
}
if ($statusCode==200 && $analyse) $this->analyseLocations($scheme, $address, $base, $fileData);
if ($statusCode==200 && $analyse) $this->analyseStaticLocations($scheme, $address, $base, $fileData);
if ($statusCode==404 && $probe) $statusCode = 100;
if ($statusCode==404 && $error) $statusCode = 200;
if ($statusCode>=200) ++$this->files;
@ -219,8 +216,8 @@ class YellowGenerate {
return $statusCode;
}
// Analyse locations with arguments
public function analyseLocations($scheme, $address, $base, $rawData) {
// Analyse static locations with arguments
public function analyseStaticLocations($scheme, $address, $base, $rawData) {
preg_match_all("/<(.*?)href=\"([^\"]+)\"(.*?)>/i", $rawData, $matches);
foreach ($matches[2] as $match) {
$location = rawurldecode($match);
@ -235,19 +232,18 @@ class YellowGenerate {
$location = substru($location, strlenu($base));
if (!$this->yellow->toolbox->isLocationArguments($location)) continue;
if (!$this->yellow->toolbox->isLocationArgumentsPagination($location)) {
$location = rtrim($location, "/")."/";
if (!isset($this->locationsArguments[$location])) {
$this->locationsArguments[$location] = $location;
if (!isset($this->locationsWithArguments[$location])) {
$this->locationsWithArguments[$location] = $location;
if ($this->yellow->system->get("coreDebugMode")>=2) {
echo "YellowGenerate::analyseLocations detected location:$location<br/>\n";
echo "YellowGenerate::analyseStaticLocations detected location:$location<br/>\n";
}
}
} else {
$location = rtrim($location, "0..9");
if (!isset($this->locationsArgumentsPagination[$location])) {
$this->locationsArgumentsPagination[$location] = $location;
if (!isset($this->locationsWithPagination[$location])) {
$this->locationsWithPagination[$location] = $location;
if ($this->yellow->system->get("coreDebugMode")>=2) {
echo "YellowGenerate::analyseLocations detected location:$location<br/>\n";
echo "YellowGenerate::analyseStaticLocations detected location:$location<br/>\n";
}
}
}

Binary file not shown.

Binary file not shown.