[mythtv-theming] Possible minor template issue

David Engel david at istwok.net
Fri Sep 24 17:32:46 UTC 2010


On Fri, Sep 24, 2010 at 05:05:38PM +0100, Stuart Morgan wrote:
> On Friday 24 Sep 2010 15:29:26 David Engel wrote:
> > I see a number of theme templates like the following.
> > 
> > 	%|"SUBTITLE|"% %STARS% %DESCRIPTION%
> > 	%|"SUBTITLE|"%\n%YEARSTARS%%DESCRIPTION%
> > 
> > Shouldn't they be like this instead?
> > 
> >         %|"SUBTITLE|" %%STARS| %%DESCRIPTION%
> >         %|"SUBTITLE|"\n%%YEARSTARS%%DESCRIPTION%
> 
> In current trunk, after changes made within the week they can and should be:
> 
>          %"|SUBTITLE|" %%STARS| %%DESCRIPTION%
>          %"|SUBTITLE|"\n%%YEARSTARS%%DESCRIPTION%

FWIW, the examples I used are from current trunk.  I noticed the issue
when I glanced at Mark's change in [26488].

> Although your suggestion would work for backwards compatibility reasons.
> 
> With the new regexp any number of characters are permitted between 
> "%<prepend>|" preceding the inserted string and "|<append>%" following the 
> string.

> IIRC the original regular expression in the old UI required the following 
> form:
> 
> %SUBTITLE|"|"%
> 
> and it only supported a single character to be prepended/appended.

I don't recall any single character limitation.  I know I used '" '
and '"\n' in some things I did.  Perhaps that limitation crept in in a
rewrite or there were multiple code paths for OSD and non-OSD
replacement.

> The mythui conversion changed the regexp slightly so that the prepended 
> character appeared at the beginning because this seemed a little clearer. 
> However it still only permitted a single character because I was having 
> trouble with the regexp, but I'd always intended to come back to it and allow 
> multiple characters. About a week ago I remembered that I had yet to fix the 
> regexp and this was finally done in [26412] ([26418] & [26451])

I remember your commit, but nothing caught my eye, so I didn't pay too
close attention to it.

> The template stuff in MythUI actually supports two methods, the choice of 
> which probably depends on the usage.
> 
> Take the following example:
> <textarea name="subtitle">
>     <value>Unknown Episode</value> <!-- A default string, shown when subtitle 
> is empty -->
>     <template>Episode: %1</template>
> </textarea>
> 
> When you have a single value in the textarea or the value does not come from a 
> map you may choose the above form. Benefits include the ability to show 
> something in place of the subtitle if no subtitle is available.

Good.  I was going to ask about the apparent missing empty string
case.

OK, now back to my original point -- getting rid of unwanted leading
spaces and newlines.  It sounds like you agree a fix is needed in some
places.  If so, it looks like there are quite a few places that could
be fixed.  Would that mess up the translators?

David
-- 
David Engel
david at istwok.net


More information about the mythtv-theming mailing list