feat: add FEN block support and related assets
Introduced a new FEN block feature, including a PHP snippet to render FEN diagrams, a new CSS file for chessboard styling, font integration, and blueprint updates. Adjusted asset paths and file references for consistency.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
// FEN in Array umwandeln
|
||||
function fenToBoard($fen) {
|
||||
$rows = explode('/', explode(' ', $fen)[0]);
|
||||
$board = [];
|
||||
foreach ($rows as $row) {
|
||||
$boardRow = [];
|
||||
$chars = str_split($row);
|
||||
foreach ($chars as $char) {
|
||||
if (is_numeric($char)) {
|
||||
for ($i = 0; $i < intval($char); $i++) {
|
||||
$boardRow[] = '';
|
||||
}
|
||||
} else {
|
||||
$boardRow[] = $char;
|
||||
}
|
||||
}
|
||||
$board[] = $boardRow;
|
||||
}
|
||||
|
||||
return $board;
|
||||
} ?>
|
||||
|
||||
|
||||
<?php
|
||||
snippet('layout', slots: true) ?>
|
||||
|
||||
<?= $page->blocks()->toBlocks() ?>
|
||||
|
||||
<?php
|
||||
endsnippet() ?>
|
||||
Reference in New Issue
Block a user