From 530b893710fb4e6cc72f8001beb0888d77f61be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Desmedt?= <34781168+DesignThinkerer@users.noreply.github.com> Date: Sun, 8 Dec 2024 20:56:35 +0100 Subject: [PATCH 1/2] Add another example to the wikify widget : use core svg to show an icon next to links (#8806) * Add another example to the wikify widget : use core svg to show an icon next to links * improve wikitext * fix css * limit example to svg core tiddlers * fix typo + use <<.wid wikify>> when mentioning the wikify widget * simplify a bit more the procedure that add a namespace to the svg --- .../TestCases_WikifyWidget_RenderSVGURI.tid | 48 +++++++++++++++++++ .../tw5.com/tiddlers/widgets/WikifyWidget.tid | 10 ++-- 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 editions/tw5.com/tiddlers/TestCases_WikifyWidget_RenderSVGURI.tid diff --git a/editions/tw5.com/tiddlers/TestCases_WikifyWidget_RenderSVGURI.tid b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_RenderSVGURI.tid new file mode 100644 index 000000000..e809c7891 --- /dev/null +++ b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_RenderSVGURI.tid @@ -0,0 +1,48 @@ +created: 20241206225533517 +description: Rendering parameterised SVG for use in stylesheets +tags: $:/tags/wiki-test-spec +title: TestCases/WikifyWidget/RenderSVGURI +type: text/vnd.tiddlywiki-multiple + +title: Narrative + +The core svg icons use a parameter widget, making their use in stylesheets impossible without wikify. ++ +title: Output + +* https://tiddlywiki.com/ +* [[TW5|http://tiddlywiki.com/]] +* [[Mail me|mailto:me@where.net]] +* [[Open file|file:///c:/users/me/index.html]] + + ++ +title: Stylesheet + +\rules except dash +\procedure link-icon(protocol,img) +<$tiddler tiddler=<> > + <$wikify name="svg" text={{!!text}} mode="inline" output="html"> + <$text text=` + [href*="$(protocol)$"]{ + --mask:url('data:image/svg+xml;utf8,$(svg)$'); + } + `/> + + +\end + +.tc-tiddlylink-external:after{ + width:.7rem; + aspect-ratio:1; + background:currentColor; + display: inline-block; + mask: center / contain no-repeat var(--mask); + margin-inline:.5ch; + content:""; +} + +<> +<> +<> +<> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/widgets/WikifyWidget.tid b/editions/tw5.com/tiddlers/widgets/WikifyWidget.tid index e8af7ef82..198c5d64e 100644 --- a/editions/tw5.com/tiddlers/widgets/WikifyWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/WikifyWidget.tid @@ -1,17 +1,17 @@ caption: wikify created: 20160321144949700 -modified: 20241202014354100 +modified: 20241206233352509 tags: Widgets title: WikifyWidget type: text/vnd.tiddlywiki ! Introduction -The <<.wid wikify>> widget parses and renders a string of text and assigns the result to a specified [[variable|Variables]]. The new value of the variable is available to the content within the wikify widget. +The <<.wid wikify>> widget parses and renders a string of text and assigns the result to a specified [[variable|Variables]]. The new value of the variable is available to the content within the <<.wid wikify>> widget. ! Content and Attributes -The content of the `<$wikify>` widget is the scope for the value assigned to the variable. +The content of the <<.wid wikify>> widget is the scope for the value assigned to the variable. |!Attribute |!Description | |name |The name of the variable to assign | @@ -44,3 +44,7 @@ The available output types are: !! Exporting rendered html <> + +!! Rendering parameterised SVG for use in stylesheets + +<> \ No newline at end of file From 978685524b709ca8d2d242c14bfb2e6ebb57b0f8 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 9 Dec 2024 16:26:43 +0000 Subject: [PATCH 2/2] Replace Netlify build badge with a local image To avoid CORS problems with https://github.com/TiddlyWiki/TiddlyWiki5/pull/8810 --- editions/tw5.com/tiddlers/system/netlify-build-badge-icon.tid | 4 ++++ editions/tw5.com/tiddlers/system/netlify-build-badge.tid | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 editions/tw5.com/tiddlers/system/netlify-build-badge-icon.tid diff --git a/editions/tw5.com/tiddlers/system/netlify-build-badge-icon.tid b/editions/tw5.com/tiddlers/system/netlify-build-badge-icon.tid new file mode 100644 index 000000000..8ee5ec734 --- /dev/null +++ b/editions/tw5.com/tiddlers/system/netlify-build-badge-icon.tid @@ -0,0 +1,4 @@ +title: $:/_tw5.com/netlify-build-badge/netlify-light.svg +type: image/svg+xml + + \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/system/netlify-build-badge.tid b/editions/tw5.com/tiddlers/system/netlify-build-badge.tid index b0cd272c0..60bae279e 100644 --- a/editions/tw5.com/tiddlers/system/netlify-build-badge.tid +++ b/editions/tw5.com/tiddlers/system/netlify-build-badge.tid @@ -6,7 +6,7 @@ list-after: $:/core/ui/SideBarSegments/site-subtitle