Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s1syphos/kirby3-gesetze
Linking german legal norms for Kirby v3
https://github.com/s1syphos/kirby3-gesetze
Last synced: 1 day ago
JSON representation
Linking german legal norms for Kirby v3
- Host: GitHub
- URL: https://github.com/s1syphos/kirby3-gesetze
- Owner: S1SYPHOS
- License: mit
- Created: 2021-11-08T16:06:19.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-10T17:54:11.000Z (over 2 years ago)
- Last Synced: 2024-09-23T02:07:07.298Z (about 2 months ago)
- Language: PHP
- Size: 1.14 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kirby3 Gesetze
This plugin automatically links german legal norms - dependency-free & GDPR-friendly, powered by [`php-gesetze`](https://codeberg.org/S1SYPHOS/php-gesetze).
## Getting started
Use one of the following methods to install & use `kirby3-gesetze`:
### Git submodule
If you know your way around Git, you can download this plugin as a [submodule](https://github.com/blog/2104-working-with-submodules):
```text
git submodule add https://codeberg.org/S1SYPHOS/kirby3-gesetze.git site/plugins/kirby3-gesetze
```### Composer
```text
composer require s1syphos/kirby3-gesetze
```### Clone or download
1. [Clone](https://codeberg.org/S1SYPHOS/kirby3-gesetze.git) or [download](https://codeberg.org/S1SYPHOS/kirby3-gesetze/archive/main.zip) this repository.
2. Unzip / Move the folder to `site/plugins`.## Usage
Quick demonstration:
This markdown `text` content ..
```md
This is a **simple** HTML text. It contains legal norms, like Art. 12 I GG and § 433 II BGB!
```.. easily ..
```php
# .. via `kirbytext()` ..
echo $page->text()->kt()# .. or page method ..
echo $page->gesetzify($text);# .. or field method ..
echo $page->text()->gesetzify();
```.. becomes:
```html
This is a simple HTML text. It contains legal norms, like Art. 12 I GG or § 433 II BGB!
```## Configuration
You may change certain options from your `config.php` globally (`'kirby3-gesetze.optionName'`):
| Option | Type | Default | Description |
| --------------------- | ------ | ----------- | --------------------------------- |
| `'enabled'` | bool | `false` | Enables `kirbytext:after` hook |
| `'allowList'` | array | `[]` | Allowed template names |
| `'blockList'` | array | `[]` | Blocked template names |
| `'attributes'` | array | `[]` | Controls HTML attributes |
| `'validate'` | bool | `true` | Enable/disable validation |
| `'title'` | string | `'full'` | Controls `title` attribute. Possible values: `false`, `'light'`, `'normal'`, `'full'` |
| '`drivers.preferred`' | string | `'gesetze'` | Preferred driver. Possible values: `'gesetze'`, `'dejure'`, `'buzer'`, `'lexparency'` |
| '`drivers.blockList`' | array | `[]` | Unallowed driver(s). Possible values: see `drivers.preferred` |When enabling the plugin via `kirby3-gesetze.enabled`, auto-linking is applied to all `kirbytext()` / `kt()` calls, with two exceptions:
1. If a page's `intendedTemplate()` name is allow(list)ed, this overrides `kirby3-gesetze.enabled` being `false`
1. If a page's `intendedTemplate()` name is block(list)ed, this overrides `kirby3-gesetze.enabled` being `true`Besides that, there are additional methods you can use:
## Methods
There are several ways to do this, you can either use a standalone function, a page method or a field method:
### Method: `gesetzify(string $text): string`
Processes (valid) legal norms throughout given text
### Page method: `$page->gesetzify(string $text)`
Same as `gesetzify`
### Field method: `$field->gesetzify(string $text, bool $inline = false)`
Same as `gesetzify`, but supports applying `kt()` / `kti()` via `$inline` option.
## Roadmap
- [ ] Add tests
## Credits / License
`kirby3-gesetze` is based on [`php-gesetze`](https://codeberg.org/S1SYPHOS/php-gesetze) library. It is licensed under the [MIT License](LICENSE), but **using Kirby in production** requires you to [buy a license](https://getkirby.com/buy).
## Special Thanks
I'd like to thank everybody that's making great software - you people are awesome. Also I'm always thankful for feedback and bug reports :)