From 3dd877ff73cfcbd6ac178692942455281f622ff1 Mon Sep 17 00:00:00 2001 From: Talon Poole Date: Tue, 2 Feb 2021 22:34:26 +0000 Subject: [PATCH] optional title props --- example/expected.html | 7 ++++++- example/test.gmi | 7 ++++++- to-html.js | 7 ++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/example/expected.html b/example/expected.html index f48aed3..0897e59 100644 --- a/example/expected.html +++ b/example/expected.html @@ -23,7 +23,7 @@


here's what a blockquote is like


-
+
 preformatted text
        means that it already has formatting
   which means it should show
@@ -40,5 +40,10 @@ preformatted text
 
 
 
+


+

w/ no "titles"

+ + + diff --git a/example/test.gmi b/example/test.gmi index f2d3a3b..c0c5c8d 100644 --- a/example/test.gmi +++ b/example/test.gmi @@ -9,7 +9,7 @@ checkout this empty line: > here's what a blockquote is like -```pre tags can have alt text +```pre tags can have title text preformatted text means that it already has formatting which means it should show @@ -26,3 +26,8 @@ preformatted text => https://www.learningcontainer.com/wp-content/uploads/2020/07/Large-Sample-Image-download-for-Testing.jpg JPG image that can render inline! => https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3 MP3 audio that can render inline! => https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4 MP4 Video that can render inline! + +### w/ no "titles" +=> https://www.learningcontainer.com/wp-content/uploads/2020/07/Large-Sample-Image-download-for-Testing.jpg +=> https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3 +=> https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4 diff --git a/to-html.js b/to-html.js index 2e6a273..b2dbce6 100644 --- a/to-html.js +++ b/to-html.js @@ -88,12 +88,13 @@ function line( ) { if (text) return `

${escape(text)}

`; if (href) { + const titleProp = title ? ` title="${title}"` : "" if (images && IMG_EXT.test(href)) - return ``; + return ``; if (audio && AUDIO_EXT.test(href)) - return ``; + return ``; if (video && VIDEO_EXT.test(href)) - return ``; + return ``; return `${title ? escape(title) : href}`; }