@@ -93,9 +93,9 @@ |
||
93 | 93 | } elseif ($val instanceof \DateTimeInterface) { |
94 | 94 | $replacements["{{$key}}"] = $val->format(\DateTime::RFC3339); |
95 | 95 | } elseif (\is_object($val)) { |
96 | - $replacements["{{$key}}"] = '[object '.\get_class($val).']'; |
|
96 | + $replacements["{{$key}}"] = '[object ' . \get_class($val) . ']'; |
|
97 | 97 | } else { |
98 | - $replacements["{{$key}}"] = '['.\gettype($val).']'; |
|
98 | + $replacements["{{$key}}"] = '[' . \gettype($val) . ']'; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $php, |
88 | 88 | $host, |
89 | 89 | $port, |
90 | - $this->getPath().'/'.(string) $this->getBuilder()->getConfig()->get('output.dir'), |
|
90 | + $this->getPath() . '/' . (string) $this->getBuilder()->getConfig()->get('output.dir'), |
|
91 | 91 | Util::joinFile($this->getPath(), self::TMP_DIR, 'router.php') |
92 | 92 | ); |
93 | 93 | $process = Process::fromShellCommandline($command); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $buildProcessArguments[] = $clearcache; |
120 | 120 | } |
121 | 121 | if ($verbose) { |
122 | - $buildProcessArguments[] = '-'.str_repeat('v', $_SERVER['SHELL_VERBOSITY']); |
|
122 | + $buildProcessArguments[] = '-' . str_repeat('v', $_SERVER['SHELL_VERBOSITY']); |
|
123 | 123 | } |
124 | 124 | if (!empty($page)) { |
125 | 125 | $buildProcessArguments[] = '--page'; |
@@ -213,17 +213,17 @@ discard block |
||
213 | 213 | try { |
214 | 214 | $root = Util::joinFile(__DIR__, '../../'); |
215 | 215 | if (Util\Plateform::isPhar()) { |
216 | - $root = Util\Plateform::getPharPath().'/'; |
|
216 | + $root = Util\Plateform::getPharPath() . '/'; |
|
217 | 217 | } |
218 | 218 | // copying router |
219 | 219 | Util\File::getFS()->copy( |
220 | - $root.'/resources/server/router.php', |
|
220 | + $root . '/resources/server/router.php', |
|
221 | 221 | Util::joinFile($this->getPath(), self::TMP_DIR, 'router.php'), |
222 | 222 | true |
223 | 223 | ); |
224 | 224 | // copying livereload JS |
225 | 225 | Util\File::getFS()->copy( |
226 | - $root.'/resources/server/livereload.js', |
|
226 | + $root . '/resources/server/livereload.js', |
|
227 | 227 | Util::joinFile($this->getPath(), self::TMP_DIR, 'livereload.js'), |
228 | 228 | true |
229 | 229 | ); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | '%s%s%s%s%s', |
84 | 84 | (string) $this->getBuilder()->getConfig()->get('pages.dir'), |
85 | 85 | DIRECTORY_SEPARATOR, |
86 | - empty($dirname) ? '' : $dirname.DIRECTORY_SEPARATOR, |
|
86 | + empty($dirname) ? '' : $dirname . DIRECTORY_SEPARATOR, |
|
87 | 87 | $datePrefix, |
88 | 88 | $filename |
89 | 89 | ); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | // creates a new file |
107 | - $model = $this->findModel(sprintf('%s%s', empty($dirname) ? '' : $dirname.DIRECTORY_SEPARATOR, $filename)); |
|
107 | + $model = $this->findModel(sprintf('%s%s', empty($dirname) ? '' : $dirname . DIRECTORY_SEPARATOR, $filename)); |
|
108 | 108 | $fileContent = str_replace( |
109 | 109 | ['%title%', '%date%'], |
110 | 110 | [$title, $date], |
@@ -67,7 +67,7 @@ |
||
67 | 67 | // define root path |
68 | 68 | $root = realpath(Util::joinFile(__DIR__, '/../../')); |
69 | 69 | if (Util\Plateform::isPhar()) { |
70 | - $root = Util\Plateform::getPharPath().'/'; |
|
70 | + $root = Util\Plateform::getPharPath() . '/'; |
|
71 | 71 | } |
72 | 72 | // ask for basic configuration |
73 | 73 | $output->writeln('Creating a new website...'); |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | public static function createIdFromFile(SplFileInfo $file): string |
110 | 110 | { |
111 | 111 | $relativePath = self::slugify(str_replace(DIRECTORY_SEPARATOR, '/', $file->getRelativePath())); |
112 | - $basename = self::slugify(PrefixSuffix::subPrefix($file->getBasename('.'.$file->getExtension()))); |
|
112 | + $basename = self::slugify(PrefixSuffix::subPrefix($file->getBasename('.' . $file->getExtension()))); |
|
113 | 113 | // if file is "README.md", ID is "index" |
114 | 114 | $basename = (string) str_ireplace('readme', 'index', $basename); |
115 | 115 | // if file is section's index: "section/index.md", ID is "section" |
116 | 116 | if (!empty($relativePath) && PrefixSuffix::sub($basename) == 'index') { |
117 | 117 | // case of a localized section's index: "section/index.fr.md", ID is "fr/section" |
118 | 118 | if (PrefixSuffix::hasSuffix($basename)) { |
119 | - return PrefixSuffix::getSuffix($basename).'/'.$relativePath; |
|
119 | + return PrefixSuffix::getSuffix($basename) . '/' . $relativePath; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return $relativePath; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function getIdWithoutLang(): string |
136 | 136 | { |
137 | - $langPrefix = $this->getVariable('language').'/'; |
|
137 | + $langPrefix = $this->getVariable('language') . '/'; |
|
138 | 138 | if ($this->hasVariable('language') && Util\Str::startsWith($this->getId(), $langPrefix)) { |
139 | 139 | return substr($this->getId(), \strlen($langPrefix)); |
140 | 140 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | $fileRelativePath = str_replace(DIRECTORY_SEPARATOR, '/', $this->file->getRelativePath()); |
157 | 157 | $fileExtension = $this->file->getExtension(); |
158 | - $fileName = $this->file->getBasename('.'.$fileExtension); |
|
158 | + $fileName = $this->file->getBasename('.' . $fileExtension); |
|
159 | 159 | // case of "README" -> "index" |
160 | 160 | $fileName = (string) str_ireplace('readme', 'index', $fileName); |
161 | 161 | // case of "index" = home page |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | $this->setFolder($fileRelativePath); // ie: "blog" |
169 | 169 | $this->setSlug($fileName); // ie: "post-1" |
170 | - $this->setPath($this->getFolder().'/'.$this->getSlug()); // ie: "blog/post-1" |
|
170 | + $this->setPath($this->getFolder() . '/' . $this->getSlug()); // ie: "blog/post-1" |
|
171 | 171 | /* |
172 | 172 | * Set default variables |
173 | 173 | */ |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | } |
309 | 309 | // force slug and update path |
310 | 310 | if ($this->slug && $this->slug != $slug) { |
311 | - $this->setPath($this->getFolder().'/'.$slug); |
|
311 | + $this->setPath($this->getFolder() . '/' . $slug); |
|
312 | 312 | } |
313 | 313 | $this->slug = $slug; |
314 | 314 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | if ($value != $slugify) { |
575 | 575 | throw new RuntimeException(sprintf('"%s" variable should be "%s" (not "%s") in "%s".', $name, $slugify, (string) $value, $this->getId())); |
576 | 576 | } |
577 | - $method = 'set'.ucfirst($name); |
|
577 | + $method = 'set' . ucfirst($name); |
|
578 | 578 | $this->$method($value); |
579 | 579 | break; |
580 | 580 | default: |
@@ -57,7 +57,7 @@ |
||
57 | 57 | throw new RuntimeException('Cannot read file'); |
58 | 58 | } |
59 | 59 | preg_match( |
60 | - '/'.self::PATTERN.'/s', |
|
60 | + '/' . self::PATTERN . '/s', |
|
61 | 61 | $this->file->getContents(), |
62 | 62 | $matches |
63 | 63 | ); |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | // https://regex101.com/r/GlgBdT/7 |
29 | 29 | // ie: "blog/2017-10-19_post-1.en.md" suffix is "en" |
30 | 30 | // ie: "projet/1-projet-a.fr-FR.md" suffix is "fr-FR" |
31 | - public const SUFFIX_PATTERN = '(.*)\.'.Config::LANG_CODE_PATTERN; |
|
31 | + public const SUFFIX_PATTERN = '(.*)\.' . Config::LANG_CODE_PATTERN; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Returns true if the string contains a prefix or a suffix. |
35 | 35 | */ |
36 | 36 | protected static function has(string $string, string $type): bool |
37 | 37 | { |
38 | - return (bool) preg_match('/^'.self::getPattern($type).'$/', $string); |
|
38 | + return (bool) preg_match('/^' . self::getPattern($type) . '$/', $string); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | protected static function get(string $string, string $type): ?string |
61 | 61 | { |
62 | 62 | if (self::has($string, $type)) { |
63 | - preg_match('/^'.self::getPattern($type).'$/', $string, $matches); |
|
63 | + preg_match('/^' . self::getPattern($type) . '$/', $string, $matches); |
|
64 | 64 | switch ($type) { |
65 | 65 | case 'prefix': |
66 | 66 | return $matches[2]; |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | public static function sub(string $string): string |
95 | 95 | { |
96 | 96 | if (self::hasPrefix($string)) { |
97 | - preg_match('/^'.self::getPattern('prefix').'$/', $string, $matches); |
|
97 | + preg_match('/^' . self::getPattern('prefix') . '$/', $string, $matches); |
|
98 | 98 | |
99 | - $string = $matches[1].$matches[7]; |
|
99 | + $string = $matches[1] . $matches[7]; |
|
100 | 100 | } |
101 | 101 | if (self::hasSuffix($string)) { |
102 | - preg_match('/^'.self::getPattern('suffix').'$/', $string, $matches); |
|
102 | + preg_match('/^' . self::getPattern('suffix') . '$/', $string, $matches); |
|
103 | 103 | |
104 | 104 | $string = $matches[1]; |
105 | 105 | } |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | public static function subPrefix(string $string): string |
114 | 114 | { |
115 | 115 | if (self::hasPrefix($string)) { |
116 | - preg_match('/^'.self::getPattern('prefix').'$/', $string, $matches); |
|
116 | + preg_match('/^' . self::getPattern('prefix') . '$/', $string, $matches); |
|
117 | 117 | |
118 | - return $matches[1].$matches[7]; |
|
118 | + return $matches[1] . $matches[7]; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | return $string; |
@@ -18,19 +18,19 @@ discard block |
||
18 | 18 | 'baseurl' => 'http://localhost:8000/', |
19 | 19 | 'canonicalurl' => false, // if true then `url()` function prepends URL with `baseurl` |
20 | 20 | 'description' => 'Site description', |
21 | - 'taxonomies' => [ // default taxonomies |
|
21 | + 'taxonomies' => [// default taxonomies |
|
22 | 22 | 'tags' => 'tag', // can be disabled with the special "disabled" value |
23 | 23 | 'categories' => 'category', |
24 | 24 | ], |
25 | 25 | 'pagination' => [ |
26 | - 'max' => 5, // number of pages by each paginated pages |
|
26 | + 'max' => 5, // number of pages by each paginated pages |
|
27 | 27 | 'path' => 'page', // path to paginated pages (e.g.: `/blog/page/2/`) |
28 | 28 | ], |
29 | 29 | //'date' => [ |
30 | 30 | // 'format' => 'F j, Y', // @see https://www.php.net/manual/fr/datetime.format.php#refsect1-datetime.format-parameters |
31 | 31 | // 'timezone' => 'Europe/Paris', |
32 | 32 | //], |
33 | - 'output' => [ // https://cecil.app/documentation/configuration/#formats |
|
33 | + 'output' => [// https://cecil.app/documentation/configuration/#formats |
|
34 | 34 | 'dir' => '_site', // output directory (`_site` by default) |
35 | 35 | 'formats' => [ |
36 | 36 | // e.g.: blog/post-1/index.html |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'exclude' => ['redirect', 'paginated'], |
129 | 129 | ], |
130 | 130 | ], |
131 | - 'pagetypeformats' => [ // formats applied by page type |
|
131 | + 'pagetypeformats' => [// formats applied by page type |
|
132 | 132 | 'page' => ['html'], |
133 | 133 | 'homepage' => ['html', 'atom'], |
134 | 134 | 'section' => ['html', 'atom'], |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | 'locale' => 'en_US', |
145 | 145 | ], |
146 | 146 | ], |
147 | - 'defaultpages' => [ // default generated pages |
|
147 | + 'defaultpages' => [// default generated pages |
|
148 | 148 | 'index' => [ |
149 | 149 | 'path' => '', |
150 | 150 | 'title' => 'Home', |
@@ -204,17 +204,17 @@ discard block |
||
204 | 204 | 'format' => 'yaml', // front matter format: `yaml`, `ini`, `toml` or `json` (`yaml` by default) |
205 | 205 | ], |
206 | 206 | 'body' => [ |
207 | - 'format' => 'md', // page body format (only Markdown is supported) |
|
207 | + 'format' => 'md', // page body format (only Markdown is supported) |
|
208 | 208 | 'toc' => ['h2', 'h3'], // headers used to build the table of contents |
209 | 209 | 'highlight' => [ |
210 | - 'enabled' => false, // enables code syntax highlighting (`false` by default) |
|
210 | + 'enabled' => false, // enables code syntax highlighting (`false` by default) |
|
211 | 211 | ], |
212 | 212 | 'images' => [ |
213 | 213 | 'lazy' => [ |
214 | - 'enabled' => true, // adds `loading="lazy"` attribute (`true` by default) |
|
214 | + 'enabled' => true, // adds `loading="lazy"` attribute (`true` by default) |
|
215 | 215 | ], |
216 | 216 | 'decoding' => [ |
217 | - 'enabled' => true, // adds `decoding="async"` attribute (`true` by default) |
|
217 | + 'enabled' => true, // adds `decoding="async"` attribute (`true` by default) |
|
218 | 218 | ], |
219 | 219 | 'resize' => [ |
220 | 220 | 'enabled' => false, // enables image resizing by using the `width` extra attribute (`false` by default) |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | 'responsive' => [ |
226 | 226 | 'enabled' => false, // creates responsive images and adds them to the `srcset` attribute (`false` by default) |
227 | 227 | ], |
228 | - 'class' => '', // puts default CSS class to each image (empty by default) |
|
228 | + 'class' => '', // puts default CSS class to each image (empty by default) |
|
229 | 229 | 'caption' => [ |
230 | 230 | 'enabled' => false, // puts the image in a <figure> element and adds a <figcaption> containing the title (`false` by default) |
231 | 231 | ], |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | 'enabled' => true, // turns remote images to Asset to handling them (`true` by default) |
234 | 234 | 'fallback' => [ |
235 | 235 | 'enabled' => false, // enables a fallback if image is not found (`false` by default) |
236 | - 'path' => '', // path to the fallback image, stored in assets dir (empty by default) |
|
236 | + 'path' => '', // path to the fallback image, stored in assets dir (empty by default) |
|
237 | 237 | ], |
238 | 238 | ], |
239 | 239 | ], |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | ], |
251 | 251 | 'excerpt' => [ |
252 | 252 | 'separator' => 'excerpt|break', // string to use as separator (`excerpt|break` by default) |
253 | - 'capture' => 'before', // part to capture, `before` or `after` the separator (`before` by default) |
|
253 | + 'capture' => 'before', // part to capture, `before` or `after` the separator (`before` by default) |
|
254 | 254 | ], |
255 | 255 | ], |
256 | 256 | // data files |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | ], |
321 | 321 | 'cdn' => [ |
322 | 322 | 'enabled' => false, // enables Image CDN (`false` by default) |
323 | - 'canonical' => true, // is `image_url` must be canonical or not (`true` by default) |
|
324 | - 'remote' => true, // includes remote images (`true` by default) |
|
325 | - 'svg' => true, // should support SVG format? (`true` by default) |
|
323 | + 'canonical' => true, // is `image_url` must be canonical or not (`true` by default) |
|
324 | + 'remote' => true, // includes remote images (`true` by default) |
|
325 | + 'svg' => true, // should support SVG format? (`true` by default) |
|
326 | 326 | //'account' => 'xxxx', // provider account |
327 | 327 | // Cloudinary |
328 | 328 | //'url' => 'https://res.cloudinary.com/%account%/image/fetch/c_limit,w_%width%,q_%quality%,f_%format%,d_default/%image_url%', |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | 'dir' => 'translations', // translations files cache directory (`assets` by default) |
373 | 373 | ], |
374 | 374 | ], |
375 | - 'generators' => [ // list of generators ordered by index weight |
|
375 | + 'generators' => [// list of generators ordered by index weight |
|
376 | 376 | 10 => 'Cecil\Generator\DefaultPages', |
377 | 377 | 20 => 'Cecil\Generator\VirtualPages', |
378 | 378 | 30 => 'Cecil\Generator\ExternalBody', |