Jump to content

Manual talk:$wgUseTidy

Add topic
From mediawiki.org

Really Unhelpful Page

[edit]

This page doesn't contain any helpful information. How do I point Mediawiki to the tidy executable? How do I set the path for MediaWiki so it can find HTML tidy? Where is the default configuration file located? Where can I get HTML Tidy from? This information should all be on this page, but none of it actually is.

97.117.112.73 06:10, 23 October 2010 (UTC)Reply

You don't use
$wgUseTidy
to point MediaWiki to the Tidy executable or set the path for MediaWiki so it can find HTML Tidy. This is a boolean value, which only accepts
true
or
false
. Use $wgTidyConf (deprecated) or $wgTidyConfig instead. --Merry Christmas from Luis/stranger195 (talkcontribsguestbook) 23:31, 25 February 2016 (UTC)Reply

Example Tidy Configuration File

[edit]

It appears that a valid configuration file for Tidy is required, using the default installed on a server either doesn't work or it has the incorrect settings. So a valid one needs to be provided. The error noted below #Breaking HTML Code was due to this. The configuration file used is noted below (located at /extensions/tidy/tidy.conf), which was found at m:Data dumps#Common Problems and Solutions. Ensure that the Manual:$wgTidyConf is correctly set to the location of the configuration file.

show-body-only: yes
force-output: yes
tidy-mark: no 
wrap: 0
wrap-attributes: no
literal-attributes: yes
output-xhtml: yes 
numeric-entities: yes
enclose-text: yes
enclose-block-text: yes
quiet: yes 
quote-nbsp: yes
fix-backslash: no
fix-uri: no

Breaking HTML Code

[edit]

I have enabled UseTidy on my wiki and it has broken some of the HTML generated to display pages. It is influencing the coding associated with displaying images. Initially I thought it was only to do with the RandomImage extension, but now know that it effects every single image that is displayed in the wiki.

What appears to be happening is that some of the opening and closing tags of the code is generated as & gt; or & lt;. Which then means that things fail, get funny bits of code appearing on the page etc. The code was working fine before enabling $wgUseTidy.

An example of the coding that now appears incorrectly on the pages is as follows. Not sure how to make it not convert the code to a > though. It is on the end of this line: ".... nsitional.dtd" & gt;".

<td>
<div class="gallerybox">
<div class="thumb" style="padding: 14px 0;">
<a href="/masawiki/index.php?title=Image:Blackbody_radiation_4000K.jpg" title="Image:Blackbody radiation 4000K.jpg">
<img src=" /masawiki/images/thumb/2/28/Blackbody_radiation_4000K.jpg/120px-Blackbody_radiation_4000K.jpg" width="120" height="117" alt="" />
</a>
</div>
<div class="gallerytext">
< pre >
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"& gt;
< /pre >
4,500 K</div>
</div>
</td>

If interested, reason for using UseTidy can be found here: Meta-Wiki: Talk: ParserFunctions: Further HTML Tables Problems

This is on an intiallation of MediaWiki 1.8.2 --Dr DBW 23:53, 7 December 2006 (UTC)Reply

Further information, it appears that this only effects image coding that is generated by the gallery tag or the RandomImage extension. Normal images within the pages is fine. So it appears that the code made by those two parts, something is wrong that causes the Tidy script to cause problems. --Dr DBW 22:14, 19 December 2006 (UTC)Reply
This is still an issue. Anyone with suggestions on what to try, where to ask, who etc? --Dr DBW 22:59, 8 February 2007 (UTC)Reply
Upgraded to 1.9.3 and the problem still occurs --Dr DBW 23:48, 27 February 2007 (UTC)Reply
Have submitted a bugzilla for this issue bugzilla:9235 --Dr DBW 02:59, 9 March 2007 (UTC)Reply
SOVLED !!! This is an issue due to not being able to find a configuration file, or not having a valid configuration file in use. --Dr DBW 03:38, 13 March 2007 (UTC)Reply

What an absolutely maddening problem! I've been working on this exact same problem for two days before finding this page. A big thanks to everyone who found the solution. Todd 6, April, 2007.

You have got that right. Anyway, with some further releases coming up, a default configuration file is going to be included in the distribution, it is noted in the bugzilla above if interested. --Dr DBW 04:48, 12 April 2007 (UTC)Reply

Parser.php Error

[edit]

Some of my templets & codes were breaking the page. I was trying to fix this problem last couple of days but not yet solved. As a last hope I used following to my local setting page:

