s1syphos/kirby3-gesetze

Linking german legal norms for Kirby v3, dependency-free & GDPR-friendly

Installs: 18

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:kirby-plugin

1.0.0 2021-12-17 11:07 UTC

This package is auto-updated.

Last update: 2024-11-10 23:13:55 UTC


README

This plugin automatically links german legal norms - dependency-free & GDPR-friendly, powered by 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:

git submodule add https://codeberg.org/S1SYPHOS/kirby3-gesetze.git site/plugins/kirby3-gesetze

Composer

composer require s1syphos/kirby3-gesetze

Clone or download

  1. Clone or download this repository.
  2. Unzip / Move the folder to site/plugins.

Usage

Quick demonstration:

This markdown text content ..

This is a **simple** HTML text. It contains legal norms, like Art. 12 I GG and § 433 II BGB!

.. easily ..

# .. via `kirbytext()` ..
echo $page->text()->kt()

# .. or page method ..
echo $page->gesetzify($text);

# .. or field method ..
echo $page->text()->gesetzify();

.. becomes:

<p>
  This is a <strong>simple</strong> HTML text. It contains legal norms, like <a href="https://www.gesetze-im-internet.de/gg/art_12.html" target="_blank">Art. 12 I GG</a> or <a href="https://www.gesetze-im-internet.de/bgb/__433.html" target="_blank">§ 433 II BGB</a>!
</p>

Configuration

You may change certain options from your config.php globally ('kirby3-gesetze.optionName'):

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
  2. 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 library. It is licensed under the MIT License, but using Kirby in production requires you to buy a license.

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