@@ -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? |
@@ -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 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 'metatags' => [ |
65 | 65 | 'robots' => 'index,follow', // SEO robots default directive |
66 | 66 | ], |
67 | - 'pages' => [ // Markdown content management |
|
67 | + 'pages' => [// Markdown content management |
|
68 | 68 | 'dir' => 'pages', // pages files directory |
69 | 69 | 'ext' => ['md', 'markdown', 'mdown', 'mkdn', 'mkd', 'text', 'txt'], // supported files formats, by extension |
70 | 70 | 'exclude' => ['vendor', 'node_modules'], // directories, paths and files name to exclude (accepts globs, strings and regexes) |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | 'caption' => false, // puts the image in a <figure> element and adds a <figcaption> containing the title |
88 | 88 | 'placeholder' => '', // fill <img> background before loading (`color` or `lqip`) |
89 | 89 | 'class' => '', // puts default CSS class(es) to each image |
90 | - 'remote' => [ // turns remote images into Assets to process them (disable with `false`) |
|
90 | + 'remote' => [// turns remote images into Assets to process them (disable with `false`) |
|
91 | 91 | 'fallback' => '', // path to the fallback image, stored in assets directory (empty by default) |
92 | 92 | ], |
93 | 93 | ], |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | //], |
100 | 100 | 'external' => [ |
101 | 101 | 'blank' => false, // if `true` open external link in new tab |
102 | - 'noopener' => true, // add "noopener" to `rel` attribute |
|
103 | - 'noreferrer' => true, // add "noreferrer" to `rel` attribute |
|
104 | - 'nofollow' => true, // add "nofollow" to `rel` attribute |
|
102 | + 'noopener' => true, // add "noopener" to `rel` attribute |
|
103 | + 'noreferrer' => true, // add "noreferrer" to `rel` attribute |
|
104 | + 'nofollow' => true, // add "nofollow" to `rel` attribute |
|
105 | 105 | ] |
106 | 106 | ], |
107 | 107 | 'excerpt' => [ |
@@ -117,22 +117,22 @@ discard block |
||
117 | 117 | // <position> => 'Cecil\Generator\<class>', |
118 | 118 | //], |
119 | 119 | ], |
120 | - 'data' => [ // data files |
|
120 | + 'data' => [// data files |
|
121 | 121 | 'dir' => 'data', // data files directory |
122 | 122 | 'ext' => ['yaml', 'yml', 'json', 'xml', 'csv'], // loaded files by extension |
123 | 123 | 'load' => true, // enables `site.data` collection |
124 | 124 | ], |
125 | - 'static' => [ // static files |
|
125 | + 'static' => [// static files |
|
126 | 126 | 'dir' => 'static', // static files directory |
127 | 127 | 'target' => '', // subdirectory where files are copied |
128 | 128 | 'exclude' => ['sass', 'scss', '*.scss', 'package*.json', 'node_modules'], // excluded files by extension or pattern |
129 | 129 | 'load' => false, // enables `site.static` collection |
130 | 130 | ], |
131 | - 'assets' => [ // assets: CSS, JS, images, etc. |
|
131 | + 'assets' => [// assets: CSS, JS, images, etc. |
|
132 | 132 | 'dir' => 'assets', // assets files directory |
133 | 133 | 'target' => 'assets', // where processed assets are saved (in output directory) |
134 | 134 | 'fingerprint' => true, // enables fingerprinting |
135 | - 'compile' => [ // disable Sass files compilation with `false` |
|
135 | + 'compile' => [// disable Sass files compilation with `false` |
|
136 | 136 | 'style' => 'expanded', // compilation style (`expanded` or `compressed`) |
137 | 137 | 'import' => ['sass', 'scss', 'node_modules'], // list of imported directories |
138 | 138 | 'sourcemap' => false, // enables sourcemap in debug mode |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | //] |
159 | 159 | ], |
160 | 160 | ], |
161 | - 'layouts' => [ // layouts and templates |
|
161 | + 'layouts' => [// layouts and templates |
|
162 | 162 | 'dir' => 'layouts', // Twig templates directory |
163 | - 'translations' => [ // i18n |
|
163 | + 'translations' => [// i18n |
|
164 | 164 | 'dir' => 'translations', // translations files directory |
165 | 165 | 'formats' => ['yaml', 'mo'], // translations supported formats |
166 | 166 | ], |
167 | - 'extensions' => [ // list of Twig extensions class |
|
167 | + 'extensions' => [// list of Twig extensions class |
|
168 | 168 | //'<name>' => 'Cecil\Renderer\Extension\<class>', |
169 | 169 | ], |
170 | - 'components' => [ // components |
|
170 | + 'components' => [// components |
|
171 | 171 | 'dir' => 'components', // components directory |
172 | 172 | 'ext' => 'twig', // components files extension |
173 | 173 | ], |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | 'themes' => [ |
179 | 179 | 'dir' => 'themes', // where themes are stored |
180 | 180 | ], |
181 | - 'output' => [ // output formats and post process |
|
181 | + 'output' => [// output formats and post process |
|
182 | 182 | 'dir' => '_site', // output directory |
183 | 183 | //'formats' => [ // https://cecil.app/documentation/configuration/#formats |
184 | 184 | // [ |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // 'exclude' => ['variable1', 'variable2'], |
190 | 190 | // ], |
191 | 191 | //], |
192 | - 'pagetypeformats' => [ // formats applied by page type |
|
192 | + 'pagetypeformats' => [// formats applied by page type |
|
193 | 193 | 'page' => ['html'], |
194 | 194 | 'homepage' => ['html', 'atom'], |
195 | 195 | 'section' => ['html', 'atom'], |
@@ -200,12 +200,12 @@ discard block |
||
200 | 200 | // '<name>' => 'Cecil\Renderer\PostProcessor\<class>', |
201 | 201 | //], |
202 | 202 | ], |
203 | - 'cache' => [ // cache management, disable with `false` |
|
203 | + 'cache' => [// cache management, disable with `false` |
|
204 | 204 | 'dir' => '.cache', // cache files directory |
205 | 205 | 'templates' => true, // disable Twig templates cache with `false` |
206 | 206 | 'translations' => true, // disable translations dictionary cache with `false` |
207 | 207 | ], |
208 | - 'optimize' => [ // files optimization |
|
208 | + 'optimize' => [// files optimization |
|
209 | 209 | 'enabled' => false, // enables files optimization |
210 | 210 | 'html' => [ |
211 | 211 | 'enabled' => true, // enables HTML files optimization |