diff --git a/README.md b/README.md index f672a3a..50d9fa9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Semantic Markup Kirbytags -A collection of kirbytags providing advanced options for semantic markup within textareas. Includes tags for: `abbr`, `cite`, `dfn`, `ins`, `mark`, `q`, `s`, `samp`, `sub`, `sup`. Each new tag includes a complementary textareaToolbar button. +A collection of kirbytags providing advanced options for semantic markup within textareas. Includes tags for: `abbr`, `cite`, `dfn`, `ins`, `mark`, `q`, `s`, `samp`, `sub`, `sup` along with a special shortcut for handling `small caps`. Each new tag includes a complementary textareaToolbar button. ## Installation @@ -25,6 +25,7 @@ To utilize the buttons in textarea field, you need to add them explicitly to [yo label: Content type: textarea buttons: + - smallcaps - abbr - cite - dfn @@ -75,6 +76,9 @@ All tags provide an convenience `class` attribute and the `abbr` and `dfn` tags `(samp: Keyboard not found. Press F1 to continue. class: markup__samp)` +### [smallcaps] +`(smallcaps: porsche class: markup__sc title: Proof of Rich Spoiled Children Having Everything)` + ### [sub](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub) `C(sub: 8)H(sub: 10)N(sub: 4)O(sub: 2), also known as caffeine.` diff --git a/composer.json b/composer.json index b36f80c..56d0b15 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "scottboms/kirby-markup", "description": "Kirby Semantic Markup Plugin", "type": "kirby-plugin", - "version": "1.0.0", + "version": "1.0.1", "homepage": "https://github.com/scottboms/kirby-markup", "license": "MIT", "authors": [ diff --git a/index.js b/index.js index 190a334..a6abb72 100644 --- a/index.js +++ b/index.js @@ -8,6 +8,7 @@ panel.plugin("scottboms/kirby-markup", { 'q': '', 'samp': '', 's': '', + 'smallcaps': '', 'sub': '', 'sup': '' }, @@ -68,6 +69,13 @@ panel.plugin("scottboms/kirby-markup", { this.command('toggle', '(s: ', ')'); } }, + smallcaps: { + label: 'Small Caps', + icon: 'smallcaps', + click: function() { + this.command('toggle', '(smallcaps: ', ')'); + } + }, sub: { label: 'Subscript', icon: 'sub', diff --git a/index.php b/index.php index 0a18737..322fe1d 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ /** * Kirby Semantic Markup Plugin * - * @version 1.0.0 + * @version 1.0.1 * @author Scott Boms * @copyright Scott Boms * @link https://github.com/scottboms/kirby-markup @@ -30,9 +30,9 @@ $html .= '' . $abbr . ''; } elseif($title !== '' && $class == '') { // title provided but no class - $html .= '' . $abbr . ''; + $html .= '' . $abbr . ''; } else { - $html .= '' . $abbr . ''; + $html .= '' . $abbr . ''; } return $html; }, @@ -75,9 +75,9 @@ $html .= '' . $dfn . ''; } elseif($title !== '' && $class == '') { // title provided but no class - $html .= '' . $dfn . ''; + $html .= '' . $dfn . ''; } else { - $html .= '' . $dfn . ''; + $html .= '' . $dfn . ''; } return $html; } @@ -97,7 +97,7 @@ // if no class attributes $html .= '' . $ins . ''; } else { - $html .= '' . $ins . ''; + $html .= '' . $ins . ''; } return $html; } @@ -117,7 +117,7 @@ // if no class attributes $html .= '' . $mark . ''; } else { - $html .= '' . $mark . ''; + $html .= '' . $mark . ''; } return $html; } @@ -137,7 +137,7 @@ // if no class attributes $html .= '' . $q . ''; } else { - $html .= '' . $q . ''; + $html .= '' . $q . ''; } return $html; } @@ -157,7 +157,27 @@ // if no class attributes $html .= '' . $samp . ''; } else { - $html .= '' . $samp . ''; + $html .= '' . $samp . ''; + } + return $html; + } + ], + + // Small Caps + 'smallcaps' => [ + 'attr' => [ + 'class' + ], + 'html' => function($tag) { + $html = ''; + $smallcaps = $tag->smallcaps; + $class = $tag->class; + + if($class == '') { + // if no class attributes + $html .= '' . $smallcaps . ''; + } else { + $html .= '' . $smallcaps . ''; } return $html; } @@ -177,7 +197,7 @@ // if no class attributes $html .= '' . $s . ''; } else { - $html .= '' . $s . ''; + $html .= '' . $s . ''; } return $html; } @@ -197,7 +217,7 @@ // if no class attributes $html .= '' . $sub . ''; } else { - $html .= '' . $sub . ''; + $html .= '' . $sub . ''; } return $html; } @@ -217,7 +237,7 @@ // if no class attributes $html .= '' . $sup . ''; } else { - $html .= '' . $sup . ''; + $html .= '' . $sup . ''; } return $html; } diff --git a/package.json b/package.json index fe8aac8..eefd0bc 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "kirby-markup", "description": "Custom Kirbytags providing more advanced semantic markup in textareas", "author": "Scott Boms ", - "version": "1.0.0", + "version": "1.0.1", "type": "kirby-plugin", "license": "MIT" }