Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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 :)