From 6121992ad7a49f852e470ba56493ccd541a57540 Mon Sep 17 00:00:00 2001 From: RealStickman Date: Fri, 27 May 2022 15:44:01 +0200 Subject: [PATCH] (Grav GitSync) Automatic Commit from RealStickman --- plugins/anchors/.idea/vcs.xml | 6 + plugins/anchors/CHANGELOG.md | 65 ++++++++ plugins/anchors/LICENSE | 21 +++ plugins/anchors/README.md | 106 +++++++++++++ plugins/anchors/anchors.php | 109 ++++++++++++++ plugins/anchors/anchors.yaml | 9 ++ plugins/anchors/blueprints.yaml | 107 +++++++++++++ plugins/anchors/hebe.json | 15 ++ plugins/anchors/js/anchor.min.js | 9 ++ plugins/anchors/js/clipboard.min.js | 7 + plugins/anchors/twig/AnchorsTwigExtension.php | 142 ++++++++++++++++++ 11 files changed, 596 insertions(+) create mode 100644 plugins/anchors/.idea/vcs.xml create mode 100644 plugins/anchors/CHANGELOG.md create mode 100644 plugins/anchors/LICENSE create mode 100644 plugins/anchors/README.md create mode 100644 plugins/anchors/anchors.php create mode 100644 plugins/anchors/anchors.yaml create mode 100644 plugins/anchors/blueprints.yaml create mode 100644 plugins/anchors/hebe.json create mode 100644 plugins/anchors/js/anchor.min.js create mode 100644 plugins/anchors/js/clipboard.min.js create mode 100644 plugins/anchors/twig/AnchorsTwigExtension.php diff --git a/plugins/anchors/.idea/vcs.xml b/plugins/anchors/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/plugins/anchors/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/plugins/anchors/CHANGELOG.md b/plugins/anchors/CHANGELOG.md new file mode 100644 index 0000000..d5ada54 --- /dev/null +++ b/plugins/anchors/CHANGELOG.md @@ -0,0 +1,65 @@ +# v1.6.0 +## 11/24/2021 + +1. [](#new) + * Added new option `copy_to_clipboard` to automatically copy the link to clipboard +2. [](#improved) + * Removed reliance on `JQuery` for DOM ready check + * Updated `anchors.js` to version 4.3.1 + +# v1.5.4 +## 12/02/2020 + +1. [](#improved) + * Updated `anchors.js` to version 4.3.0 + * Requires Grav 1.6 + +# v1.5.3 +## 03/30/2019 + +1. [](#improved) + * Updated `anchors.js` to version 4.2.0 + * Improved documentation + +# v1.5.2 +## 09/28/2017 + +1. [](#improved) + * Updated `anchors.js` to version 4.1.0 + +# v1.5.1 +## 07/14/2016 + +1. [](#improved) + * Translate some blueprint options + +# v1.5.0 +## 01/06/2016 + +1. [](#improved) + * Disable anchors in Admin + +# v1.4.0 +## 08/25/2015 + +1. [](#improved) + * Added blueprints for Grav Admin plugin + +# v1.3.0 +## 07/20/2015 + +1. [](#new) + * Updated `anchors.js` to version 1.2.1 + * Added new options such as 'placement', 'visible', 'icon' and 'class' + +# v1.2.0 +## 03/01/2015 + +1. [](#new) + * Updated `anchors.js` to version 0.3.0 + +# v1.1.0 +## 11/30/2014 + +1. [](#new) + * ChangeLog started... diff --git a/plugins/anchors/LICENSE b/plugins/anchors/LICENSE new file mode 100644 index 0000000..484793a --- /dev/null +++ b/plugins/anchors/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Grav + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/plugins/anchors/README.md b/plugins/anchors/README.md new file mode 100644 index 0000000..cb615da --- /dev/null +++ b/plugins/anchors/README.md @@ -0,0 +1,106 @@ +# Grav Anchors Plugin + + +`anchors` is a [Grav](http://github.com/getgrav/grav) plugin that provides automatic header anchors via the [anchorjs](http://bryanbraun.github.io/anchorjs) Vanilla JS plugin. + +# Installation + +## GPM Installation (Preferred) + +The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm). From the root of your Grav install type: + + bin/gpm install anchors + +## Manual Installation + +If for some reason you can't use GPM you can manually install this plugin. Download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `anchors`. + +You should now have all the plugin files under + + /your/site/grav/user/plugins/anchors + +# Usage + +To best understand how Anchors works, you should read through the original [project documentation](https://github.com/bryanbraun/anchorjs). + +## Show Menu of Anchors + +If you want to use the generated links to also generate a menu from these anchors, just put the function below in the template file Twig: + +``` +{{ anchors(content, tag, terms) }} +``` + +The function accepts 3 parameters: + +* **content:** this parameter is the content of the page in which the function will search for all content and separate only the tags and their contents defined by the second parameter. E.g. `page.content` +* **tag:** this parameter will be the string of the tag used to make the menu. E.g. `h2` +* **terms:** this parameter is to exclude terms that you do not wish to include in the menu formation that is between the tag passed in the second parameter. The value passed is a string separated by comma to identify each term. Ex: `title 01, title 02` + +For example: + +``` +{{ anchors(page.content, 'h2') }} +``` + +When rendered the function will return a formed HTML with `