background: url("external") - why doesn't it work?

75 views
Skip to first unread message

Mat

unread,
Sep 13, 2018, 1:05:31 AM9/13/18
to TiddlyWikiDev
Here is a demo. As you can see, external images can be properly used - but not for css background:url(...)  

For example, the following does not work. Why?


<div id="imageonly"> foo </div>

<style>
#imageonly { background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/652/confectionary.png");
}
</style>

Changing "background" to "background-image" makes no difference. Same results also when the TW is local in the computer.

Thanks

<:-)

Jeremy Ruston

unread,
Sep 13, 2018, 3:12:48 AM9/13/18
to tiddly...@googlegroups.com
Hi Mat

I'm guessing that the double slash in the URL is being interpreted as the start of an italic run. Try putting the styles in their own style sheet, and include a \rules line to restrict the parsers.

Best wishes

--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/55fbf748-4124-465b-bfcb-4ef653519805%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

PMario

unread,
Sep 13, 2018, 5:07:47 AM9/13/18
to TiddlyWikiDev
Hi Mat,

You are aware, that everybody, who uses your link will also use your bandwidth, that you have to pay for. ... Assuming the image link belongs to you, and the image has an open license.

-m

Mat

unread,
Sep 13, 2018, 11:11:36 AM9/13/18
to TiddlyWikiDev
Jeremy Ruston wrote:
I'm guessing that the double slash in the URL is being interpreted as the start of an italic run. Try putting the styles in their own style sheet, and include a \rules line to restrict the parsers.

It was enough to put the styles in their own stylesheet. IMO this should work also as a styleblock so I'll make an issue unless you object.

Thank you!

<:-)

Mat

unread,
Sep 13, 2018, 11:18:17 AM9/13/18
to TiddlyWikiDev
PMario wrote:
You are aware, that everybody, who uses your link will also use your bandwidth, that you have to pay for. ... Assuming the image link belongs to you, and the image has an open license.

I had not considered bandwidth costs but I'd say it's an assumed cost when things are put up on the web. But image rights is another issue. In the demo I used totally arbitrary imges just to get linking to work at all.

Thanks

<:-)

Jeremy Ruston

unread,
Sep 13, 2018, 11:18:38 AM9/13/18
to tiddly...@googlegroups.com
Hi Mat


On 13 Sep 2018, at 16:11, Mat <matia...@gmail.com> wrote:

IMO this should work also as a styleblock so I'll make an issue unless you object

It's not obvious how it should work. The idea would presumably be for the parser to detect the style tag and then swallow the content up to the closing tag without attempting to parse it. You’d probably want macro call parsing so that you could write “background: <<colour primary>>”. In practice, you may want arbitrary parse rules available.

There are a few potential workarounds short of putting the stylesheet into a separate tiddler. For example:

\define styles()
\end
<div id="imageonly"> foo </div>

<style>
<$text text=<<styles>>/>
</style>

We could perhaps encapsulate that approach into a <<styles>> macro that rolled everything together.

Best wishes

Jeremy

Mat

unread,
Sep 13, 2018, 4:23:35 PM9/13/18
to TiddlyWikiDev
Jeremy Ruston wrote:
We could perhaps encapsulate that approach into a <<styles>> macro that rolled everything together.

Would it not make more sense with a styles widget to make it equivalent to the styles html tag?

<:-)

Jeremy Ruston

unread,
Sep 13, 2018, 5:16:21 PM9/13/18
to tiddly...@googlegroups.com
Hi Mat

Would it not make more sense with a styles widget to make it equivalent to the styles html tag?

The issue here is parsing: widgets aren’t executed until the rendering phase, which is after parsing. Making this work requires us to change the parsing process so that the stylesheet block isn’t parsed with the full set of wikitext parse rules.

Said differently: to make a styles widget have the behaviour required would mean changing the parsing process so that it somehow recognises the special case of the styles widget, and parses the content differently. There’s no such provision in the parser at the moment: all widgets are parsed consistently.

Best wishes

jeremy.




<:-)

--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.

PMario

unread,
Sep 14, 2018, 2:59:56 AM9/14/18
to tiddly...@googlegroups.com
On Thursday, September 13, 2018 at 5:18:17 PM UTC+2, Mat wrote:
PMario wrote:
You are aware, that everybody, who uses your link will also use your bandwidth, that you have to pay for. ... Assuming the image link belongs to you, and the image has an open license.

I had not considered bandwidth costs but I'd say it's an assumed cost when things are put up on the web.

If I upload content to the web at my expense, I upload it for my use only!  So if someone visits my site they can see my images. ..

The point I wanted to make is: It's not right to use someone elses content without their knowledge or permission. 
 
But image rights is another issue.

It's the same problem as above. Even if the image has a permissive license. You should _not_ use it from a storage-link, that you can't trust.

In the demo I used totally arbitrary imges just to get linking to work at all.

Yea, but that's a problem. What if the owner changes the image into something, that causes trouble for your site. eg: hate speech, porn or you name it.

just some thoughts
-mario


Mat

unread,
Sep 16, 2018, 5:13:59 PM9/16/18
to TiddlyWikiDev
Jeremy Ruston wrote:
We could perhaps encapsulate that approach into a <<styles>> macro that rolled everything together.

Are there at least a few style block issues that could be solved with a more general <<styles>> macro? Otherwise it is not justified to bother with and it should perhaps be limited to bring up in the docs.

<:-)

Mat

unread,
Sep 16, 2018, 5:21:05 PM9/16/18
to TiddlyWikiDev
PMario

If I couldn't use those urls for my examples I would barely have been able to present this issue. While that of course is "my problem", not the image owners, I think it is fair use. It would be a very different matter if I used it for e.g a commercial matter or possibly somewhere where it would cause so much traffic that it would cause consequences for the image owner, but this is not the case here. True, that is my opinion, not the law, but that's how I see it.

<:-)

TonyM

unread,
Sep 17, 2018, 8:20:45 PM9/17/18
to TiddlyWikiDev
Mario,

Given your well stated "internet citizen" ethics is this still true if that image is delivered through a CDN Content Delivery Network such as CloudFlair ? Some resources are "publish that way" and encourage people to include them in their own websites.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages