Extension talk:SyntaxHighlight/Archive 2017

From mediawiki.org
Jump to navigation Jump to search

2017

I cannot get this to highlight

I am using MediaWiki 1.27 on Windows; i installed this extension and python and pygments; If i insert this code on a page:

<syntaxhighlight lang="python">
def quickSort(arr):
	less = []
	pivotList = []
pivotList = []
	more = []
	if len(arr) <= 1:
		return arr
	else:
		pass
</syntaxhighlight>

then i get this output in the html:

<div class="mw-highlight mw-content-ltr" dir="ltr">
<pre>
def quickSort(arr):
	less = []
	pivotList = []
pivotList = []
	more = []
	if len(arr) <= 1:
		return arr
	else:
		pass
</pre>
</div>

It should be something like this (source [[1]]):

<div class="mw-highlight mw-content-ltr" dir="ltr">
<pre>
<span class="lineno">1 </span><span class="k">def</span> <span class="nf">quickSort</span><span class="p">(</span><span class="n">arr</span><span class="p">):</span>
<span class="lineno">2 </span>	<span class="n">less</span> <span class="o">=</span> <span class="p">[]</span>
<span class="lineno">3 </span>	<span class="n">pivotList</span> <span class="o">=</span> <span class="p">[]</span>
<span class="lineno">4 </span>	<span class="n">more</span> <span class="o">=</span> <span class="p">[]</span>
<span class="lineno">5 </span>	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">arr</span><span class="p">)</span> <span class="o"><=</span> <span class="mi">1</span><span class="p">:</span>
<span class="lineno">6 </span>		<span class="k">return</span> <span class="n">arr</span>
<span class="lineno">7 </span>	<span class="k">else</span><span class="p">:</span>
<span class="lineno">8 </span>		<span class="k">pass</span>
</pre></div>


i dont really know what i could do to debug my config at this point, can anyone help me?

There is any plan to add support for css styles into syntaxhighlight extension ?

Or how i can add some different style per one command or for one "lang" ?

SELinux "fix" for pygments with MW 1.26

Lads, On a fresh installation of MW 1.26.2 on Oracle Linux we encountered the same problem: gray box with and error category at the bottom of the page. Didn't find any real answers to the problem only that I has something to do with SELinux. Disabling and there is no problem. Enabled it and it just doesn't work. So. After some internet searches I came up with the following:

# semanage fcontext -a -t httpd_sys_script_exec_t '/<path_to_mediawiki>/extensions/SyntaxHighlight_GeSHi/pygments(/.*)?'
# restorecon -R -v /<path_to_mediawiki>/extensions/SyntaxHighlight_GeSHi/pygments/

After this it worked. Hope this helps..
Maybe the answer is somewhere here but I could not find it.

MediaWIki 1.28 no highlighted text following the examples

I have installed python27-python-pygments on redhat 6.7 for mediawiki 1.28.0, added the following to LocalSettings.php. wfLoadExtension( 'SyntaxHighlight_GeSHi' ); $wgPygmentizePath = "/opt/rh/python27/root/usr/bin/pygmentize";

Is there something I’m missing?

I’m not seeing any highlighting

getting error Notice: Failed to invoke Pygments: /opt/rh/python27/root/usr/bin/python2: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory [Called from SyntaxHighlight_GeSHi::highlight in /../extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php at line 296] in /../includes/debug/MWDebug.php on line 311

Is there a way to control the width of the container

Is there any way to control the width of the source container?

You can use the class and the style attributes, and specify any CSS as you would for another HTML element. —TheDJ (Not WMF) (talkcontribs) 09:39, 3 March 2017 (UTC)

Java primitives and wrappers

Hi. Why does Java highlighting recognize int but does not recognize String or Double? Thank you. I'll appreciate tagging on answer. Thanks again. IKhitron (talk) 15:55, 21 January 2017 (UTC)