Quote:
Originally Posted by ownedbycats
Code:
if select(ids, 'url') then
if
'(Archive of Our Own|Fanfiction.net)' in $publisher
&& '(Completed|Abandoned|Oneshot|Incomplete)' in status
then "metadata.png"
elif
!select(ids, 'ao3')
&& $publisher == 'Archive of Our Own'
&& status == 'In-Progress'
then 'metadata.png'
elif
!select(ids, 'ffnet')
&& $publisher == 'FanFiction.net'
&& status == 'In-Progress'
then "metadata.png"
fi
fi
Would it be able to combine the two bottom elifs into one? Regex (ao3|ffnet) is one way, but is there a way to keep the id/publisher pair separate from each other?
|
I think you mean something like this:
Code:
program:
if
'(Archive of Our Own|Fanfiction.net)' in $publisher
&& '(Completed|Abandoned|Oneshot|Incomplete)' in status
then "metadata.png"
elif (!select(ids, 'ao3')
&& $publisher == 'Archive of Our Own'
&& status == 'In-Progress' )
||
(!select(ids, 'ffnet')
&& $publisher == 'FanFiction.net'
&& status == 'In-Progress')
then
"metadata.png"
fi
Quote:
EDIT: Another question:
Attachment 191967
Did I somehow accidentally turn it into last_non_empty?
|
No. But by using a semicolon instead of a comma you turned the two 'if' statements into a single statement sequence, not two parameters. The value of a statement sequence is the last statement in the sequence, in your case the authors if.
It should look like this:
Code:
program:
first_non_empty(
if $title then 'title' fi, <==== comma here
if $authors then 'authors' fi
)