Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2017-11-12 23:28:50

pjtraveler
Member
Registered: 2012-11-26
Posts: 243

Newline in LUA= causes images not to display when published.

I was reading Jim R post on LUA (his works for me on Windows 10, LR classic), and used his code as a prototype to suppress unwanted characters.

{LUA= if Title ~= nil and Title ~= "" then
   if Caption ~= nil and Caption ~= ""  and Caption ~= Title then return sprintf("%s  %s %s %s",  Title,  Caption, Month, YYYY)
   else return sprintf("%s - %s %s", Title, Month, YYYY) 
   end
else
   if Caption ~= nil and Caption ~= "" then  return sprintf("%s - %s %s", Caption, Month, YYYY)
   else  return sprintf("%s %s", Month, YYYY)
   end   
   
end}

I tried adding a \n character in the first sprintf; the results were that it published but the appearance of the album has no images. I am wondering if I have exceeded a margin or something?   I have only tried it with vegas, not any of the others.

Offline

#2 2017-11-12 23:42:55

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Newline in LUA= causes images not to display when published.

Line breaks, when not properly encoded for Web display, can cause all manner of problems. I'd avoid them.


Matt

The Turning Gate, http://theturninggate.net

Offline

#3 2017-11-12 23:49:28

pjtraveler
Member
Registered: 2012-11-26
Posts: 243

Re: Newline in LUA= causes images not to display when published.

The other image forms of Theater all present images, just not vegas.  However, only stills shows the metadata, but without the newline

Offline

#4 2017-11-13 00:15:53

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Newline in LUA= causes images not to display when published.

Well, that's makes perfect sense then. Vegas loads images from a JSON array. Unformatted line-breaks break JSON.


Matt

The Turning Gate, http://theturninggate.net

Offline

#5 2017-11-13 05:09:08

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Newline in LUA= causes images not to display when published.

Where’s the JSON come from? Encoded JSON should encode line breaks properly.

Offline

#6 2017-11-13 06:48:09

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Newline in LUA= causes images not to display when published.

In my testing, a "\n" gets passed through as-is in the JSON and doesn't break it.  In HTML, the newline has no effect.  In JS, it probably breaks scripts. 
Testing with <br/> passes the code through an an encoded form (i.e. &ltlbr/&gt;), which displays literally as as "<br/>" to screen.  I'll investigate further to see whether this can (and should) be handled as HTML.

Offline

Board footer

Powered by FluxBB