Fixes #183 - Preserve list items.

pull/191/head
Nicolas Perriault 9 years ago
parent 5912e0c872
commit 44879722b6

@ -1598,6 +1598,7 @@ Readability.prototype = {
var tagsList = e.getElementsByTagName(tag);
var curTagsLength = tagsList.length;
var isList = tag === "ul" || tag === "ol";
// Gather counts for other typical elements embedded within.
// Traverse backwards so we can remove nodes at the same time
@ -1633,13 +1634,13 @@ Readability.prototype = {
var toRemove = false;
if (img > p && !this._hasAncestorTag(tagsList[i], "figure")) {
toRemove = true;
} else if (li > p && tag !== "ul" && tag !== "ol") {
} else if (!isList && li > p) {
toRemove = true;
} else if ( input > Math.floor(p/3) ) {
} else if (input > Math.floor(p/3)) {
toRemove = true;
} else if (contentLength < 25 && (img === 0 || img > 2) ) {
} else if (!isList && contentLength < 25 && (img === 0 || img > 2)) {
toRemove = true;
} else if (weight < 25 && linkDensity > 0.2) {
} else if (!isList && weight < 25 && linkDensity > 0.2) {
toRemove = true;
} else if (weight >= 25 && linkDensity > 0.5) {
toRemove = true;

@ -288,6 +288,14 @@ apiCall.<span>then</span><span>(</span><span>function</span><span>(</span>respon
<h2>Dealing with bodies</h2>
<p>Both Requests and Responses may contain body data. Weve been glossing over it because of the various data types body may contain, but we will cover it in detail now.</p>
<p>A body is an instance of any of the following types.</p>
<ul>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer">ArrayBuffer</a> </li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView">ArrayBufferView</a> (Uint8Array and friends)</li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>/ <a href="https://developer.mozilla.org/en-US/docs/Web/API/File">File</a> </li>
<li>string</li>
<li><a href="https://url.spec.whatwg.org/#interface-urlsearchparams">URLSearchParams</a> </li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/FormData">FormData</a> currently not supported by either Gecko or Blink. Firefox expects to ship this in version 39 along with the rest of Fetch.</li>
</ul>
<p>In addition, Request and Response both offer the following methods to extract their body. These all return a Promise that is eventually resolved with the actual content.</p>
<ul>
<li><code>arrayBuffer()</code> </li>

@ -0,0 +1,6 @@
{
"title": "Daring Fireball: Colophon",
"byline": null,
"excerpt": "Daring Fireball is written and produced by John Gruber.",
"readerable": true
}

@ -0,0 +1,31 @@
<div id="readability-page-1" class="page">
<div class="article">
<p>Daring Fireball is written and produced by John Gruber.</p>
<p>
<a href="http://fakehost/graphics/author/addison-bw.jpg"> <img src="http://fakehost/graphics/author/addison-bw-425.jpg" alt="Photograph of the author."></a>
<br><em>Portrait by <a href="http://superbiate.com/inquiries/">George Del Barrio</a></em> </p>
<h2>Mac Apps</h2>
<ul>
<li><a href="http://www.barebones.com/products/bbedit/">BBEdit</a></li>
<li><a href="http://www.flyingmeat.com/acorn/">Acorn</a></li>
<li><a href="http://www.red-sweater.com/marsedit/">MarsEdit</a></li>
<li><a href="http://aged-and-distilled.com/napkin/">Napkin</a></li>
<li><a href="http://www.barebones.com/products/Yojimbo/">Yojimbo</a></li>
<li><a href="http://www.panic.com/transmit/">Transmit</a></li>
<li><a href="http://latenightsw.com/sd4/index.html">Script Debugger</a></li>
<li><a href="http://www.ambrosiasw.com/utilities/snapzprox/">Snapz Pro X</a></li>
<li><a href="http://nightly.webkit.org/">WebKit</a></li>
</ul>
<h2>iPhone Apps</h2>
<ul>
<li><a href="http://vesperapp.co/">Vesper</a></li>
</ul>
<h2>Server Software</h2>
<p>The Daring Fireball website is hosted by <a href="http://joyent.com/">Joyent</a>.</p>
<p>Articles and links are published through <a href="http://movabletype.org/">Movable Type</a>. In addition to my own SmartyPants and Markdown plug-ins, Daring Fireball uses several excellent Movable Type plug-ins, including Brad Choates <a href="http://bradchoate.com/weblog/2003/06/24/regular-expressions">MT-Regex</a> and <a href="http://bradchoate.com/weblog/2004/10/20/mtifempty">MT-IfEmpty</a>, and <a href="http://bumppo.net/projects/amputator/">Nat Ironss Amputator</a>.</p>
<p>Stats are tracked using <a href="http://haveamint.com/">Mint</a>. Additional web nerdery, including the membership system, is fueled by <a href="http://perl.org/">Perl</a>, <a href="http://www.php.net/">PHP</a>, and <a href="http://www.mysql.com/">MySQL</a>.</p>
<h2>Web Standards</h2>
<p>Web standards are important, and Daring Fireball adheres to them. Specifically, Daring Fireballs HTML markup should validate as either <a href="http://www.whatwg.org/specs/web-apps/current-work/">HTML 5</a> or XHTML 4.01 Transitional, its layout is constructed using <a href="http://jigsaw.w3.org/css-validator/validator?uri=http://daringfireball.net/css/fireball_screen.css">valid CSS</a>, and its syndicated feed is <a href="http://feedvalidator.org/check?url=http%3A%2F%2Fdaringfireball.net%2Findex.xml">valid Atom</a>.</p>
<p>If Daring Fireball looks goofy in your browser, youre likely using a shitty browser that doesnt support web standards. Internet Explorer, Im looking in your direction. If you complain about this, I will laugh at you, because I do not care. If, however, you are using a modern, standards-compliant browser and have trouble viewing or reading Daring Fireball, please do let me know.</p>
</div>
</div>

@ -0,0 +1,151 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Daring Fireball: Colophon</title>
<meta name="viewport" content="width=600, initial-scale=0.5, minimum-scale=0.45">
<link rel="apple-touch-icon-precomposed" href="/graphics/apple-touch-icon.png">
<link rel="shortcut icon" href="/graphics/favicon.ico?v=005">
<link rel="stylesheet" type="text/css" media="screen" href="/css/fireball_screen.css?v1.6">
<link rel="stylesheet" type="text/css" media="screen" href="/css/ie_sucks.php">
<link rel="stylesheet" type="text/css" media="print" href="/css/fireball_print.css?v01">
<link rel="alternate" type="application/atom+xml" href="/feeds/main">
<script src="/js/js-global/FancyZoom.js" type="text/javascript"></script>
<script src="/js/js-global/FancyZoomHTML.js" type="text/javascript"></script>
<link rel="shortcut icon" href="/favicon.ico"> </head>
<body onload="setupZoom()">
<div id="Box">
<div id="Banner">
<a href="/" title="Daring Fireball: Home"><img src="/graphics/logos/" alt="Daring Fireball" height="56"></a>
</div>
<div id="Sidebar">
<p>By <strong>John&nbsp;Gruber</strong></p>
<ul>
<!--&#9733;-->
<li><a href="/archive/" title="Previous articles.">Archive</a></li>
<li>
<script type="text/javascript">
// <![CDATA[
function ReadCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
var display_linked_list = ReadCookie('displayLinkedList');
var li_linked = '<a href="/linked/" title="The Linked List.">Linked List<\/a>';
if (display_linked_list == "hide") {
// Linked List is off on home page, so show it in menu:
document.write(li_linked + "<\/li>\n<li>");
} else {
// Default to not putting separate LL item in sidebar:
}
// ]]>
</script>
</li>
<li><a href="/thetalkshow/" title="The worlds most popular podcast.">The Talk Show</a></li>
<li><a href="http://vesperapp.co/" title="A simple, elegant iOS app for collecting notes, ideas, thoughts, and images.">Vesper: <em>Now for iPad</em></a></li>
<li><a href="/projects/" title="Software projects, including SmartyPants and Markdown.">Projects</a></li>
<li><a href="/contact/" title="How to send email regarding Daring Fireball.">Contact</a></li>
<li><a href="/colophon/" title="About this site and the tools used to produce it.">Colophon</a></li>
<li><a href="/feeds/">RSS Feed</a></li>
<li><a href="https://twitter.com/daringfireball">Twitter</a></li>
<li><a href="/feeds/sponsors/">Sponsorship</a></li>
</ul>
</div>
<!-- Sidebar -->
<div id="Main">
<div class="article">
<h1>About This Site</h1>
<p>Daring Fireball is written and produced by John Gruber.</p>
<p>
<a href="/graphics/author/addison-bw.jpg"> <img src="/graphics/author/addison-bw-425.jpg" alt="Photograph of the author." style="border: 0;"></a>
<br><em>Portrait by <a href="http://superbiate.com/inquiries/">George Del Barrio</a></em> </p>
<h2>Mac Apps</h2>
<ul>
<li><a href="http://www.barebones.com/products/bbedit/">BBEdit</a></li>
<li><a href="http://www.flyingmeat.com/acorn/">Acorn</a></li>
<li><a href="http://www.red-sweater.com/marsedit/">MarsEdit</a></li>
<li><a href="http://aged-and-distilled.com/napkin/">Napkin</a></li>
<li><a href="http://www.barebones.com/products/Yojimbo/">Yojimbo</a></li>
<li><a href="http://www.panic.com/transmit/">Transmit</a></li>
<li><a href="http://latenightsw.com/sd4/index.html">Script Debugger</a></li>
<li><a href="http://www.ambrosiasw.com/utilities/snapzprox/">Snapz Pro X</a></li>
<li><a href="http://nightly.webkit.org/">WebKit</a></li>
</ul>
<h2>iPhone Apps</h2>
<ul>
<li><a href="http://vesperapp.co/">Vesper</a></li>
</ul>
<h2>Server Software</h2>
<p>The Daring Fireball website is hosted by <a href="http://joyent.com/">Joyent</a>.</p>
<p>Articles and links are published through <a href="http://movabletype.org/">Movable Type</a>. In addition to my own SmartyPants and Markdown plug-ins, Daring Fireball uses several excellent Movable Type plug-ins, including Brad Choates <a href="http://bradchoate.com/weblog/2003/06/24/regular-expressions">MT-Regex</a> and <a href="http://bradchoate.com/weblog/2004/10/20/mtifempty">MT-IfEmpty</a>, and <a href="http://bumppo.net/projects/amputator/">Nat Ironss Amputator</a>.</p>
<p>Stats are tracked using <a href="http://haveamint.com/">Mint</a>. Additional web nerdery, including the membership system, is fueled by <a href="http://perl.org/">Perl</a>, <a href="http://www.php.net/">PHP</a>, and <a href="http://www.mysql.com/">MySQL</a>.</p>
<h2>Web Standards</h2>
<p>Web standards are important, and Daring Fireball adheres to them. Specifically, Daring Fireballs HTML markup should validate as either <a href="http://www.whatwg.org/specs/web-apps/current-work/">HTML 5</a> or XHTML 4.01 Transitional, its layout is constructed using <a href="http://jigsaw.w3.org/css-validator/validator?uri=http://daringfireball.net/css/fireball_screen.css">valid CSS</a>, and its syndicated feed is <a href="http://feedvalidator.org/check?url=http%3A%2F%2Fdaringfireball.net%2Findex.xml">valid Atom</a>.</p>
<p>If Daring Fireball looks goofy in your browser, youre likely using a shitty browser that doesnt support web standards. Internet Explorer, Im looking in your direction. If you complain about this, I will laugh at you, because I do not care. If, however, you are using a modern, standards-compliant browser and have trouble viewing or reading Daring Fireball, please do let me know.</p>
</div>
<!-- article -->
<div id="Footer">
<form id="SiteSearch" action="https://daringfireball.net/search" method="get" style="margin-bottom: 2.5em;">
<div>
<input name="q" type="text" value="" style="margin-right: 8px; width: 66%;">
<input type="submit" value="Search"> </div>
</form>
<p class="smallprint"> <a href="/preferences/" title="Customize the font size and presentation options for this web site.">Display Preferences</a>
<br>
<br> Copyright © 20022015 The Daring Fireball Company LLC. </p>
</div>
<div id="SidebarTheDeck">
<script type="text/javascript">
// <![CDATA[
(function(id) {
document.write('<script type="text/javascript" src="' + '//connect.decknetwork.net/deck' + id + '_js.php?' + (new Date().getTime()) + '"></' + 'script>');
})("DF");
var deckDiv = document.getElementById("SidebarTheDeck");
var sidebarDiv = document.getElementById("Sidebar");
sidebarDiv.appendChild(deckDiv);
// ]]>
</script>
<p id="ViaTheDeck">
<a href="http://decknetwork.net/"> <img src="//daringfireball.net/graphics/madison/via_the_deck.png" alt="Ads via The Deck" class="the_deck_promo" width="70"> <span>Ads via The Deck</span> </a>
</p>
</div>
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-593949-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- Asynchronously load Mint -->
<script type="text/javascript">
(function() {
var ma = document.createElement('script');
ma.type = 'text/javascript';
ma.src = '/mint/?js';
ma.async = true;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ma, s);
})();
</script>
</div>
<!-- Main -->
</div>
<!-- box -->
</body>
</html>

@ -19,6 +19,37 @@
<p> Developer Edition comes with a new profile so you can run it alongside other versions of Firefox. To access your bookmarks, browsing history and more, you need to sync the profile with your existing Firefox Account, or create a new one. <a href="https://support.mozilla.org/kb/recover-lost-bookmarks-firefox-developer-edition" rel="external" class="more">Learn more</a> </p>
</div>
</section>
<section class="more-features"> </section>
<section class="more-features">
<div class="container">
<header>
<h2>Features and tools</h2> </header>
<ul class="features">
<li class="feature">
<a href="https://www.youtube.com/watch?v=eQqNfkqIJdw" rel="external" class="video-play"> <img src="http://mozorg.cdn.mozilla.net/media/img/firefox/firstrun/dev/feature-inspector.c791bf1f1a59.jpg" alt="Screenshot" class="screenshot"> </a>
<h2>Page Inspector</h2>
<p>Examine the HTML and CSS of any Web page and easily modify the structure and layout of a page.</p> <a href="https://developer.mozilla.org/docs/Tools/Page_Inspector" rel="external" class="more">Learn more about Page Inspector</a> </li>
<li class="feature">
<a href="https://www.youtube.com/watch?v=iEDk8o9ehlw" rel="external" class="video-play"> <img src="http://mozorg.cdn.mozilla.net/media/img/firefox/firstrun/dev/feature-console.42666aaf6d03.jpg" alt="Screenshot" class="screenshot"> </a>
<h2>Web Console</h2>
<p>See logged information associated with a Web page and use Web Console to interact with Web pages using JavaScript.</p> <a href="https://developer.mozilla.org/docs/Tools/Web_Console" rel="external" class="more">Learn more about Web Console</a> </li>
<li class="feature">
<a href="https://www.youtube.com/watch?v=OS4AxYFLCIE" rel="external" class="video-play"> <img src="http://mozorg.cdn.mozilla.net/media/img/firefox/firstrun/dev/feature-debugger.02ed86fb0c9f.jpg" alt="Screenshot" class="screenshot"> </a>
<h2>JavaScript Debugger</h2>
<p>Step through JavaScript code and examine or modify its state to help track down bugs.</p> <a href="https://developer.mozilla.org/docs/Tools/Debugger" rel="external" class="more">Learn more about JavaScript Debugger</a> </li>
<li class="feature">
<a href="https://www.youtube.com/watch?v=w4zSG53Qlbk" rel="external" class="video-play"> <img src="http://mozorg.cdn.mozilla.net/media/img/firefox/firstrun/dev/feature-network.740d6082b3f6.jpg" alt="Screenshot" class="screenshot"> </a>
<h2>Network Monitor</h2>
<p>See all the network requests your browser makes, how long each request takes and details of each request.</p> <a href="https://developer.mozilla.org/docs/Tools/Network_Monitor" rel="external" class="more">Learn more about Network Monitor</a> </li>
<li class="feature">
<a href="https://www.youtube.com/watch?v=R_qDaLQ8ghg" rel="external" class="video-play"> <img src="http://mozorg.cdn.mozilla.net/media/img/firefox/firstrun/dev/feature-webaudio.a10ebc48d017.jpg" alt="Screenshot" class="screenshot"> </a>
<h2>Web Audio Editor</h2>
<p>Inspect and interact with Web Audio API in real time to ensure that all audio nodes are connected in the way you expect.</p> <a href="https://developer.mozilla.org/docs/Tools/Web_Audio_Editor" rel="external" class="more">Learn more about Web Audio Editor</a> </li>
<li class="feature">
<a href="https://www.youtube.com/watch?v=3kdBvvIZIqU" rel="external" class="video-play"> <img src="http://mozorg.cdn.mozilla.net/media/img/firefox/firstrun/dev/feature-style-editor.87c5d2017506.jpg" alt="Screenshot" class="screenshot"> </a>
<h2>Style Editor</h2>
<p>View and edit CSS styles associated with a Web page, create new ones and apply existing CSS stylesheets to any page.</p> <a href="https://developer.mozilla.org/docs/Tools/Style_Editor" rel="external" class="more">Learn more about Style Editor</a> </li>
</ul>
</div>
</section>
</div>
</div>
Loading…
Cancel
Save