Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several updates and some fixes #6

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, dom, curl

- name: Validate composer.json and composer.lock
run: composer validate
- uses: actions/checkout@v3

- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Validate composer.json and composer.lock
run: composer validate

- name: Run test suite
run: composer test
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run php-cs-fixer
run: composer csfix
- name: Check code style
run: composer test:lint

- name: Run test suite
run: composer test:unit
4 changes: 2 additions & 2 deletions app/Command/Example/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DefaultController extends CommandController
{
public function handle(): void
{
$this->getPrinter()->info("This is the example command.");
$this->getPrinter()->info("You can use it as a sandbox or base to build your own custom CLI commands.");
$this->getPrinter()->info('This is the example command.');
$this->getPrinter()->info('You can use it as a sandbox or base to build your own custom CLI commands.');
}
}
14 changes: 7 additions & 7 deletions app/LiquidTag/Embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public function getContentType(): string

public function parse($tag_value, array $params = []): ?string
{
$path = __DIR__ . '/../../content/'. $this->getContentType() . '/' . $tag_value . '.md';
$content = new Content();
$path = __DIR__.'/../../content/'.$this->getContentType().'/'.$tag_value.'.md';
$content = new Content;
try {
$content->load($path);
$parser = new ContentParser();
$parser = new ContentParser;
$article = $parser->parse($content);

return $this->getEmbed($article);
Expand All @@ -33,13 +33,13 @@ public function getEmbed(Content $content): string
{
return '<div class="grid grid-cols-4 gap-4 border">
<div class="p-4">
<a href="/'. $this->getContentType() .'/'. $content->getSlug() .'" title="Check the overview of '. $content->getAlternateTitle() .'">' .
'<img src="'. $content->frontMatterGet('cover_image') .'" class="w-1/3 rounded object-left" alt="Thumbnail">
<a href="/'.$this->getContentType().'/'.$content->getSlug().'" title="Check the overview of '.$content->getAlternateTitle().'">'.
'<img src="'.$content->frontMatterGet('cover_image').'" class="w-1/3 rounded object-left" alt="Thumbnail">
</a>
</div>
<div class="col-span-2">
<h4><a href="/' . $this->getContentType() . '/'. $content->getSlug() .'" title="Check the overview of '. $content->frontMatterGet('title') .'">' . $content->frontMatterGet('title') . '</a></h4>
<p class="text-sm">'. $content->frontMatterGet('description') .'</p>
<h4><a href="/'.$this->getContentType().'/'.$content->getSlug().'" title="Check the overview of '.$content->frontMatterGet('title').'">'.$content->frontMatterGet('title').'</a></h4>
<p class="text-sm">'.$content->frontMatterGet('description').'</p>
</div>
</div>';
}
Expand Down
5 changes: 0 additions & 5 deletions app/LiquidTag/Guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

namespace App\LiquidTag;

use Librarian\Content;
use Librarian\Exception\ContentNotFoundException;
use Parsed\ContentParser;
use Parsed\CustomTagParserInterface;

class Guide extends Embed
{
public function getContentType(): string
Expand Down
2 changes: 1 addition & 1 deletion app/LiquidTag/YouTube.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function parse($tag_value, array $params = [])
public function getEmbed($video_id)
{
return '<div class="aspect-w-16 aspect-h-9">
<iframe src="https://www.youtube.com/embed/'. $video_id . '" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe src="https://www.youtube.com/embed/'.$video_id.'" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>';
}
}
2 changes: 1 addition & 1 deletion app/Resources/themes/custom/_partials/sidebar.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="column blog-sidebar">
<div class="px-4 py-6 mb-6 bg-gray-50 mt-6 rounded-md shadow-lg">
<div class="text-center mx-auto">
<a href="{{ site_url() }}"><img class="mx-auto rounded-full" src="https://cdn.eheidi.dev/onlinux_logo.png"></a>
<a href="{{ site_url() }}"><img class="mx-auto rounded-full" src="https://onlinux.ams3.digitaloceanspaces.com/onlinux_logo.png"></a>
</div>

<p class="text-justify px-4 py-2">{{ site_about() }}</p>
Expand Down
2 changes: 1 addition & 1 deletion app/Stencil.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct($stencil_dir)

public function applyTemplate($template_name, array $variables = []): string
{
$template = file_get_contents($this->stencil_dir . '/' . $template_name . '.tpl');
$template = file_get_contents($this->stencil_dir.'/'.$template_name.'.tpl');

foreach ($variables as $variable_name => $variable_value) {
$template = str_replace("{{ $variable_name }}", $variable_value, $template);
Expand Down
12 changes: 1 addition & 11 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function config_default(string $config_dir): array
{
$config = [];

foreach (glob($config_dir . '/*.php') as $config_file) {
foreach (glob($config_dir.'/*.php') as $config_file) {
$config_data = include $config_file;
if (is_array($config_data)) {
$config = array_merge($config, $config_data);
Expand All @@ -15,13 +15,3 @@ function config_default(string $config_dir): array

return $config;
}

function load_config(): array
{
return array_merge(config_default(__DIR__ . '/../config'), include __DIR__ . '/../config.php');
}

function envconfig(string $key, string $defaultValue = null): string|null
{
return getenv($key) ? getenv($key) : $defaultValue;
}
31 changes: 18 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,34 @@
]
},
"require": {
"php": ">=8.1",
"php": ">=8.3",
"ext-json": "*",
"ext-curl": "*",
"ext-xml": "*",
"librarianphp/librarian-core": "^4.0",
"librarianphp/librarian-core": "^4.4",
"suin/php-rss-writer": "^1.6",
"librarianphp/command-help": "^1.0",
"librarianphp/command-create": "^1.0",
"librarianphp/command-cache": "^1.0",
"librarianphp/command-web": "^1.0",
"librarianphp/command-build": "^1.0"
"librarianphp/command-help": "^1.1",
"librarianphp/command-create": "^1.1",
"librarianphp/command-cache": "^1.1",
"librarianphp/command-web": "^1.2",
"librarianphp/command-build": "^1.2"
},
"scripts": {
"post-install-cmd": [
"@php -r \"file_exists('config.php') || copy('config_sample.php', 'config.php');\""
"@php -r \"file_exists('config/librarian.php') || copy('config_sample.php', 'config/librarian.php');\""
],
"test" : ["pest"],
"csfix": ["php-cs-fixer fix"]
"lint": ["pint"],
"test:unit" : ["pest"],
"test:lint": ["pint --test"],
"test" : [
"@test:lint",
"@test:unit"
]
},
"require-dev": {
"pestphp/pest": "^2.0",
"minicli/pest-plugin-curly": "^0.2.1",
"friendsofphp/php-cs-fixer": "^3.16"
"pestphp/pest": "^2.8",
"minicli/pest-plugin-curly": "^0.2",
"laravel/pint": "^1.10"
},
"config": {
"allow-plugins": {
Expand Down
Loading
Loading