User talk:Derf: Difference between revisions

From PS3 Developer wiki
Jump to navigation Jump to search
(→‎Syntaxhighlight: I think i got it, im going to note it before i forget about it :)
Line 23: Line 23:


*The other day i found a way to remove all custom color dependencies that was matching with the old custom color settings of syntaxhighlight in the templates loaded by [[RCOXML Objects]] and [[RCOXML Animations]]. I dont remember if i was doing the same in other pages but incase some of you find more let me know and i will fix it, or fix it yourself [[Special:Diff/62240/70960|this way]] (the magic is made by passing the variable <nowiki>{{{1|Element}}}</nowiki> to syntaxhighlight with the #tag: prefix to change the displayed xml code dinamically). We dont need to worry about this problem anymore, we can configure syntaxhighlight with any custom color (better than what we was using years ago) and that templates should load the new colors fine--[[User:Sandungas|Sandungas]] ([[User talk:Sandungas|talk]]) 13:04, 30 April 2023 (CEST)
*The other day i found a way to remove all custom color dependencies that was matching with the old custom color settings of syntaxhighlight in the templates loaded by [[RCOXML Objects]] and [[RCOXML Animations]]. I dont remember if i was doing the same in other pages but incase some of you find more let me know and i will fix it, or fix it yourself [[Special:Diff/62240/70960|this way]] (the magic is made by passing the variable <nowiki>{{{1|Element}}}</nowiki> to syntaxhighlight with the #tag: prefix to change the displayed xml code dinamically). We dont need to worry about this problem anymore, we can configure syntaxhighlight with any custom color (better than what we was using years ago) and that templates should load the new colors fine--[[User:Sandungas|Sandungas]] ([[User talk:Sandungas|talk]]) 13:04, 30 April 2023 (CEST)
----
In [[Special:SpecialPages|Special pages]] ---> [[Special:Version|Version]] it can be seen we are running MediaWiki v1.35.10 and SyntaxHighlight v2.0<br>
I been lurking in the repositories of some versions of syntaxhighlight and it seems the old ones was using a file dedicated to each programming language (there was tenths, one of them named xml.css) but as far i understand the modern syntaxhighlight we are using that was shipped with mediawiki 1.35 is using a general color config file named [https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/SyntaxHighlight_GeSHi/+/refs/heads/REL1_35/modules/pygments.generated.css '''pygments.generated.css''']. I guess you have this file in the server (under path "modules"), right ?<br>
Well, one way or the other (in a dedicated file named xml.css or in a common file shared by all languages named pygments.generated.css) it works by assigning an unique ID to every hghlighted item, basically... to improve the xml highlighting you need to modify the '''nt''' (Name.Tag), the '''na''' (Name.Attribute), and the '''s''' (String)
<pre>
Line 47: .mw-highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
Line 37: .mw-highlight .na { color: #7D9029 } /* Name.Attribute */
Line 36: .mw-highlight .s { color: #BA2121 } /* Literal.String */
</pre>
For the new colors (trying to stick to some standard) i been lurking in the notepad++ repositories to copy the colors they are using that looks nice. Are set in the file named [https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/stylers.model.xml stylers.model.xml], are pretty much the same identifyers ('''TAG''', '''ATTRIBUTE''', '''SINGLE STRING''')
<pre>
Line 1436: <WordsStyle name="TAG" styleID="1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
Line 1439: <WordsStyle name="ATTRIBUTE" styleID="3" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
Line 1435: <WordsStyle name="SINGLE STRING" styleID="7" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
</pre>
To summarize:
*'''nt''' (<span style="color:#008000>#008000</span>) needs to be replaced by <span style="color:#0000FF>#0000FF</span>
*'''na''' (<span style="color:#7D9029>#7D9029</span>) needs to be replaced by <span style="color:#FF0000>#FF0000</span>
*'''s''' (<span style="color:#BA2121>#BA2121</span>) needs to be replaced by <span style="color:#8000FF>#8000FF</span>
And the result should be:
<span style="color:#0000FF><Tag</span> <span style="color:#FF0000>attribute=</span><span style="color:#8000FF>"string"</span><span style="color:#0000FF>></span><br>
[[User:Sandungas|Sandungas]] ([[User talk:Sandungas|talk]]) 23:47, 3 May 2023 (CEST)
----

Revision as of 22:48, 3 May 2023

Wiki manteinance feedback

Syntaxhighlight

After some experiments i can confirm the syntaxhighlight extension is working, the reason why it was confusing me latelly is because time ago (when everything was working fine) we was using a different color selection for the xml language highlights
Long story short... we was trying to use the same default xml colors than notepad++ that looks a bit like this color sample and are a lot more friendly, but it was not exactly the same colors (was simplifyed for wiki)
As far i remember it was euss who did after a talk we had, but he never told me what he did, and now i think he customized some colors, today i been reading a bit the documentation and it seems there is a file named Genshi.css where the colors can be configured, i dont have access to that file but im guessing the changes was made in it, but im wondering it was lost years ago in one of the defyboy attempts to fix syntaxhighlight, if you have some old backup please take a look if there is some file with that color settings
For curiosity sake... at some point i was doing a tricky combination of templates "broken" in pieces where i was using real systaxhighlight tags with fake ones (forcing the color highlighting manually with <span style>) to match with the custom colors from the real syntaxhighllight. IE: in this section (click in edit to see how is composed and which xml code is real or fake highlight) that is loading chunks of the table from this template

  • Basically... i was doing this color selection (attributes in blue color:#000077, and the value of attributes in red color:#ff3333):
    • <span style="font-family:Courier New;">'''<Entry''' <span style="color:#000077;">positionX</span><span style="color:#ff3333;">="100"</span> '''/>'''</span>
  • To display it like this:
    • <Entry positionX="100" />

Right now i dont remember how i "chery picked" that colors, all i remember is i dedicated some time to match with what the sysntaxhighlight was doing (and all the other details about bold and font family was important because syntaxhighlight is doing it too), but as you can see the current color selection looks very different:

  • <Entry positionX="100" /> <--- Current
  • <Entry positionX="100" /> <--- Colored manually by me to match with the "old style"

So far thats the explanation of why i was not sure latelly if syntaxhighlight was working, and a rough resume of how it was customizzed, now if you want to know my oppinion about what to do with this there are some things to consider. The custom xml colors used by euss really looks way better than the defaults (this was an improvement). And some of the pages i made have a dependancy with that color selection (i know, this was a bad idea but at that time i was experimenting a bit with wiki, as usual). I would like to restore that custom colors but if there is some room for improvements im fully into it. As far i understand euss customized only 2 xml colors, but in notepadd++ are at least 3 and are asigned in a different way than what euss did, the idealistic color selection to match 100% with notepad++ would be something like this (with 3 custom colors):

  • <element attribute="value" />

If you find how to configure it to match this notepad++ color selection please do it because is better than what euss did --Sandungas (talk) 11:41, 22 April 2023 (CEST)

  • I don't have any experience with the extension, but I vaguely recall seeing an option to choose what color scheme you want to be default (like a preset palette) or an option to choose it via a parameter on the element via page editor. I'll look into it more when I get a chance - probably next weekend. Derf (talk) 23:59, 22 April 2023 (CEST)
  • The other day i found a way to remove all custom color dependencies that was matching with the old custom color settings of syntaxhighlight in the templates loaded by RCOXML Objects and RCOXML Animations. I dont remember if i was doing the same in other pages but incase some of you find more let me know and i will fix it, or fix it yourself this way (the magic is made by passing the variable {{{1|Element}}} to syntaxhighlight with the #tag: prefix to change the displayed xml code dinamically). We dont need to worry about this problem anymore, we can configure syntaxhighlight with any custom color (better than what we was using years ago) and that templates should load the new colors fine--Sandungas (talk) 13:04, 30 April 2023 (CEST)

In Special pages ---> Version it can be seen we are running MediaWiki v1.35.10 and SyntaxHighlight v2.0
I been lurking in the repositories of some versions of syntaxhighlight and it seems the old ones was using a file dedicated to each programming language (there was tenths, one of them named xml.css) but as far i understand the modern syntaxhighlight we are using that was shipped with mediawiki 1.35 is using a general color config file named pygments.generated.css. I guess you have this file in the server (under path "modules"), right ?
Well, one way or the other (in a dedicated file named xml.css or in a common file shared by all languages named pygments.generated.css) it works by assigning an unique ID to every hghlighted item, basically... to improve the xml highlighting you need to modify the nt (Name.Tag), the na (Name.Attribute), and the s (String)

Line 47: .mw-highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
Line 37: .mw-highlight .na { color: #7D9029 } /* Name.Attribute */
Line 36: .mw-highlight .s { color: #BA2121 } /* Literal.String */

For the new colors (trying to stick to some standard) i been lurking in the notepad++ repositories to copy the colors they are using that looks nice. Are set in the file named stylers.model.xml, are pretty much the same identifyers (TAG, ATTRIBUTE, SINGLE STRING)

Line 1436: <WordsStyle name="TAG" styleID="1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
Line 1439: <WordsStyle name="ATTRIBUTE" styleID="3" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
Line 1435: <WordsStyle name="SINGLE STRING" styleID="7" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />

To summarize:

  • nt (#008000) needs to be replaced by #0000FF
  • na (#7D9029) needs to be replaced by #FF0000
  • s (#BA2121) needs to be replaced by #8000FF

And the result should be: <Tag attribute="string">

Sandungas (talk) 23:47, 3 May 2023 (CEST)