It is currently April 12th, 2021, 3:39 am

Help with parsing html

Help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 12543
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with parsing html

Post by balala »

jsmorley wrote: April 8th, 2021, 4:01 pm Hm.. Yeah. The problem is that the measure values, like [mRSSItem2], are first "resolved" into their actual text values, and then used as part of the InlinePattern option. If the values have reserved characters, they must be escaped to be used as a literal in InlinePattern. I understand that there is no good way to do that. I think you are going to have to rethink this entire thing, so the pattern can be based on position within a context.
Yes, thanks. As the time went by, I came to the same conclusion. So I suppose will have to use five different String meters, each with its own setting (color).
Thanks for the explanation once again.
User avatar
Youkai1977
Posts: 137
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: Help with parsing html

Post by Youkai1977 »

@jsmorley & balala:

Oh dear, I will soon occupy the whole forum with my worries and cries for help. :Whistle :oops:
But thanks anyway. :thumbup: :bow:

I have now read through your last postings and what balala wrote at the end I have also almost thought. I will have to use a separate meter per [mRSSItem].
Too bad, I thought when I had discovered a few weeks ago the thing with the InlinePattern my skins in the length to tamp properly to be able to save many meters.

But then everything is not so simple. I noticed not only with my NewsFeed skin.
This InlinePattern function is nice, but probably not always really the egg-laying-wool-milk sow. :uhuh: :???:

But I have thought about another alternative. But I'll ask the experts here.
If I Substitute the reserved special characters in the measures BEFORE with other characters, wouldn't that also be a possibility to avoid the problem of coloring the single [mRSSItem] via InlinePattern?
User avatar
balala
Rainmeter Sage
Posts: 12543
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with parsing html

Post by balala »

Youkai1977 wrote: April 9th, 2021, 9:15 am I have now read through your last postings and what balala wrote at the end I have also almost thought. I will have to use a separate meter per [mRSSItem].
Too bad, I thought when I had discovered a few weeks ago the thing with the InlinePattern my skins in the length to tamp properly to be able to save many meters.
In fact the code using five string meters instead of one, is not much more complicated or longer. I rewrote a few things to get it working, here are the modifications:
  • In the newsfeed.ini file:
    • Replaced the [!ShowMeter NewsFeed] bang of the FinishAction option of the [mRSS] measure with [!ShowMeterGroup "FEED"] (also added further String meters beaside [NewsFeed], all having set the Group=FEED option, that's why the FEED group has to be shown, not only the NewsFeed meter - see below).
    • Replaced the EndValue=-[NewsFeed:W] option of the [mXPos] measure with EndValue=(100-[NewsFeed:W]-[NewsFeed2:W]-[NewsFeed3:W]-[NewsFeed4:W]-[NewsFeed5:W]).
    • Replaced the [NewsFeed] meter with the following one and added the next five meters ([NewsFeed2] - [NewsFeed5]):

      Code: Select all

      [NewsFeed]
      Meter=STRING
      MeterStyle=StNEWS
      X=[mXPos]r
      Y=r
      MeasureName=mRSSItem1
      FontColor=#Color1##Alpha1#
      
      [NewsFeed2]
      Meter=STRING
      MeterStyle=StNEWS
      X=8R
      Y=r
      MeasureName=mRSSItem2
      FontColor=#Color2##Alpha1#
      
      [NewsFeed3]
      Meter=STRING
      MeterStyle=StNEWS
      X=8R
      Y=r
      MeasureName=mRSSItem3
      FontColor=#Color1##Alpha1#
      
      [NewsFeed4]
      Meter=STRING
      MeterStyle=StNEWS
      X=8R
      Y=r
      MeasureName=mRSSItem4
      FontColor=#Color2##Alpha1#
      
      [NewsFeed5]
      Meter=STRING
      MeterStyle=StNEWS
      X=8R
      Y=r
      MeasureName=mRSSItem5
      FontColor=#Color1##Alpha1#
      Text=[\x2022][\x2022][\x2022]  %1  [\x2022][\x2022][\x2022]
  • In the newsfeeddata.inc file:
    All modifications have been done into the [StNEWS] section:
    • Removed the InlineSetting2 and InlinePattern2 options.
    • Replaced the InlineSetting and InlinePattern options with the following ones:

      Code: Select all

      [StNEWS]
      ...
      InlineSetting=Color | #Color5##Alpha1#
      InlinePattern=•
      ...
    • Replaced the Text option with this: Text=[\x2022][\x2022][\x2022] %1.
    • Removed the FontColor option.
If interesetd please try out this and let me know how does it work.