.mode html fails on html content
(1) By Tony Papadimitriou (tonyp) on 2020-06-11 18:44:28 [source]
I have a table where one column needs to be a clickable HTML link.
.mode html to create the result set, the HTML column content is escaped losing correct display and click-ability.
Any way for
.mode html to leave existing HTML code alone?
Or, if I have the link as plain text, some way to automatically convert it to clickable link within the resulting HTML table?
Can the SQLite3 shell do this without having to resort to external scripting?
(2.1) By Larry Brasfield (LarryBrasfield) on 2020-06-12 02:09:14 edited from 2.0 in reply to 1 [link] [source]
The whole point of html mode, csv mode, TCL mode, SQL insert mode, etc is that values from the database are rendered in a way that survives passage through a subsequent html rendering, csv output, TCL dequoting, interpretation as SQL, etc. The html mode is not what you want to pass DB content that is to remain as it is. There are modes that will do that. If you wish to surround such output with stuff that is HTML markup, the .print meta-command can do that.
It's not quite clear what all you envision the shell doing, but it is not intended as a do-it-all, general purpose utility. It is extremely useful for doing the simple things when used within (external) scripts to do more grand things. The fact that it helps a little with those grander tasks is not reason to think it should have an ever-growing feature set designed to accept ever-more-complex inputs and produce a never-to-be-done set of complex outputs. That's what programming languages are for.
(3) By Donald Griggs (dfgriggs) on 2020-06-11 19:03:48 in reply to 1 [link] [source]
This may be obvious and unhelpful, but for my need I just use
And create my own HTML markup with:
UPDATE myTable set ln = '<a href="' || ln || '">' || ln || '</a><br />'
WHERE ln like 'http%';
(Where "ln" is a text field with an entire line of output.)