Support and General Use > Theming and Appearance Customization
[solved] WPS - how to collapse empty lines?
(1/1)
sellsky:
I'm trying to make WPS display some data on each line:
--- Quote ---Artist
Composer
Album, Disk#-Track#
et cetera
--- End quote ---
The first approach was
--- Code: ---%s%al%?ia<%ia|%?d(2)<%d(2)>>
%s%al%?ic<%ic>
%s%al%?id<%id%?in<%, %?ik<%ik-%in|%in>>>
...
--- End code ---
This works pretty well, however, if there is no Composer in tags, I see the ugly empty line between Artist and Composer. What can I do to collapse this empty line? Just:
--- Quote ---Artist
Album, Disk#-Track#
et cetera
--- End quote ---
I moved the newline under condition,
--- Code: ---%s%al%?ia<%ia|%?d(2)<%d(2)>>%?ic<
%s%al%ic>
%s%al%?id<%id%?in<%, %?ik<%ik-%in|%in>>>
...
--- End code ---
and then
--- Code: ---%s%al%?ia<%ia|%?d(2)<%d(2)>>%?ic<
%ic>
%s%al%?id<%id%?in<%, %?ik<%ik-%in|%in>>>
...
--- End code ---
-- the first one just replaces Artist line with Composer if there is a Composer tag, and the second one joins Artist and Composer on the same line. Newline isn't respected at all.
If I add some text after “%?ic<”, the checkwps tool complains about 'Expected list close', so I move the wrong way I guess. I googled the web and especially this forum, with no luck. Of couse I can bloat the code, making conditions for every line here and then, but this doesn't smell good.
Any suggestions?
Julian67:
It's quite a while since I made a wps but I think the solution is to make a different viewport for each situation, much like many themes use a different viewport depending on the presence of album art. So you make a conditional "if composer tag present use viewport A, otherwise use viewport B".
Navigation
[0] Message Index
Go to full version