@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function filterBy(PagesCollection $pages, string $variable, string $value): CollectionInterface |
215 | 215 | { |
216 | - $filteredPages = $pages->filter(function (Page $page) use ($variable, $value) { |
|
216 | + $filteredPages = $pages->filter(function(Page $page) use ($variable, $value) { |
|
217 | 217 | // is a dedicated getter exists? |
218 | 218 | $method = 'get'.ucfirst($variable); |
219 | 219 | if (method_exists($page, $method) && $page->$method() == $value) { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function sortByWeight(\Traversable $collection, bool $reverse = false): array |
249 | 249 | { |
250 | - $callback = function ($a, $b) use ($reverse) { |
|
250 | + $callback = function($a, $b) use ($reverse) { |
|
251 | 251 | if (!isset($a['weight'])) { |
252 | 252 | $a['weight'] = 0; |
253 | 253 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function sortByDate(\Traversable $collection, string $variable = 'date', bool $reverse = false, bool $descTitle = false): array |
275 | 275 | { |
276 | - $callback = function ($a, $b) use ($variable, $reverse, $descTitle) { |
|
276 | + $callback = function($a, $b) use ($variable, $reverse, $descTitle) { |
|
277 | 277 | if ($a[$variable] == $b[$variable]) { |
278 | 278 | // if dates are equal and "descTitle" is true |
279 | 279 | if ($descTitle && (isset($a['title']) && isset($b['title']))) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $this->builder = $builder; |
66 | 66 | $this->config = $builder->getConfig(); |
67 | 67 | $paths = is_array($paths) ? $paths : [$paths]; |
68 | - array_walk($paths, function ($path) { |
|
68 | + array_walk($paths, function($path) { |
|
69 | 69 | if (empty($path)) { |
70 | 70 | throw new RuntimeException('The path to an asset can\'t be empty.'); |
71 | 71 | } |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | } |
75 | 75 | }); |
76 | 76 | $this->data = [ |
77 | - 'file' => '', // absolute file path |
|
78 | - 'files' => [], // bundle: files path |
|
79 | - 'filename' => '', // filename |
|
80 | - 'path_source' => '', // public path to the file, before transformations |
|
81 | - 'path' => '', // public path to the file, after transformations |
|
77 | + 'file' => '', // absolute file path |
|
78 | + 'files' => [], // bundle: files path |
|
79 | + 'filename' => '', // filename |
|
80 | + 'path_source' => '', // public path to the file, before transformations |
|
81 | + 'path' => '', // public path to the file, after transformations |
|
82 | 82 | 'missing' => false, // if file not found, but missing ollowed 'missing' is true |
83 | - 'ext' => '', // file extension |
|
84 | - 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
85 | - 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
86 | - 'size' => 0, // file size (in bytes) |
|
87 | - 'content_source' => '', // file content, before transformations |
|
88 | - 'content' => '', // file content, after transformations |
|
89 | - 'width' => 0, // width (in pixels) in case of an image |
|
90 | - 'height' => 0, // height (in pixels) in case of an image |
|
83 | + 'ext' => '', // file extension |
|
84 | + 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
85 | + 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
86 | + 'size' => 0, // file size (in bytes) |
|
87 | + 'content_source' => '', // file content, before transformations |
|
88 | + 'content' => '', // file content, after transformations |
|
89 | + 'width' => 0, // width (in pixels) in case of an image |
|
90 | + 'height' => 0, // height (in pixels) in case of an image |
|
91 | 91 | ]; |
92 | 92 | |
93 | 93 | // handles options |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | |
430 | 430 | try { |
431 | 431 | $img = ImageManager::make($assetResized->data['content_source']); |
432 | - $img->resize($width, null, function (\Intervention\Image\Constraint $constraint) { |
|
432 | + $img->resize($width, null, function(\Intervention\Image\Constraint $constraint) { |
|
433 | 433 | $constraint->aspectRatio(); |
434 | 434 | $constraint->upsize(); |
435 | 435 | }); |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | 'title' => 'Site title', |
17 | 17 | //'baseline' => 'Site baseline', |
18 | 18 | 'baseurl' => 'http://localhost:8000/', |
19 | - 'canonicalurl' => false, // if true 'url()' function preprends URL wirh 'baseurl' |
|
19 | + 'canonicalurl' => false, // if true 'url()' function preprends URL wirh 'baseurl' |
|
20 | 20 | 'description' => 'Site description', |
21 | - 'taxonomies' => [ // default taxonomies |
|
21 | + 'taxonomies' => [// default taxonomies |
|
22 | 22 | 'tags' => 'tag', // can be disabled with 'disabled' value |
23 | 23 | 'categories' => 'category', |
24 | 24 | ], |
25 | 25 | 'pagination' => [ |
26 | - 'max' => 5, // number of pages on each paginated pages |
|
26 | + 'max' => 5, // number of pages on each paginated pages |
|
27 | 27 | 'path' => 'page', // path to paginated pages. ie: '/blog/page/2/' |
28 | 28 | ], |
29 | 29 | 'date' => [ |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | 'format' => 'yaml', // front matter format `yaml`, `ini`, `toml` or `json` (`yaml` by default) |
182 | 182 | ], |
183 | 183 | 'body' => [ |
184 | - 'format' => 'md', // page body format (only Markdown is supported) |
|
184 | + 'format' => 'md', // page body format (only Markdown is supported) |
|
185 | 185 | 'toc' => ['h2', 'h3'], // headers used to build the table of contents |
186 | 186 | 'highlight' => [ |
187 | - 'enabled' => false, // enables code syntax highlighting (`false` by default) |
|
187 | + 'enabled' => false, // enables code syntax highlighting (`false` by default) |
|
188 | 188 | ], |
189 | 189 | 'images' => [ |
190 | 190 | 'lazy' => [ |
191 | - 'enabled' => true, // adds `loading="lazy"` attribute (`true` by default) |
|
191 | + 'enabled' => true, // adds `loading="lazy"` attribute (`true` by default) |
|
192 | 192 | ], |
193 | 193 | 'resize' => [ |
194 | 194 | 'enabled' => false, // enables image resizing by using the `width` extra attribute (`false` by default) |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | 'enabled' => false, // puts the image in a <figure> element and adds a <figcaption> containing the title (`false` by default) |
204 | 204 | ], |
205 | 205 | 'remote' => [ |
206 | - 'enabled' => true, // turns remote images to Asset to handling them (`true` by default) |
|
206 | + 'enabled' => true, // turns remote images to Asset to handling them (`true` by default) |
|
207 | 207 | 'fallback' => [ |
208 | 208 | 'enabled' => false, // enables a fallback if image is not found (`false` by default) |
209 | - 'path' => '', // path to the fallback image, stored in assets dir (`` by default) |
|
209 | + 'path' => '', // path to the fallback image, stored in assets dir (`` by default) |
|
210 | 210 | ], |
211 | 211 | ], |
212 | 212 | 'class' => '', // put default class to each image (`` by default) |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | ], |
219 | 219 | 'excerpt' => [ |
220 | 220 | 'separator' => 'excerpt|break', // string to use as separator (`excerpt|break` by default) |
221 | - 'capture' => 'before', // part to capture, `before` or `after` the separator (`before` by default) |
|
221 | + 'capture' => 'before', // part to capture, `before` or `after` the separator (`before` by default) |
|
222 | 222 | ], |
223 | 223 | ], |
224 | 224 | // data files |
@@ -254,17 +254,17 @@ discard block |
||
254 | 254 | ], |
255 | 255 | 'assets' => [ |
256 | 256 | 'dir' => 'assets', |
257 | - 'compile' => [ // Compile Saas |
|
257 | + 'compile' => [// Compile Saas |
|
258 | 258 | 'enabled' => true, |
259 | 259 | 'style' => 'expanded', // 'expanded' or 'compressed', |
260 | 260 | 'import' => ['sass', 'scss', 'node_modules'], |
261 | 261 | 'sourcemap' => false, // works in debug mode only |
262 | 262 | //'variables' => ['var' => 'value'] |
263 | 263 | ], |
264 | - 'minify' => [ // Minify CSS and JS |
|
264 | + 'minify' => [// Minify CSS and JS |
|
265 | 265 | 'enabled' => true, |
266 | 266 | ], |
267 | - 'fingerprint' => [ // Add fingerprint |
|
267 | + 'fingerprint' => [// Add fingerprint |
|
268 | 268 | 'enabled' => true, |
269 | 269 | ], |
270 | 270 | 'target' => 'assets', // target directory of remote and resized assets |
@@ -42,7 +42,7 @@ |
||
42 | 42 | /** @var \Cecil\Collection\Page\Page $page */ |
43 | 43 | $page->setType(Type::HOMEPAGE); |
44 | 44 | // collects all pages |
45 | - $subPages = $this->builder->getPages()->filter(function (Page $page) use ($language) { |
|
45 | + $subPages = $this->builder->getPages()->filter(function(Page $page) use ($language) { |
|
46 | 46 | return $page->getType() == TYPE::PAGE |
47 | 47 | && $page->isVirtual() === false |
48 | 48 | && $page->getVariable('exclude') !== true |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | /** @var Collection $pages */ |
67 | 67 | $pages = $this->builder->getPages() |
68 | 68 | // published only |
69 | - ->filter(function (Page $page) { |
|
69 | + ->filter(function(Page $page) { |
|
70 | 70 | return (bool) $page->getVariable('published'); |
71 | 71 | }) |
72 | 72 | // enrichs some variables |
73 | - ->map(function (Page $page) { |
|
73 | + ->map(function(Page $page) { |
|
74 | 74 | $formats = $this->getOutputFormats($page); |
75 | 75 | // output formats |
76 | 76 | $page->setVariable('output', $formats); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | // renders with Twig |
126 | 126 | try { |
127 | 127 | $deprecations = []; |
128 | - set_error_handler(function ($type, $msg) use (&$deprecations) { |
|
128 | + set_error_handler(function($type, $msg) use (&$deprecations) { |
|
129 | 129 | if (E_USER_DEPRECATED === $type) { |
130 | 130 | $deprecations[] = $msg; |
131 | 131 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | protected function getTranslations(Page $refPage): \Cecil\Collection\Page\Collection |
275 | 275 | { |
276 | 276 | /** @var Page $page */ |
277 | - $pages = $this->builder->getPages()->filter(function (Page $page) use ($refPage) { |
|
277 | + $pages = $this->builder->getPages()->filter(function(Page $page) use ($refPage) { |
|
278 | 278 | return $page->getId() !== $refPage->getId() |
279 | 279 | && $page->getVariable('langref') == $refPage->getVariable('langref') |
280 | 280 | && $page->getType() == $refPage->getType() |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | // add generator meta tag |
296 | 296 | if (!preg_match('/<meta name="generator".*/i', $output)) { |
297 | 297 | $meta = \sprintf('<meta name="generator" content="Cecil %s" />', Builder::getVersion()); |
298 | - $output = preg_replace_callback('/([[:blank:]]*)(<\/head>)/i', function ($matches) use ($meta) { |
|
298 | + $output = preg_replace_callback('/([[:blank:]]*)(<\/head>)/i', function($matches) use ($meta) { |
|
299 | 299 | return str_repeat($matches[1] ?: ' ', 2).$meta."\n".$matches[1].$matches[2]; |
300 | 300 | }, $output); |
301 | 301 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | //'/href="([A-Za-z0-9_\.\-\/]+)\.md(\#[A-Za-z0-9\-]+)?"/is', |
314 | 314 | // https://regex101.com/r/ycWMe4/1 |
315 | 315 | '/href="(\/|)([A-Za-z0-9_\.\-\/]+)\.md(\#[A-Za-z0-9\-]+)?"/is', |
316 | - function ($matches) use ($page) { |
|
316 | + function($matches) use ($page) { |
|
317 | 317 | // section spage |
318 | 318 | $hrefPattern = 'href="../%s/%s"'; |
319 | 319 | // root page |
@@ -96,7 +96,7 @@ |
||
96 | 96 | protected function collectTermsFromPages(): void |
97 | 97 | { |
98 | 98 | /** @var \Cecil\Collection\Page\Collection $pages */ |
99 | - $pages = $this->builder->getPages()->filter(function (Page $page) { |
|
99 | + $pages = $this->builder->getPages()->filter(function(Page $page) { |
|
100 | 100 | return $page->getVariable('published'); |
101 | 101 | })->sortByDate(); |
102 | 102 | foreach ($pages as $page) { |
@@ -57,7 +57,7 @@ |
||
57 | 57 | public function process(): void |
58 | 58 | { |
59 | 59 | /** @var Page $page */ |
60 | - $filteredPages = $this->builder->getPages()->filter(function (Page $page) { |
|
60 | + $filteredPages = $this->builder->getPages()->filter(function(Page $page) { |
|
61 | 61 | return !empty($page->getRendered()); |
62 | 62 | }); |
63 | 63 | $total = count($filteredPages); |