| @@ -60,7 +60,7 @@ | ||
| 60 | 60 | /** | 
| 61 | 61 |       * {@inheritdoc} | 
| 62 | 62 | */ | 
| 63 | - public function log($level, string|\Stringable $message, array $context = []): void | |
| 63 | + public function log($level, string | \Stringable $message, array $context = []): void | |
| 64 | 64 |      { | 
| 65 | 65 | $output = $this->output; | 
| 66 | 66 |          $output->getFormatter()->setStyle('text', new OutputFormatterStyle('white')); | 
| @@ -141,7 +141,7 @@ | ||
| 141 | 141 | /** | 
| 142 | 142 | * Adds navigation (next and prev) to section subpages. | 
| 143 | 143 | */ | 
| 144 | - protected function addNavigationLinks(PagesCollection $pages, string|null $sortBy = null, bool $circular = false): void | |
| 144 | + protected function addNavigationLinks(PagesCollection $pages, string | null $sortBy = null, bool $circular = false): void | |
| 145 | 145 |      { | 
| 146 | 146 | $pagesAsArray = $pages->toArray(); | 
| 147 | 147 |          if ($sortBy === null || $sortBy == 'date' || $sortBy == 'updated') { | 
| @@ -184,7 +184,7 @@ | ||
| 184 | 184 | /** | 
| 185 | 185 | * Returns the property value(s) of an output format. | 
| 186 | 186 | */ | 
| 187 | - public function getOutputProperty(string $name, string $property): string|array|null | |
| 187 | + public function getOutputProperty(string $name, string $property): string | array | null | |
| 188 | 188 |      { | 
| 189 | 189 | return $this->config->getOutputFormatProperty($name, $property); | 
| 190 | 190 | } | 
| @@ -46,7 +46,7 @@ | ||
| 46 | 46 | /** | 
| 47 | 47 |       * {@inheritdoc} | 
| 48 | 48 | */ | 
| 49 | - public function log($level, string|\Stringable $message, array $context = []): void | |
| 49 | + public function log($level, string | \Stringable $message, array $context = []): void | |
| 50 | 50 |      { | 
| 51 | 51 |          if (!isset($this->verbosityLevelMap[$level])) { | 
| 52 | 52 |              throw new InvalidArgumentException(\sprintf('The log level "%s" does not exist.', $level)); | 
| @@ -83,81 +83,81 @@ | ||
| 83 | 83 | ], | 
| 84 | 84 | 'output' => [ | 
| 85 | 85 | 'formats' => [ | 
| 86 | - [ // e.g.: blog/post-1/index.html | |
| 86 | + [// e.g.: blog/post-1/index.html | |
| 87 | 87 | 'name' => 'html', | 
| 88 | 88 | 'mediatype' => 'text/html', | 
| 89 | 89 | 'filename' => 'index', | 
| 90 | 90 | 'extension' => 'html', | 
| 91 | 91 | ], | 
| 92 | - [ // e.g.: blog/atom.xml | |
| 92 | + [// e.g.: blog/atom.xml | |
| 93 | 93 | 'name' => 'atom', | 
| 94 | 94 | 'mediatype' => 'application/atom+xml', | 
| 95 | 95 | 'filename' => 'atom', | 
| 96 | 96 | 'extension' => 'xml', | 
| 97 | 97 | 'exclude' => ['redirect', 'paginated'], | 
| 98 | 98 | ], | 
| 99 | - [ // e.g.: blog/rss.xml | |
| 99 | + [// e.g.: blog/rss.xml | |
| 100 | 100 | 'name' => 'rss', | 
| 101 | 101 | 'mediatype' => 'application/rss+xml', | 
| 102 | 102 | 'filename' => 'rss', | 
| 103 | 103 | 'extension' => 'xml', | 
| 104 | 104 | 'exclude' => ['redirect', 'paginated'], | 
| 105 | 105 | ], | 
| 106 | - [ // e.g.: blog.json | |
| 106 | + [// e.g.: blog.json | |
| 107 | 107 | 'name' => 'json', | 
| 108 | 108 | 'mediatype' => 'application/json', | 
| 109 | 109 | 'extension' => 'json', | 
| 110 | 110 | 'exclude' => ['redirect'], | 
| 111 | 111 | ], | 
| 112 | - [ // e.g.: blog.xml | |
| 112 | + [// e.g.: blog.xml | |
| 113 | 113 | 'name' => 'xml', | 
| 114 | 114 | 'mediatype' => 'application/xml', | 
| 115 | 115 | 'extension' => 'xml', | 
| 116 | 116 | 'exclude' => ['redirect'], | 
| 117 | 117 | ], | 
| 118 | - [ // e.g.: robots.txt | |
| 118 | + [// e.g.: robots.txt | |
| 119 | 119 | 'name' => 'txt', | 
| 120 | 120 | 'mediatype' => 'text/plain', | 
| 121 | 121 | 'extension' => 'txt', | 
| 122 | 122 | 'exclude' => ['redirect'], | 
| 123 | 123 | ], | 
| 124 | - [ // e.g.: blog/post-1/amp/index.html | |
| 124 | + [// e.g.: blog/post-1/amp/index.html | |
| 125 | 125 | 'name' => 'amp', | 
| 126 | 126 | 'mediatype' => 'text/html', | 
| 127 | 127 | 'subpath' => 'amp', | 
| 128 | 128 | 'filename' => 'index', | 
| 129 | 129 | 'extension' => 'html', | 
| 130 | 130 | ], | 
| 131 | - [ // e.g.: sw.js | |
| 131 | + [// e.g.: sw.js | |
| 132 | 132 | 'name' => 'js', | 
| 133 | 133 | 'mediatype' => 'application/javascript', | 
| 134 | 134 | 'extension' => 'js', | 
| 135 | 135 | ], | 
| 136 | - [ // e.g.: manifest.webmanifest | |
| 136 | + [// e.g.: manifest.webmanifest | |
| 137 | 137 | 'name' => 'webmanifest', | 
| 138 | 138 | 'mediatype' => 'application/manifest+json', | 
| 139 | 139 | 'extension' => 'webmanifest', | 
| 140 | 140 | ], | 
| 141 | - [ // e.g.: atom.xsl | |
| 141 | + [// e.g.: atom.xsl | |
| 142 | 142 | 'name' => 'xsl', | 
| 143 | 143 | 'mediatype' => 'application/xml', | 
| 144 | 144 | 'extension' => 'xsl', | 
| 145 | 145 | ], | 
| 146 | - [ // e.g.: blog/feed.json | |
| 146 | + [// e.g.: blog/feed.json | |
| 147 | 147 | 'name' => 'jsonfeed', | 
| 148 | 148 | 'mediatype' => 'application/json', | 
| 149 | 149 | 'filename' => 'feed', | 
| 150 | 150 | 'extension' => 'json', | 
| 151 | 151 | 'exclude' => ['redirect', 'paginated'], | 
| 152 | 152 | ], | 
| 153 | - [ // e.g.: video/embed.html | |
| 153 | + [// e.g.: video/embed.html | |
| 154 | 154 | 'name' => 'iframe', | 
| 155 | 155 | 'mediatype' => 'text/html', | 
| 156 | 156 | 'filename' => 'embed', | 
| 157 | 157 | 'extension' => 'html', | 
| 158 | 158 | 'exclude' => ['redirect', 'paginated'], | 
| 159 | 159 | ], | 
| 160 | - [ // e.g.: video/embed.json | |
| 160 | + [// e.g.: video/embed.json | |
| 161 | 161 | 'name' => 'oembed', | 
| 162 | 162 | 'mediatype' => 'application/json+oembed', | 
| 163 | 163 | 'filename' => 'embed', | 
| @@ -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': | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 |      { | 
| 68 | 68 | $this->data->import($config, $mode); | 
| 69 | 69 | $this->setFromEnv(); // override configuration with environment variables | 
| 70 | - $this->validate(); // validate configuration | |
| 70 | + $this->validate(); // validate configuration | |
| 71 | 71 | } | 
| 72 | 72 | |
| 73 | 73 | /** | 
| @@ -385,7 +385,7 @@ discard block | ||
| 385 | 385 | * | 
| 386 | 386 | * @throws ConfigException | 
| 387 | 387 | */ | 
| 388 | - public function getOutputFormatProperty(string $name, string $property): string|array|null | |
| 388 | + public function getOutputFormatProperty(string $name, string $property): string | array | null | |
| 389 | 389 |      { | 
| 390 | 390 |          $properties = array_column((array) $this->get('output.formats'), $property, 'name'); | 
| 391 | 391 |          if (empty($properties)) { | 
| @@ -289,10 +289,10 @@ discard block | ||
| 289 | 289 | public static function sanitizeKey(string $key): string | 
| 290 | 290 |      { | 
| 291 | 291 | $key = str_replace(['https://', 'http://'], '', $key); // remove protocol (if URL) | 
| 292 | - $key = Page::slugify($key); // slugify | |
| 293 | - $key = trim($key, '/'); // remove leading/trailing slashes | |
| 294 | - $key = str_replace(['\\', '/'], ['-', '-'], $key); // replace slashes by hyphens | |
| 295 | - $key = substr($key, 0, 200); // truncate to 200 characters (NTFS filename length limit is 255 characters) | |
| 292 | + $key = Page::slugify($key); // slugify | |
| 293 | + $key = trim($key, '/'); // remove leading/trailing slashes | |
| 294 | + $key = str_replace(['\\', '/'], ['-', '-'], $key); // replace slashes by hyphens | |
| 295 | + $key = substr($key, 0, 200); // truncate to 200 characters (NTFS filename length limit is 255 characters) | |
| 296 | 296 | |
| 297 | 297 | return $key; | 
| 298 | 298 | } | 
| @@ -325,7 +325,7 @@ discard block | ||
| 325 | 325 | /** | 
| 326 | 326 | * Convert the various expressions of a TTL value into duration in seconds. | 
| 327 | 327 | */ | 
| 328 | - protected function duration(int|\DateInterval $ttl): int | |
| 328 | + protected function duration(int | \DateInterval $ttl): int | |
| 329 | 329 |      { | 
| 330 | 330 |          if (\is_int($ttl)) { | 
| 331 | 331 | return $ttl; | 
| @@ -65,7 +65,7 @@ discard block | ||
| 65 | 65 | 'metatags' => [ | 
| 66 | 66 | 'robots' => 'index,follow', // SEO robots default directive | 
| 67 | 67 | ], | 
| 68 | - 'pages' => [ // Markdown content management | |
| 68 | + 'pages' => [// Markdown content management | |
| 69 | 69 | 'dir' => 'pages', // pages files directory | 
| 70 | 70 | 'ext' => ['md', 'markdown', 'mdown', 'mkdn', 'mkd', 'text', 'txt'], // supported files formats, by extension | 
| 71 | 71 | 'exclude' => ['vendor', 'node_modules'], // directories, paths and files name to exclude (accepts globs, strings and regexes) | 
| @@ -99,12 +99,12 @@ discard block | ||
| 99 | 99 | 'caption' => false, // puts the image in a <figure> element and adds a <figcaption> containing the title | 
| 100 | 100 | 'placeholder' => '', // fill <img> background before loading (`color` or `lqip`) | 
| 101 | 101 | 'class' => '', // puts default CSS class(es) to each image | 
| 102 | - 'remote' => [ // turns remote images into Assets to process them (disable with `false`) | |
| 102 | + 'remote' => [// turns remote images into Assets to process them (disable with `false`) | |
| 103 | 103 | 'fallback' => '', // path to the fallback image, stored in assets directory (empty by default) | 
| 104 | 104 | ], | 
| 105 | 105 | ], | 
| 106 | 106 | 'links' => [ | 
| 107 | - 'embed' => [ // turns links in embedded content if possible | |
| 107 | + 'embed' => [// turns links in embedded content if possible | |
| 108 | 108 | 'enabled' => false, | 
| 109 | 109 | 'video' => ['mp4', 'webm'], // supported video file types, by extension | 
| 110 | 110 | 'audio' => ['mp3', 'ogg', 'wav'], // supported audio file types, by extension | 
| @@ -125,16 +125,16 @@ discard block | ||
| 125 | 125 | // <position> => 'Cecil\Generator\<class>', | 
| 126 | 126 | //], | 
| 127 | 127 | ], | 
| 128 | - 'data' => [ // data files | |
| 128 | + 'data' => [// data files | |
| 129 | 129 | 'dir' => 'data', // data files directory | 
| 130 | 130 | 'ext' => ['yaml', 'yml', 'json', 'xml', 'csv'], // loaded files by extension | 
| 131 | 131 | 'load' => true, // enables `site.data` collection | 
| 132 | 132 | ], | 
| 133 | - 'assets' => [ // assets: CSS, JS, images, etc. | |
| 133 | + 'assets' => [// assets: CSS, JS, images, etc. | |
| 134 | 134 | 'dir' => 'assets', // assets files directory | 
| 135 | 135 | 'target' => '', // where processed assets are saved (in output directory) | 
| 136 | 136 | 'fingerprint' => true, // enables fingerprinting | 
| 137 | - 'compile' => [ // Sass files compilation | |
| 137 | + 'compile' => [// Sass files compilation | |
| 138 | 138 | 'style' => 'expanded', // compilation style (`expanded` or `compressed`) | 
| 139 | 139 | 'import' => ['sass', 'scss', 'node_modules'], // list of imported directories | 
| 140 | 140 | 'sourcemap' => false, // enables sourcemap in debug mode | 
| @@ -145,7 +145,7 @@ discard block | ||
| 145 | 145 | 'optimize' => false, // enables images optimization with JpegOptim, Optipng, Pngquant 2, SVGO 1, Gifsicle, cwebp, avifenc | 
| 146 | 146 | 'quality' => 75, // image quality after optimization or resize | 
| 147 | 147 | 'formats' => [], // creates and adds formats images as `source` (e.g.: ['webp', 'avif']) | 
| 148 | - 'responsive' => [ // options of generated responsive images | |
| 148 | + 'responsive' => [// options of generated responsive images | |
| 149 | 149 | 'widths' => [480, 640, 768, 1024, 1366, 1600, 1920], // `srcset` widths | 
| 150 | 150 | 'sizes' => ['default' => '100vw'] // default `sizes` attribute | 
| 151 | 151 | ], | 
| @@ -159,26 +159,26 @@ discard block | ||
| 159 | 159 | //] | 
| 160 | 160 | ], | 
| 161 | 161 | ], | 
| 162 | - 'static' => [ // static files | |
| 162 | + 'static' => [// static files | |
| 163 | 163 | 'dir' => 'static', // static files directory | 
| 164 | 164 | 'target' => '', // subdirectory where files are copied | 
| 165 | 165 | 'exclude' => ['sass', 'scss', '*.scss', 'package*.json', 'node_modules'], // excluded files by extension or pattern | 
| 166 | 166 | 'load' => false, // enables `site.static` collection | 
| 167 | 167 | ], | 
| 168 | - 'layouts' => [ // layouts and templates | |
| 168 | + 'layouts' => [// layouts and templates | |
| 169 | 169 | 'dir' => 'layouts', // Twig templates directory | 
| 170 | - 'images' => [ // how to handle images in templates | |
| 170 | + 'images' => [// how to handle images in templates | |
| 171 | 171 | 'formats' => [], // creates and adds formats images as `source` (e.g.: ['webp', 'avif']) | 
| 172 | 172 | 'responsive' => false, // enables responsive images | 
| 173 | 173 | ], | 
| 174 | - 'translations' => [ // i18n | |
| 174 | + 'translations' => [// i18n | |
| 175 | 175 | 'dir' => 'translations', // translations files directory | 
| 176 | 176 | 'formats' => ['yaml', 'mo'], // translations supported formats | 
| 177 | 177 | ], | 
| 178 | - 'extensions' => [ // list of Twig extensions class | |
| 178 | + 'extensions' => [// list of Twig extensions class | |
| 179 | 179 | //'<name>' => 'Cecil\Renderer\Extension\<class>', | 
| 180 | 180 | ], | 
| 181 | - 'components' => [ // components | |
| 181 | + 'components' => [// components | |
| 182 | 182 | 'dir' => 'components', // components directory | 
| 183 | 183 | 'ext' => 'twig', // components files extension | 
| 184 | 184 | ], | 
| @@ -186,7 +186,7 @@ discard block | ||
| 186 | 186 | // '<section>' => '<layout>', | 
| 187 | 187 | //] | 
| 188 | 188 | ], | 
| 189 | - 'output' => [ // output formats and post process | |
| 189 | + 'output' => [// output formats and post process | |
| 190 | 190 | 'dir' => '_site', // output directory | 
| 191 | 191 | //'formats' => [ // https://cecil.app/documentation/configuration/#formats | 
| 192 | 192 | // [ | 
| @@ -197,7 +197,7 @@ discard block | ||
| 197 | 197 | // 'exclude' => ['variable1', 'variable2'], | 
| 198 | 198 | // ], | 
| 199 | 199 | //], | 
| 200 | - 'pagetypeformats' => [ // formats applied by page type | |
| 200 | + 'pagetypeformats' => [// formats applied by page type | |
| 201 | 201 | 'page' => ['html'], | 
| 202 | 202 | 'homepage' => ['html', 'atom'], | 
| 203 | 203 | 'section' => ['html', 'atom'], | 
| @@ -208,10 +208,10 @@ discard block | ||
| 208 | 208 | // '<name>' => 'Cecil\Renderer\PostProcessor\<class>', | 
| 209 | 209 | //], | 
| 210 | 210 | ], | 
| 211 | - 'cache' => [ // cache management | |
| 211 | + 'cache' => [// cache management | |
| 212 | 212 | 'enabled' => true, // disable with `false` | 
| 213 | 213 | 'dir' => '.cache', // cache files root directory | 
| 214 | - 'assets' => [ // assets cache | |
| 214 | + 'assets' => [// assets cache | |
| 215 | 215 | 'ttl' => null, // assets cache TTL (no expiration by default) | 
| 216 | 216 | 'remote' => [ | 
| 217 | 217 | 'ttl' => 604800, // remote assets cache TTL (7 days by default) | 
| @@ -220,7 +220,7 @@ discard block | ||
| 220 | 220 | 'templates' => true, // disable Twig templates cache with `false` | 
| 221 | 221 | 'translations' => true, // disable translations dictionary cache with `false` | 
| 222 | 222 | ], | 
| 223 | - 'optimize' => [ // files optimization | |
| 223 | + 'optimize' => [// files optimization | |
| 224 | 224 | 'enabled' => false, // enables files optimization | 
| 225 | 225 | 'html' => [ | 
| 226 | 226 | 'enabled' => true, // enables HTML files optimization |