@@ -246,10 +246,10 @@ discard block |
||
| 246 | 246 | public function sanitizeKey(string $key): string |
| 247 | 247 | { |
| 248 | 248 | $key = str_replace(['https://', 'http://'], '', $key); // remove protocol (if URL) |
| 249 | - $key = Page::slugify($key); // slugify |
|
| 250 | - $key = trim($key, '/'); // remove leading/trailing slashes |
|
| 251 | - $key = str_replace(['\\', '/'], ['-', '-'], $key); // replace slashes by hyphens |
|
| 252 | - $key = substr($key, 0, 200); // truncate to 200 characters (NTFS filename length limit is 255 characters) |
|
| 249 | + $key = Page::slugify($key); // slugify |
|
| 250 | + $key = trim($key, '/'); // remove leading/trailing slashes |
|
| 251 | + $key = str_replace(['\\', '/'], ['-', '-'], $key); // replace slashes by hyphens |
|
| 252 | + $key = substr($key, 0, 200); // truncate to 200 characters (NTFS filename length limit is 255 characters) |
|
| 253 | 253 | |
| 254 | 254 | return $key; |
| 255 | 255 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | /** |
| 299 | 299 | * Convert the various expressions of a TTL value into duration in seconds. |
| 300 | 300 | */ |
| 301 | - protected function duration(\DateInterval|int|null $ttl): int |
|
| 301 | + protected function duration(\DateInterval | int | null $ttl): int |
|
| 302 | 302 | { |
| 303 | 303 | if ($ttl === null) { |
| 304 | 304 | return $this->duration; |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | return $ttl; |
| 308 | 308 | } |
| 309 | 309 | if ($ttl instanceof \DateInterval) { |
| 310 | - return (int)$ttl->format('%s'); |
|
| 310 | + return (int) $ttl->format('%s'); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | throw new \InvalidArgumentException('TTL values must be one of null, int, \DateInterval'); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * |
| 283 | 283 | * @return Asset |
| 284 | 284 | */ |
| 285 | - public function asset($path, array|null $options = null): Asset |
|
| 285 | + public function asset($path, array | null $options = null): Asset |
|
| 286 | 286 | { |
| 287 | 287 | if (!\is_string($path) && !\is_array($path)) { |
| 288 | 288 | throw new RuntimeException(\sprintf('Argument of "%s()" must a string or an array.', \Cecil\Util::formatMethodName(__METHOD__))); |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | /** |
| 934 | 934 | * Hashing an object, an array or a string (with algo, md5 by default). |
| 935 | 935 | */ |
| 936 | - public function hash(object|array|string $data, $algo = 'md5'): string |
|
| 936 | + public function hash(object | array | string $data, $algo = 'md5'): string |
|
| 937 | 937 | { |
| 938 | 938 | switch (\gettype($data)) { |
| 939 | 939 | case 'object': |
@@ -53,8 +53,8 @@ |
||
| 53 | 53 | |
| 54 | 54 | // handles options |
| 55 | 55 | $canonical = null; // if true prefix url with baseurl config |
| 56 | - $format = null; // output format |
|
| 57 | - $language = null; // force language |
|
| 56 | + $format = null; // output format |
|
| 57 | + $language = null; // force language |
|
| 58 | 58 | extract(\is_array($options) ? $options : [], EXTR_IF_EXISTS); |
| 59 | 59 | |
| 60 | 60 | // canonical URL? |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | // '<plural>' => '<vocabulary>', |
| 55 | 55 | // '<plural>' => 'disabled', // can be disabled with the special "disabled" value |
| 56 | 56 | //], |
| 57 | - 'pages' => [ // Markdown content management |
|
| 57 | + 'pages' => [// Markdown content management |
|
| 58 | 58 | 'dir' => 'pages', // pages files directory |
| 59 | 59 | 'ext' => ['md', 'markdown', 'mdown', 'mkdn', 'mkd', 'text', 'txt'], // supported files formats, by extension |
| 60 | 60 | 'exclude' => ['vendor', 'node_modules'], // directories, paths and files name to exclude (accepts globs, strings and regexes) |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | 'caption' => false, // puts the image in a <figure> element and adds a <figcaption> containing the title |
| 78 | 78 | 'placeholder' => '', // fill <img> background before loading (`color` or `lqip`) |
| 79 | 79 | 'class' => '', // puts default CSS class(es) to each image |
| 80 | - 'remote' => [ // turns remote images into Assets to process them (disable with `false`) |
|
| 80 | + 'remote' => [// turns remote images into Assets to process them (disable with `false`) |
|
| 81 | 81 | 'fallback' => '', // path to the fallback image, stored in assets directory (empty by default) |
| 82 | 82 | ], |
| 83 | 83 | ], |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | //], |
| 90 | 90 | 'external' => [ |
| 91 | 91 | 'blank' => false, // if `true` open external link in new tab |
| 92 | - 'noopener' => true, // add "noopener" to `rel` attribute |
|
| 93 | - 'noreferrer' => true, // add "noreferrer" to `rel` attribute |
|
| 94 | - 'nofollow' => true, // add "nofollow" to `rel` attribute |
|
| 92 | + 'noopener' => true, // add "noopener" to `rel` attribute |
|
| 93 | + 'noreferrer' => true, // add "noreferrer" to `rel` attribute |
|
| 94 | + 'nofollow' => true, // add "nofollow" to `rel` attribute |
|
| 95 | 95 | ] |
| 96 | 96 | ], |
| 97 | 97 | 'excerpt' => [ |
@@ -107,22 +107,22 @@ discard block |
||
| 107 | 107 | // <position> => 'Cecil\Generator\<class>', |
| 108 | 108 | //], |
| 109 | 109 | ], |
| 110 | - 'data' => [ // data files |
|
| 110 | + 'data' => [// data files |
|
| 111 | 111 | 'dir' => 'data', // data files directory |
| 112 | 112 | 'ext' => ['yaml', 'yml', 'json', 'xml', 'csv'], // loaded files by extension |
| 113 | 113 | 'load' => true, // enables `site.data` collection |
| 114 | 114 | ], |
| 115 | - 'static' => [ // static files |
|
| 115 | + 'static' => [// static files |
|
| 116 | 116 | 'dir' => 'static', // static files directory |
| 117 | 117 | 'target' => '', // subdirectory where files are copied |
| 118 | 118 | 'exclude' => ['sass', 'scss', '*.scss', 'package*.json', 'node_modules'], // excluded files by extension or pattern |
| 119 | 119 | 'load' => false, // enables `site.static` collection |
| 120 | 120 | ], |
| 121 | - 'assets' => [ // assets: CSS, JS, images, etc. |
|
| 121 | + 'assets' => [// assets: CSS, JS, images, etc. |
|
| 122 | 122 | 'dir' => 'assets', // assets files directory |
| 123 | 123 | 'target' => 'assets', // where processed assets are saved (in output directory) |
| 124 | 124 | 'fingerprint' => true, // enables fingerprinting |
| 125 | - 'compile' => [ // disable Sass files compilation with `false` |
|
| 125 | + 'compile' => [// disable Sass files compilation with `false` |
|
| 126 | 126 | 'style' => 'expanded', // compilation style (`expanded` or `compressed`) |
| 127 | 127 | 'import' => ['sass', 'scss', 'node_modules'], // list of imported directories |
| 128 | 128 | 'sourcemap' => false, // enables sourcemap in debug mode |
@@ -148,16 +148,16 @@ discard block |
||
| 148 | 148 | //] |
| 149 | 149 | ], |
| 150 | 150 | ], |
| 151 | - 'layouts' => [ // layouts and templates |
|
| 151 | + 'layouts' => [// layouts and templates |
|
| 152 | 152 | 'dir' => 'layouts', // Twig templates directory |
| 153 | - 'translations' => [ // i18n |
|
| 153 | + 'translations' => [// i18n |
|
| 154 | 154 | 'dir' => 'translations', // translations files directory |
| 155 | 155 | 'formats' => ['yaml', 'mo'], // translations supported formats |
| 156 | 156 | ], |
| 157 | - 'extensions' => [ // list of Twig extensions class |
|
| 157 | + 'extensions' => [// list of Twig extensions class |
|
| 158 | 158 | //'<name>' => 'Cecil\Renderer\Extension\<class>', |
| 159 | 159 | ], |
| 160 | - 'components' => [ // components |
|
| 160 | + 'components' => [// components |
|
| 161 | 161 | 'dir' => 'components', // components directory |
| 162 | 162 | 'ext' => 'twig', // components files extension |
| 163 | 163 | ], |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | 'themes' => [ |
| 169 | 169 | 'dir' => 'themes', // where themes are stored |
| 170 | 170 | ], |
| 171 | - 'output' => [ // output formats and post process |
|
| 171 | + 'output' => [// output formats and post process |
|
| 172 | 172 | 'dir' => '_site', // output directory |
| 173 | 173 | //'formats' => [ // https://cecil.app/documentation/configuration/#formats |
| 174 | 174 | // [ |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | // 'exclude' => ['variable1', 'variable2'], |
| 180 | 180 | // ], |
| 181 | 181 | //], |
| 182 | - 'pagetypeformats' => [ // formats applied by page type |
|
| 182 | + 'pagetypeformats' => [// formats applied by page type |
|
| 183 | 183 | 'page' => ['html'], |
| 184 | 184 | 'homepage' => ['html', 'atom'], |
| 185 | 185 | 'section' => ['html', 'atom'], |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | // '<name>' => 'Cecil\Renderer\PostProcessor\<class>', |
| 191 | 191 | //], |
| 192 | 192 | ], |
| 193 | - 'cache' => [ // cache management, disable with `false` |
|
| 193 | + 'cache' => [// cache management, disable with `false` |
|
| 194 | 194 | 'dir' => '.cache', // cache files directory |
| 195 | 195 | 'templates' => true, // disable Twig templates cache with `false` |
| 196 | 196 | 'translations' => true, // disable translations dictionary cache with `false` |
| 197 | 197 | ], |
| 198 | - 'optimize' => [ // files optimization |
|
| 198 | + 'optimize' => [// files optimization |
|
| 199 | 199 | 'enabled' => false, // enables files optimization |
| 200 | 200 | 'html' => [ |
| 201 | 201 | 'enabled' => true, // enables HTML files optimization |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $this->data->import($config, $mode); |
| 70 | 70 | $this->setFromEnv(); // override configuration with environment variables |
| 71 | - $this->validate(); // validate configuration |
|
| 71 | + $this->validate(); // validate configuration |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | * |
| 392 | 392 | * @throws ConfigException |
| 393 | 393 | */ |
| 394 | - public function getOutputFormatProperty(string $name, string $property): string|array|null |
|
| 394 | + public function getOutputFormatProperty(string $name, string $property): string | array | null |
|
| 395 | 395 | { |
| 396 | 396 | $properties = array_column((array) $this->get('output.formats'), $property, 'name'); |
| 397 | 397 | |