diff --git a/pages/01.blog/our-android-section-tutorial-guide-is-ready/item.de.md b/pages/01.blog/our-android-section-tutorial-guide-is-ready/item.de.md
new file mode 100644
index 0000000..e0e0081
--- /dev/null
+++ b/pages/01.blog/our-android-section-tutorial-guide-is-ready/item.de.md
@@ -0,0 +1,36 @@
+---
+title: 'Unser Tutorial/Leitfaden für den Android-Bereich ist fertig 🍻'
+published: true
+date: '09-03-2022 08:14'
+taxonomy:
+ category:
+ - news
+ tag:
+ - tutorials
+ - privacy
+ - android
+ - magisk
+ - fdroid
+ - afwall
+ - xprivacylua
+ - lsposed
+ - microg
+ - shelter
+ - aurora
+ - lineage
+ - phone
+ - backup
+ - seedvault
+aura:
+ author: dodi
+---
+
+Bist du daran interessiert, dein altes Android-Telefon über ein Custom ROM zu aktualisieren? Verwendest du ein Android-Gerät für deine digitale Privatsphäre?
+
+Wir haben jetzt auch unser Tutorial/Leitfaden (deutsch) für unseren Android-Bereich fertiggestellt.
+F-Droid, Magisk, AFWall, LSPosed, microG ... sie alle sind Teil davon.
+
+Wirf einen Blick darauf:
+https://wiki.techsaviours.org/de/phone/operating_systems/android
+
+Wir haben ein paar Backup-Lösungen für unsere Android-Handys hinzugefügt - https://wiki.techsaviours.org/de/backup/phone.
\ No newline at end of file
diff --git a/plugins/page-toc/CHANGELOG.md b/plugins/page-toc/CHANGELOG.md
index e3e50ff..8043746 100644
--- a/plugins/page-toc/CHANGELOG.md
+++ b/plugins/page-toc/CHANGELOG.md
@@ -1,3 +1,10 @@
+# v3.2.0
+## 02/23/2022
+
+1. [](#new)
+ * Support for HTML or Shortcode based headers with custom `id` attributes to specify an anchor
+ * Added German translation
+
# v3.1.3
## 01/03/2022
diff --git a/plugins/page-toc/blueprints.yaml b/plugins/page-toc/blueprints.yaml
index 83323d5..38ae211 100644
--- a/plugins/page-toc/blueprints.yaml
+++ b/plugins/page-toc/blueprints.yaml
@@ -1,7 +1,7 @@
name: Page Toc
type: plugin
slug: page-toc
-version: 3.1.3
+version: 3.2.0
description: Generate a table of contents and anchors from a page
icon: list
author:
diff --git a/plugins/page-toc/classes/MarkupFixer.php b/plugins/page-toc/classes/MarkupFixer.php
index 3632f8d..ceef666 100644
--- a/plugins/page-toc/classes/MarkupFixer.php
+++ b/plugins/page-toc/classes/MarkupFixer.php
@@ -49,9 +49,10 @@ class MarkupFixer
/** @var DOMElement $node */
foreach ($this->traverseHeaderTags($domDocument, $start, $depth) as $node) {
if ($node->getAttribute('id')) {
- continue;
+ $slug = $node->getAttribute('id');
+ } else {
+ $slug = $slugger->slugify($node->getAttribute('title') ?: $node->textContent, $options);
}
- $slug = $slugger->slugify($node->getAttribute('title') ?: $node->textContent, $options);
$node->setAttribute('id', $slug);
diff --git a/plugins/page-toc/classes/shortcodes/AnchorShortcode.php b/plugins/page-toc/classes/shortcodes/AnchorShortcode.php
index 7c0433c..4702951 100644
--- a/plugins/page-toc/classes/shortcodes/AnchorShortcode.php
+++ b/plugins/page-toc/classes/shortcodes/AnchorShortcode.php
@@ -10,10 +10,12 @@ class AnchorShortcode extends Shortcode
{
public function init()
{
- $this->shortcode->getHandlers()->add('anchor', function(ProcessedShortcode $sc) {
- $id = $sc->getParameter('id', $sc->getBbCode());
- $prefix = $sc->getParameter('prefix', PageTOCPlugin::configVar('anchors.slug_prefix'));
- $class = $sc->getParameter('class', 'inline-anchor');
+ $this->shortcode->getRawHandlers()->add('anchor', function(ProcessedShortcode $sc) {
+
+ $id = $this->cleanParam($sc->getParameter('id', $sc->getBbCode()));
+ $tag = $this->cleanParam($sc->getParameter('tag'));
+ $prefix = $this->cleanParam($sc->getParameter('prefix', PageTOCPlugin::configVar('anchors.slug_prefix')));
+ $class = $this->cleanParam($sc->getParameter('class', 'inline-anchor'));
$aria = PageTOCPlugin::configVar('anchors.aria');
$content = $sc->getContent();
@@ -27,8 +29,23 @@ class AnchorShortcode extends Shortcode
$id = $prefix . $id;
}
- return "$content";
+ if ($tag) {
+ $output = "<$tag id=\"$id\" class=\"$class\">$content$tag>";
+ } else {
+ $output = "$content";
+ }
+
+ return $output;
});
- $this->shortcode->getHandlers()->addAlias('#', 'anchor');
+ $this->shortcode->getRawHandlers()->addAlias('#', 'anchor');
+ }
+
+ /**
+ * @param $param
+ * @return string
+ */
+ protected function cleanParam($param)
+ {
+ return trim(html_entity_decode($param), '"');
}
}
\ No newline at end of file
diff --git a/plugins/page-toc/languages.yaml b/plugins/page-toc/languages.yaml
index 800609d..0ec73f8 100644
--- a/plugins/page-toc/languages.yaml
+++ b/plugins/page-toc/languages.yaml
@@ -1,3 +1,6 @@
+de:
+ PLUGIN_PAGE_TOC:
+ TABLE_OF_CONTENTS: Inhaltsverzeichnis
en:
PLUGIN_PAGE_TOC:
TABLE_OF_CONTENTS: Table of Contents
diff --git a/plugins/page-toc/page-toc.php b/plugins/page-toc/page-toc.php
index ad983d8..f694fc8 100644
--- a/plugins/page-toc/page-toc.php
+++ b/plugins/page-toc/page-toc.php
@@ -72,7 +72,7 @@ class PageTOCPlugin extends Plugin
'onTwigInitialized' => ['onTwigInitialized', 0],
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0],
- 'onPageContentProcessed' => ['onPageContentProcessed', 0],
+ 'onPageContentProcessed' => ['onPageContentProcessed', -20],
]);
}
@@ -86,7 +86,7 @@ class PageTOCPlugin extends Plugin
/** @var PageInterface $page */
$page = $event['page'];
- $content = $page->getRawContent();
+ $content = $page->content();
$shortcode_exists = preg_match($this->toc_regex, $content);
$active = $this->configVar('active', $page, false);