$wgUseTidy=true;
$wgTidyBin = '/usr/bin/tidy';
$wgTidyConf = $IP.'/extensions/tidy/tidy.conf';

Now, my page looks ok but showing following error

Warning: proc_open() [function.proc-open]: open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): (/home:/tmp:/usr) in /home/.../public_html/includes/Parser.php on line 759

Warning: proc_open(/dev/null) [function.proc-open]: failed to open stream: Operation not permitted in /home/.../public_html/includes/Parser.php on line 759

What went wrong? Please help me to slove this problem. Thanks.--Usingha 02:36, 18 October 2007 (UTC)Reply

This problem is solved by fixing the path and installing new tidy 2.0. Thanks--Usingha 02:54, 8 December 2007 (UTC)Reply

wich tidy to use?

[edit]

Q: apt-cache search tidy prints several tidy results. Two of them seem to be interesting:

  • php5-tidy (libtidy-0.99-0)
  • tidy

My guess is that tidy is the prefered choice, but how about php5-tidy? Could this be an interesting alternative? Are there individuals out there with any experience with this module?

-Kaspera 11:17, 2 November 2007 (UTC)Reply

$wgUseTidy hangs MediaWiki

[edit]

In our environment enabling $wgUseTidy can cause all of our wiki to lock-up. To reproduce, we can simply enable tidy, then (in Firefox) rapidly ctrl-click "Random Page" to open a bunch of tabs for the wiki. At some point (usually after the 2nd or 3rd tab loads) the rest of the tabs just sit there, not loading... timing out in several minutes with a 1205: Lock wait timeout exceeded error.

On the server end, when the hang occurs, one of the httpd.exe processes is well over 100MB (it is usually around 70-80MB) and several cmd.exe processes have been spawned. Process Explorer shows the cmd.exe processes as children of httpd.exe, but has no information regarding who/how it was called. While Mediawiki is inaccessible... our phpBB3 installation, served from the same Apache/MySQL/PHP instance, works fine.

To resume normal operations, the httpd.exe process has to be killed and restarted. The cmd.exe processes disappear when httpd.exe is killed.

I have tried downloading the newehttp://upload.wikimedia.org/wikipedia/commons/c/c8/Button_redirect.pngst Tidy 2.0 executable and specifying it in the localsettings.php, but it still breaks. I've tried specifying the tidy.conf file explicitly, but it still breaks. The only way I have been able to avoid the hangs is to disable tidy (comment out $wgUseTidy = true;).

Our environment:

Windows 2003 SP1
WAMP:
   Apache 2.2.8
   PHP 5.2.6
   MySQL 5.0.51b

Mediawiki 1.12.0 (r3238)
phpBB3 3.0.1

Any else seen this type of problem with tidy and Mediawiki? Cedarrapidsboy 14:55, 8 July 2008 (UTC)Reply

It also seems I can use the following without a problem, so it may only be a problem with the external (exe) tidy spawning:
$wgUseTidy = true;
$wgTidyInternal = true;
NOTE: I had to enable PHP's php_tidy extension and restart Apache.
If I read the docs right, this uses PHP's internal tidy algorithms instead of launching the tidy binary to do the work. Cedarrapidsboy 15:08, 8 July 2008 (UTC)Reply
I have the same problem with this Tidy, only it works well when we don't use it, but it is necessary for templates.--189.182.163.13 05:27, 18 September 2009 (UTC)Reply

Terrible Page For Beginners

[edit]

Can someone who knows add how to install Tidy somewhere on the internet? I have been searching for a long, long time now. This page doesn't help at all. --83.172.95.178 19:06, 17 November 2012 (UTC)Reply

Well, this page isn't for that.
$wgUseTidy
is for enabling HTML Tidy if you have it installed. Download it here. --Merry Christmas from Luis/stranger195 (talkcontribsguestbook) 23:33, 25 February 2016 (UTC)Reply
[edit]

In section 1, the link in "The logic for this is found in includes/Sanitizer.php" leading to -> linking to https://gerrit.wikimedia.org/g/mediawiki/core/%2B/HEAD/includes/Sanitizer.php is no longer defined. If this page is about to be reactivated, please correct or realign this link. Thanks -- Christian 🇫🇷 FR (talk) 08:51, 10 December 2024 (UTC)Reply

Fixed. * Pppery * it has begun 15:49, 10 December 2024 (UTC)Reply