1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-10-27 20:34:16 +00:00
gnosygnu_xowa/home/wiki/App/Xtn/Mediawiki/Tidy/JTidy.html
2017-04-27 21:02:09 -04:00

343 lines
14 KiB
HTML

<!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>App/Xtn/Mediawiki/Tidy/JTidy - XOWA</title>
<link rel="shortcut icon" href="https://gnosygnu.github.io/xowa/xowa_logo.png" />
<link rel="stylesheet" href="https://gnosygnu.github.io/xowa/xowa_common.css" type="text/css">
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject skin-vector action-submit vector-animateLayout" spellcheck="false">
<div id="mw-page-base" class="noprint"></div>
<div id="mw-head-base" class="noprint"></div>
<div id="content" class="mw-body">
<h1 id="firstHeading" class="firstHeading"><span>App/Xtn/Mediawiki/Tidy/JTidy</span></h1>
<div id="bodyContent" class="mw-body-content">
<div id="siteSub">From XOWA: the free, open-source, offline wiki application</div>
<div id="contentSub"></div>
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
<div id="toc" class="toc">
<div id="toctitle">
<h2>
Contents
</h2>
</div>
<ul>
<li class="toclevel-1 tocsection-1">
<a href="#Source"><span class="tocnumber">1</span> <span class="toctext">Source</span></a>
</li>
<li class="toclevel-1 tocsection-2">
<a href="#Modifications"><span class="tocnumber">2</span> <span class="toctext">Modifications</span></a>
</li>
<li class="toclevel-1 tocsection-3">
<a href="#jtidy_xowa_changes"><span class="tocnumber">3</span> <span class="toctext">jtidy_xowa changes</span></a>
<ul>
<li class="toclevel-2 tocsection-4">
<a href="#ParseBlock_should_handle_exiled_variable_during_element_reparenting"><span class="tocnumber">3.1</span> <span class="toctext">ParseBlock should handle exiled variable during element reparenting</span></a>
</li>
<li class="toclevel-2 tocsection-5">
<a href="#Do_not_trim_empty_block_element_if_it_has_attributes"><span class="tocnumber">3.2</span> <span class="toctext">Do not trim empty block element if it has attributes</span></a>
</li>
<li class="toclevel-2 tocsection-6">
<a href="#Do_not_convert_empty_.3Cp.3E_to_.3Cbr.3E"><span class="tocnumber">3.3</span> <span class="toctext">Do not convert empty &lt;p&gt; to &lt;br&gt;</span></a>
</li>
<li class="toclevel-2 tocsection-7">
<a href="#Do_not_add_.5Cn_after_.3Cspan.3E_in_.3Cpre.3E"><span class="tocnumber">3.4</span> <span class="toctext">Do not add \n after &lt;span&gt; in &lt;pre&gt;</span></a>
</li>
</ul>
</li>
</ul>
</div>
<h2>
<span class="mw-headline" id="Source">Source</span>
</h2>
<p>
The jtidy_xowa.jar was built using the source at <a href="https://sourceforge.net/projects/jtidy/files/JTidy/r938/" rel="nofollow" class="external free">https://sourceforge.net/projects/jtidy/files/JTidy/r938/</a>.
</p>
<p>
Its source is not currently included with XOWA. It is available at the following location: <a href="https://sourceforge.net/projects/xowa/files/support/jtidy/" rel="nofollow" class="external free">https://sourceforge.net/projects/xowa/files/support/jtidy/</a>
</p>
<p>
<br>
</p>
<h2>
<span class="mw-headline" id="Modifications">Modifications</span>
</h2>
<p>
The jtidy_xowa.jar was created for the following reasons:
</p>
<ul>
<li>
JTidy is not completely in sync with tidy:
</li>
</ul>
<dl>
<dd>
JTidy appears to have been built off an earlier version of tidy. tidy has since made a number of bug fixes that are not in JTidy
</dd>
</dl>
<ul>
<li>
JTidy has significant differences in translating tidy
</li>
</ul>
<dl>
<dd>
JTidy is a very close translation of tidy, but deviates from tidy in a number of places.
</dd>
</dl>
<p>
<br>
</p>
<h2>
<span class="mw-headline" id="jtidy_xowa_changes">jtidy_xowa changes</span>
</h2>
<p>
The following is only a partial list of JTidy changes. Multiple changes were made for v1.6.2.1 of XOWA to have JTidy be more "tidy-like". In addition, more changes will probably occur in the future to close the gap in source code between tidy and JTidy.
</p>
<h3>
<span class="mw-headline" id="ParseBlock_should_handle_exiled_variable_during_element_reparenting">ParseBlock should handle exiled variable during element reparenting</span>
</h3>
<ul>
<li>
<b>purpose</b>: &lt;div&gt; between &lt;table&gt; and &lt;tr&gt; not reparented correctly;
</li>
<li>
<b>example</b>: fa.wikinews.org/wiki/Main_Page -&gt; invalid table layout
</li>
<li>
<b>file</b>: /jtidy-r938/src/main/java/org/w3c/tidy/ParserImpl.java
</li>
<li>
<b>proc</b>: ParseBlock.Parse
</li>
<li>
<b>add</b>:
</li>
</ul>
<pre>
else if ((node.tag.model &amp; Dict.CM_TABLE) != 0 || (node.tag.model &amp; Dict.CM_ROW) != 0)
{
// XOWA: DATE:2014-05-31
/* http://tidy.sf.net/issue/1316307 */
/* In exiled mode, return so table processing can
continue. */
if (lexer.exiled)
return;
</pre>
<p>
<br>
</p>
<h3>
<span class="mw-headline" id="Do_not_trim_empty_block_element_if_it_has_attributes">Do not trim empty block element if it has attributes</span>
</h3>
<ul>
<li>
<b>purpose</b>: empty block elements should not be trimmed if they have attributes
</li>
<li>
<b>example</b>: ko.wikisource.org/wiki/Main_Page -&gt; invalid table layout
</li>
<li>
<b>file</b>: /jtidy-r938/src/main/java/org/w3c/tidy/Lexer.java
</li>
<li>
<b>proc</b>: canPrune
</li>
<li>
<b>add</b>:
</li>
</ul>
<pre>
// XOWA: added to match tidy; DATE:2014-05-31
if ( ((element.tag.model &amp; Dict.CM_BLOCK) != 0) &amp;&amp; element.attributes != null)
return false;
if (element.tag == this.configuration.tt.tagA &amp;&amp; element.attributes != null)
</pre>
<p>
<br>
</p>
<h3>
<span class="mw-headline" id="Do_not_convert_empty_.3Cp.3E_to_.3Cbr.3E">Do not convert empty &lt;p&gt; to &lt;br&gt;</span>
</h3>
<ul>
<li>
<b>purpose</b>: commented code to convert empty &lt;p&gt; to &lt;br&gt; because it is not in tidy
</li>
<li>
<b>example</b>: none
</li>
<li>
<b>file</b>: /jtidy-r938/src/main/java/org/w3c/tidy/Node.java
</li>
<li>
<b>proc</b>: trimEmptyElement
</li>
<li>
<b>code</b>:
</li>
</ul>
<pre>
// XOWA: DELETED: not in tidy, and don't really agree with intent; DATE:2014-05-31
// else if (element.tag == tt.tagP &amp;&amp; element.content == null)
// {
// // replace &lt;p&gt;&lt;/p&gt; by &lt;br&gt;&lt;br&gt; to preserve formatting
// Node node = lexer.inferredTag("br");
// Node.coerceNode(lexer, element, tt.tagBr);
// element.insertNodeAfterElement(node);
// }
</pre>
<p>
<br>
</p>
<h3>
<span class="mw-headline" id="Do_not_add_.5Cn_after_.3Cspan.3E_in_.3Cpre.3E">Do not add \n after &lt;span&gt; in &lt;pre&gt;</span>
</h3>
<ul>
<li>
<b>purpose</b>: JTidy was incorrectly adding \n to all block elements inside pre
</li>
<li>
<b>example</b>: none
</li>
<li>
<b>file</b>: /jtidy-r938/src/main/java/org/w3c/tidy/PPrint.java
</li>
<li>
<b>proc</b>: printTag
</li>
<li>
<b>code</b>:
</li>
</ul>
<pre>
if (indent + linelen &lt; this.configuration.wraplen)
{
// wrap after start tag if is &lt;br/&gt; or if it's not inline
// fix for [514348]
if (!TidyUtils.toBoolean(mode &amp; NOWRAP)
&amp;&amp; (!TidyUtils.toBoolean(node.tag.model &amp; Dict.CM_INLINE) || (node.tag == tt.tagBr))
&amp;&amp; afterSpace(node))
{
wraphere = linelen;
}
}
// XOWA: DATE:2014-06-01
/* flush the current buffer only if it is known to be safe,
i.e. it will not introduce some spurious white spaces.
See bug #996484 */
else if ( TidyUtils.toBoolean(mode &amp; NOWRAP)
|| node.tag == tt.tagBr
|| afterSpace(node)
)
{
condFlushLine(fout, indent);
}
</pre>
</div>
</div>
</div>
<div id="mw-head" class="noprint">
<div id="left-navigation">
<div id="p-namespaces" class="vectorTabs">
<h3>Namespaces</h3>
<ul>
<li id="ca-nstab-main" class="selected"><span><a id="ca-nstab-main-href" href="index.html">Page</a></span></li>
</ul>
</div>
</div>
</div>
<div id='mw-panel' class='noprint'>
<div id='p-logo'>
<a style="background-image: url(https://gnosygnu.github.io/xowa/xowa_logo.png);" href="http://xowa.org/" title="Visit the main page"></a>
</div>
<div class="portal" id='xowa-portal-home'>
<h3>XOWA</h3>
<div class="body">
<ul>
<li><a href="http://xowa.org/index.html" title='Visit the main page'>Main page</a></li>
<li><a href="http://xowa.org/screenshots.html" title='See screenshots of XOWA'>Screenshots</a></li>
<li><a href="https://www.youtube.com/watch?v=q0qbXYXEH6M" title="See a video of XOWA Desktop in action">Video</a></li>
<li><a href="http://xowa.org/home/wiki/Help/Download_XOWA.html" title='Download the XOWA application'>Download XOWA</a></li>
<li><a href="http://xowa.org/home/wiki/Dashboard/Image_databases.html" title='Download offline wikis and image databases'>Download wikis</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-started'>
<h3>Getting started</h3>
<div class="body">
<ul>
<li><a href="http://xowa.org/home/wiki/App/Setup/System_requirements.html" title='Get XOWA&apos;s system requirements'>Requirements</a></li>
<li><a href="http://xowa.org/home/wiki/App/Setup/Installation.html" title='Get instructions for installing XOWA'>Installation</a></li>
<li><a href="http://xowa.org/home/wiki/App/Import/Simple_Wikipedia.html" title='Learn how to set up Simple Wikipedia'>Simple Wikipedia</a></li>
<li><a href="http://xowa.org/home/wiki/App/Import/English_Wikipedia.html" title='Learn how to set up English Wikipedia'>English Wikipedia</a></li>
<li><a href="http://xowa.org/home/wiki/App/Import/Other_wikis.html" title='Learn how to set up other Wikipedias'>Other Wikipedias</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-android'>
<h3>Android</h3>
<div class="body">
<ul>
<li><a href="http://xowa.org/home/wiki/Android/Setup.html" title='Setup XOWA on your Android device'>Setup</a></li>
<li><a href="https://www.youtube.com/watch?v=jsMTBxGweUw" title="See a video of XOWA Android in action">Video</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-help'>
<h3>Help</h3>
<div class="body">
<ul>
<li><a href="http://xowa.org/home/wiki/Help/About.html" title='Get more information about XOWA'>About</a></li>
<li><a href="http://xowa.org/home/wiki/Help/Contents.html" title='View a list of help topics'>Contents</a></li>
<li><a href="http://xowa.org/home/wiki/Help/Media.html" title='Read what others have written about XOWA'>Media</a></li>
<li><a href="http://xowa.org/home/wiki/Help/Feedback.html" title='Questions? Comments? Leave feedback for XOWA'>Feedback</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-blog'>
<h3>Blog</h3>
<div class="body">
<ul>
<li><a href="http://xowa.org/home/wiki/Blog.html" title='Follow XOWA''s development process'>Current</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-links'>
<h3>Links</h3>
<div class="body">
<ul>
<li><a href="http://dumps.wikimedia.org/backup-index.html" title="Get wiki datababase dumps directly from Wikimedia">Wikimedia dumps</a></li>
<li><a href="https://archive.org/search.php?query=xowa" title="Search archive.org for XOWA files">XOWA @ archive.org</a></li>
<li><a href="http://en.wikipedia.org" title="Visit Wikipedia (and compare to XOWA!)">English Wikipedia</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-donate'>
<h3>Donate</h3>
<div class="body">
<ul>
<li><a href="https://archive.org/donate/index.php" title="Support archive.org!">archive.org</a></li><!-- listed first due to recent fire damages: http://blog.archive.org/2013/11/06/scanning-center-fire-please-help-rebuild/ -->
<li><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector" title="Support Wikipedia!">Wikipedia</a></li>
<li><a href="http://xowa.org/home/wiki/Help/Donate.html" title="Support XOWA!">XOWA</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>