<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Notes Log &#187; HTML</title>
	<atom:link href="http://noteslog.com/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://noteslog.com</link>
	<description></description>
	<lastBuildDate>Wed, 08 Sep 2010 06:56:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to show a slow loading page</title>
		<link>http://noteslog.com/post/how-to-show-a-slow-loading-page/</link>
		<comments>http://noteslog.com/post/how-to-show-a-slow-loading-page/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 22:52:59 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Fixing]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=343</guid>
		<description><![CDATA[Problem &#8211; Slow loading pages are frustrating, for web users and developers too. Of course there are many possible tweaks you can use to speed them up, but sometimes you cannot optimize a page any further. UPDATED 2009-10-11 Solution &#8211; If you can&#8217;t beat them, join them. You can show a progress indicator to let your [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong> &#8211; Slow loading pages are frustrating, for web users and developers too. Of course there are many possible tweaks you can use to speed them up, but sometimes you cannot optimize a page any further.</p>
<ul>
<li>UPDATED 2009-10-11</li>
</ul>
<p><span id="more-343"></span></p>
<p><strong>Solution</strong> &#8211; If you can&#8217;t beat them, join them. You can show a progress indicator to let your web users know that your server is thinking hard the answer to their request, but how do you do that?</p>
<p><strong>Requirement 1</strong> &#8211; You cannot put the progress indicator on the leaving page, because you don&#8217;t want to modify every single reference to a slow page. It doesn&#8217;t make sense either: a slow page is slow by itself! You really don&#8217;t need that coupling.</p>
<p><strong>Requirement 2</strong> - You cannot put the progress indicator on the landing page, the slow one, because the browser needs it before the slow page has arrived. If they arrive together, the progress indicator is useless!</p>
<p>There is a <a href="http://www.aspnetpro.com/NewsletterArticle/2003/08/asp200308bm_l/asp200308bm_l.asp" target="_blank">good article</a> about this issue but it fails at implementing the first requirement. Anyway that was the idea I worked on when starting this project.</p>
<p>Here is the waiting page that get&#8217;s loaded while loading the slow page. For browsers other than IE, the trick is to change the document.location.href property after loading the <a href="http://ajaxload.info/" target="_blank">progress indicator</a> image. In IE we change the document.location.href and then add the image.</p>
<p>I used jQuery to make it simple.</p>
<p><strong>waiting.php</strong></p>
<p><pre class="chili-all"><code class="html">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xml:lang=&quot;en&quot; lang=&quot;en&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;head&gt;

&lt;title&gt;Loading Page...&lt;/title&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;</code><code class="javascript">
jQuery( function( $ ) {
	function redirect() {
		$('form').submit();
	}
	
	if($.browser.msie) {
		redirect();
		$('img').appendTo('body').attr('src', 'loading-page.gif');
	} else {
		$('#loading').bind('load', function() {
	        redirect();
	    }).attr('src', 'loading-page.gif');
	}
} );
</code><code class="html">&lt;/script&gt;

&lt;/head&gt;&lt;body&gt;

&lt;h1&gt;Loading Page...&lt;/h1&gt;
&lt;img id=&quot;loading&quot; /&gt;
&lt;form method=&quot;&lt;?php </code><code class="php">echo $method </code><code class="html">?&gt;&quot; action=&quot;&lt;?php </code><code class="php">echo $url </code><code class="html">?&gt;&quot;&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;waiting&quot; value=&quot;&lt;?php </code><code class="php">echo $waiting </code><code class="html">?&gt;&quot; /&gt;
&lt;/form&gt;

&lt;/body&gt;&lt;/html&gt;</code></pre>


</p>
<p>And here is the slow page.</p>
<p><strong>slow-page.php</strong></p>
<p><pre class="chili-all"><code class="html">&lt;?php
</code><code class="php">
if ( ! isset($_REQUEST['waiting']) ) {
    $url = htmlspecialchars( $_SERVER['REQUEST_URI'] );
	$method = $_SERVER['REQUEST_METHOD'];
	$waiting = time();
	include &quot;waiting.php&quot;;
    return;
}

sleep(10); //simulate a slow task

</code><code class="html">?&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xml:lang=&quot;en&quot; lang=&quot;en&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;head&gt;
 &lt;title&gt;Slow Page&lt;/title&gt;
&lt;/head&gt;&lt;body&gt;
 &lt;h1&gt;Hello World!&lt;/h1&gt;
&lt;/body&gt;&lt;/html&gt;</code></pre>


</p>
<p>You can test it <a href="http://noteslog.com/personal/projects/page-loading/3/slow-page.php" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/how-to-show-a-slow-loading-page/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Metaobjects 1.5 Released</title>
		<link>http://noteslog.com/post/metaobjects-15-released/</link>
		<comments>http://noteslog.com/post/metaobjects-15-released/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 22:10:23 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Metaobjects]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://noteslog.com/post/metaobjects-15-released/</guid>
		<description><![CDATA[Changes Added support for easy namespacing Added support for jQuery 1.2.3 cache Rewritten the manual from scratch Download You can download metaobjects from Google Code]]></description>
			<content:encoded><![CDATA[<h5>Changes</h5>
<ul>
<li>Added support for easy namespacing</li>
<li>Added support for jQuery 1.2.3 cache</li>
<li>Rewritten the <a href="metaobjects">manual</a> from scratch</li>
</ul>
<h5>Download</h5>
<p>You can <a href="http://code.google.com/p/jquery-metaobjects-js/" target="_blank">download metaobjects</a> from Google Code</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/metaobjects-15-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Share Source Code using Chili in IE</title>
		<link>http://noteslog.com/post/how-to-share-source-code-using-chili-in-ie/</link>
		<comments>http://noteslog.com/post/how-to-share-source-code-using-chili-in-ie/#comments</comments>
		<pubDate>Thu, 22 Feb 2007 10:14:03 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[Metaobjects]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=146</guid>
		<description><![CDATA[I&#8217;ve recently realized that copying to the clipboardÂ a snippet highlighted by Chili works differently in Internet Explorer (IE)Â and in Mozilla Firefox (FF). They both copy two versions of the selected section: TEXT and HTML. IE TEXT HTML entities resolved HTML stripped off result copied FF TEXT HTML entities resolved BR elements replaced by new lines [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently realized that copying to the clipboardÂ a snippet highlighted by Chili works differently in Internet Explorer (IE)Â and in Mozilla Firefox (FF). They both copy two versions of the selected section: TEXT and HTML.</p>
<dl>
<dt>IE TEXT</dt>
<dd>HTML entities resolved<br />
HTML stripped off</dd>
<dd>result copied</dd>
<dt>FF TEXT</dt>
<dd>HTML entities resolved<br />
BR elements replaced by new lines<br />
HTML stripped off</dd>
<dd>result copied</dd>
<dt>IE HTML</dt>
<dd>HEAD element copied<br />
containment path elements copied<br />
selected text with HTML in place copied</dd>
<dt>FF HTML</dt>
<dd>selected text with HTML in place copied</dd>
</dl>
<p>The net result of all this is that IE does the right thing with HTML while FF does the right thing with TEXT, and neither is completely right or wrong.</p>
<ul>
<li>copying from IE to Notepad you getÂ an awful long line, but copying to Word you get all wonderfully colored</li>
<li>copying from FF to Notepad you getÂ aÂ properly formattedÂ section, but copying to Word you get all sadly monochromatic</li>
</ul>
<p><font color="#ff0000">UPDATE (2007/02/24): What follows is obsolete, because I&#8217;ve implemented a transparent methodÂ in Chili 1.7</font></p>
<p>In Chili 1.6 I&#8217;ve implemented aÂ workaround for IE, so that IE TEXT isÂ like FF TEXT. It&#8217;s a workaround because you need to add a button to each highlighted section, and it will copy all the text in that section when clicked.</p>
<p>The button can be as simple as a DIV placed before the PRE, likeÂ this: <div class="ie_copy" title="copy this snippet to the clipboard">
copy all
</div>
<pre><code class="javascript">
alert( "Hello World!" );
</code></pre></p>
<p>Chili will hideÂ any element with a class <u>ie_copy</u> in any browser but IE, where insteadÂ it willÂ associate a click handler to it,Â forÂ copying all the next PRE content as a properly formatted section. You can style the button element as you like, because Chili uses the class onlyÂ forÂ accessing the element.</p>
<p>You can alsoÂ place the button wherever you like. If so, i.e. if the button element is not the element preceding the PRE section, then you have to feed Chili the method for getting the PRE content. You can do it globally or locally.</p>
<p>When Chili associates the handler to the button, it will look for a <u>getPRE</u> method inside the button element. If there is one, then it will be used, else Chili will look for a <u>getPRE</u> method inside the global ChiliBook object. If there is one, then it will be used, else Chili will give up and not associate a handler.</p>
<p>You can change the global behavior by changing the declaration of the <u>getPRE</u> method inside the ChiliBook object, and you can change the local behavior by adding a <u>chili</u> metaobject (an object with aÂ class <u>chili</u>)Â inside the button element, with a <u>getPRE</u>Â param whose value isÂ the function declaration.</p>
<p>The <u>getPRE</u> function shipped with Chili 1.6 is the following, where theÂ button element is passedÂ intoÂ <u>this</u>Â and the PRE destination is found starting fromÂ that origin:</p>
<p>function() { return $( this ).next( "pre" )[0]; }</p>
<p>A button element after the PRE element could then be locally configured like this: <pre><code class="javascript">
alert( "Hello World!" );
</code></pre>
<div class="ie_copy" title="copy this snippet to the clipboard">
<object class="chili">
	<param name="getPRE" value="function() { return $( this ).prev( 'pre' )[0]; }"/>
</object>
copy all
</div></p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/how-to-share-source-code-using-chili-in-ie/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Highlight Mixed Language Source Code</title>
		<link>http://noteslog.com/post/mixed-language-snippets/</link>
		<comments>http://noteslog.com/post/mixed-language-snippets/#comments</comments>
		<pubDate>Fri, 16 Feb 2007 15:35:29 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[Enzymes]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=143</guid>
		<description><![CDATA[Web pages contain many snippets from different languages, like HTML, PHP, CSS, and JavaScript. Chili 1.x cannot highlight mixed language source code automatically, but the forthcoming released Chili 2.0 will be is able to do that. Meanwhile, if you are using a Chili + Enzymes setup, then it&#8217;s possible to write an Enzymes template capable [...]]]></description>
			<content:encoded><![CDATA[<p>Web pages contain many snippets from different languages, like HTML, PHP, CSS, and JavaScript. Chili 1.x cannot highlight mixed language source code automatically, but the <span style="text-decoration: line-through;">forthcoming</span> released <a href="http://noteslog.com/post/chili-20-released-today/">Chili 2.0</a> <span style="text-decoration: line-through;">will be</span> is able to do that.</p>
<p>Meanwhile, if you are using a Chili + Enzymes setup, then it&#8217;s possible to write an Enzymes template capable of making Chili 1.x highlight a web page perfectly (expanding on my previous php template).</p>
<p>Here is the <span style="text-decoration: line-through;">new</span> updated (2007/02/19) <span style="text-decoration: underline;">chili-web.php</span> Enzymes template. At the moment it supports XHTML, and embedded CSS, JavaScript, and PHP snippets.</p>
<p><?php 
if( ! function_exists( 'format_code' ) ) {

	function snippet_wrap( $class, $code ) {
		return '' == $code ? '' : '<code class="'.$class.'">'.htmlentities( $code ).'</code>';
	}

	function snippet_php( $open, $code, $close ) {
		return snippet_wrap( 'html', $open ).snippet_wrap( 'php', $code ).snippet_wrap( 'html', $close );
	}

	function php_inside_html( $matches ) {
		list( $all, $before, $open, $code, $close ) = $matches;

		if( '' == $open ) 
			return snippet_wrap( 'html', $all );
		else 
			return snippet_wrap( 'html', $before ).snippet_php( $open, $code, $close );
	}

	function php_inside_css( $matches ) {
		list( $all, $before, $open, $code, $close ) = $matches;

		if( '' == $open ) 
			return snippet_wrap( 'css', $all );
		else 
			return snippet_wrap( 'css', $before ).snippet_php( $open, $code, $close );
	}

	function php_inside_javascript( $matches ) {
		list( $all, $before, $open, $code, $close ) = $matches;

		if( '' == $open ) 
			return snippet_wrap( 'javascript', $all );
		else 
			return snippet_wrap( 'javascript', $before ).snippet_php( $open, $code, $close );
	}

	function php_inside( $class, $code ) {
		return preg_replace_callback( '/(?:(.*?)(\<\?php\s)(.*?)(\?\>))|(?:.+)/si', "php_inside_$class", $code );
	}

	function snippet_web( $class, $open, $code, $close ) {
		return snippet_wrap( 'html', $open ).php_inside( $class, $code ).snippet_wrap( 'html', $close );
	}

	function format_code( $matches ) {
		list( $all, $before, $open, $tag, $code, $close ) = $matches;

		if( '' == $open ) {
			return php_inside( 'html', $all );
		}
		else {
			switch( $tag ) {
				case 'script': $class = 'javascript'; break;
				case 'style' : $class = 'css';        break;
				default      : $class = 'html';
			}
			return php_inside( 'html', $before ).snippet_web( $class, $open, $code, $close );
		}
	}

	function format_clean( $out ) {
		do {
			$len = strlen( $out );
			$out = preg_replace( '/(\<code class="(\w+)"\>[^<]*)\<\/code\>\<code class="\2"\>/is', '$1', $out );
		} while( $len != strlen( $out ) );
		return $out;
	}
}

?>
<pre class="chili-<?php 
	$tmp = preg_split( '/(?:\r?\n)+/', $this->result );
	if( count( $tmp ) > 28 ) echo 'clip';
	else echo 'all'; 
?>"><?php
	$out = preg_replace_callback( '/(?:(.*?)(\<(script|style)\b.*?\>)(.*?)(\<\/\3\>))|(?:.+)/is', 'format_code', $this->result );
	echo format_clean( $out );
?></pre></p>
<p>The WordPress file <span style="text-decoration: underline;">/wp-content /themes /default /comments-popup.php</span> is a page that uses all the supported languages, so it&#8217;s a good test for the previous template:</p>
<p><?php
/* Don't remove these lines. */
add_filter('comment_text', 'popuplinks');
while ( have_posts()) : the_post();
?>
<!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">
<head>
     <title><?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?></title>

	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
	<style type="text/css" media="screen">
		@import url( <?php bloginfo('stylesheet_url'); ?> );
		body { margin: 3px; }
	</style>

</head>
<body id="commentspopup">

<h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1>

<h2 id="comments">Comments</h2>

<p><a href="<?php echo get_option('siteurl'); ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p>

<?php if ('open' == $post->ping_status) { ?>
<p>The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em><?php trackback_url() ?></em></p>
<?php } ?>

<?php
// this line is WordPress' motor, do not delete it.
$commenter = wp_get_current_commenter();
extract($commenter);
$comments = get_approved_comments($id);
$post = get_post($id);
if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
	echo(get_the_password_form());
} else { ?>

<?php if ($comments) { ?>
<ol id="commentlist">
<?php foreach ($comments as $comment) { ?>
	<li id="comment-<?php comment_ID() ?>">
	<?php comment_text() ?>
	<p><cite><?php comment_type('Comment', 'Trackback', 'Pingback'); ?> by <?php comment_author_link() ?> â€” <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
	</li>

<?php } // end for each comment ?>
</ol>
<?php } else { // this is displayed if there are no comments so far ?>
	<p>No comments yet.</p>
<?php } ?>

<?php if ('open' == $post->comment_status) { ?>
<h2>Leave a comment</h2>
<p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p>

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
	<p>
	  <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
	   <label for="author">Name</label>
	<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
	<input type="hidden" name="redirect_to" value="<?php echo attribute_escape($_SERVER["REQUEST_URI"]); ?>" />
	</p>

	<p>
	  <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
	   <label for="email">E-mail</label>
	</p>

	<p>
	  <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
	   <label for="url"><abbr title="Universal Resource Locator">URL</abbr></label>
	</p>

	<p>
	  <label for="comment">Your Comment</label>
	<br />
	  <textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
	</p>

	<p>
	  <input name="submit" type="submit" tabindex="5" value="Say It!" />
	</p>
	<?php do_action('comment_form', $post->ID); ?>
</form>
<?php } else { // comments are closed ?>
<p>Sorry, the comment form is closed at this time.</p>
<?php }
} // end password check
?>

<div><strong><a href="javascript:window.close()">Close this window.</a></strong></div>

<?php // if you delete this the sky will fall on your head
endwhile;
?>

<!-- // this is just the end of the motor - don't touch that line either :) -->
<?php //} ?>
<p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>WordPress</strong></a></cite></p>
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
<script type="text/javascript">
<!--
document.onkeypress = function esc(e) {
	if(typeof(e) == "undefined") { e=event; }
	if (e.keyCode == 27) { self.close(); }
}
// -->
</script>
</body>
</html></p>
<p>Chili &amp; Enzymes confirm to be a perfect match.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/mixed-language-snippets/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>HTML Recipe: Tighter Values</title>
		<link>http://noteslog.com/post/html-recipe-tighter-values/</link>
		<comments>http://noteslog.com/post/html-recipe-tighter-values/#comments</comments>
		<pubDate>Fri, 16 Feb 2007 07:33:22 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=144</guid>
		<description><![CDATA[There a was a bug in the highlighting of attributes&#8217; values. The problem was that any string got highlighted, even if it wasn&#8217;t preceded by an equal sign. That&#8217;s fixed now. Also I&#8217;veÂ addedÂ the PHP&#8217;s opening and closingÂ tags. /* =============================================================================== Chili Recipe for the XHTML language ............................................................................... Version: 1.5d - 2007/02 - http://noteslog.com/chili/ ------------------------------------------------------------------------------- Copyright (c) [...]]]></description>
			<content:encoded><![CDATA[<p>There a was a bug in the highlighting of attributes&#8217; values. The problem was that any string got highlighted, even if it wasn&#8217;t preceded by an equal sign. That&#8217;s fixed now.</p>
<p>Also I&#8217;veÂ addedÂ the PHP&#8217;s opening and closingÂ tags.</p>
<p>/*
===============================================================================
Chili Recipe for the XHTML language
...............................................................................

Version: 1.5d - 2007/02 - http://noteslog.com/chili/

-------------------------------------------------------------------------------
Copyright (c) 2006 Andrea Ercolino
http://www.opensource.org/licenses/mit-license.php
===============================================================================
*/

{
    steps: {
          mlcom : { exp: /\<!--(?:.|\n)*?--\>/ }
        , tag   : { exp: /(?:\<\!?[\w:]+)|(?:\>)|(?:\<\/[\w:]+\>)|(?:\/\>)/ }
		, php   : { exp: /(?:\<\?php\s)|(?:\<\?)|(?:\?\>)/ }
        , aname : { exp: /\s+?[\w-]+:?\w+(?=\s*=)/ }
        , avalue: { 
			  exp: /(=\s*)(([\"\'])(?:(?:[^\3\\]*?(?:\3\3|\\.))*?[^\3\\]*?)\3)/
			, replacement: '$1<span class="$0">$2</span>' }
        , entity: { exp: /&[\w#]+?;/ }
    }
}</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/html-recipe-tighter-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Recipe: Name Spaces</title>
		<link>http://noteslog.com/post/name-spaces/</link>
		<comments>http://noteslog.com/post/name-spaces/#comments</comments>
		<pubDate>Thu, 15 Feb 2007 09:20:17 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=142</guid>
		<description><![CDATA[Here is the last version of the XHTML recipe, which now supports name spaces (thanks to ManfredÂ for pointingÂ out the issue) /* =============================================================================== Chili Recipe for the XHTML language ............................................................................... Version: 1.5c - 2007/02 - http://noteslog.com/chili/ ------------------------------------------------------------------------------- Copyright (c) 2006 Andrea Ercolino http://www.opensource.org/licenses/mit-license.php =============================================================================== */ { steps: { mlcom : { exp: /\]]></description>
			<content:encoded><![CDATA[<p>Here is the last version of the XHTML recipe, which now supports name spaces (thanks to <a target="_blank" href="http://www.nystedberry.info/">Manfred</a>Â for pointingÂ out the issue)</p>
<p>/*
===============================================================================
Chili Recipe for the XHTML language
...............................................................................

Version: 1.5c - 2007/02 - http://noteslog.com/chili/

-------------------------------------------------------------------------------
Copyright (c) 2006 Andrea Ercolino
http://www.opensource.org/licenses/mit-license.php
===============================================================================
*/

{
    steps: {
          mlcom : { exp: /\<!--(?:.|\n)*?--\>/ }
        , aname : { exp: /\s+?[\w-]+:?\w+(?=\s*=)/ }
        , tag   : { exp: /(?:\<\!?[\w:]+)|(?:\>)|(?:\<\/[\w:]+\>)|(?:\/\>)/ }
        , avalue: { exp: /([\"\'])(?:(?:[^\1\\]*?(?:\1\1|\\.))*[^\1\\]*?)\1/ }
        , entity: { exp: /&[\w#]+?;/ }
    }
}</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/name-spaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An enzyme for transcluding a web page</title>
		<link>http://noteslog.com/post/an-enzyme-for-transcluding-a-web-page/</link>
		<comments>http://noteslog.com/post/an-enzyme-for-transcluding-a-web-page/#comments</comments>
		<pubDate>Sat, 10 Feb 2007 16:35:33 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Enzymes]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=129</guid>
		<description><![CDATA[Enzymes can be complex PHP scripts, but basic enzymes are also very useful. This one is a oneliner, and it allows to transclude aÂ web page inside a post. Really all the magic is played by an IFRAME element, but Enzymes makes it easy to use the method over and over, without any need to remember: [...]]]></description>
			<content:encoded><![CDATA[<p>Enzymes can be complex PHP scripts, but basic enzymes are also very useful. This one is a oneliner, and it allows to transclude aÂ web page inside a post. Really all the magic is played by an IFRAME element, but Enzymes makes it easy to use the method over and over, without any need to remember: &#8220;how did I do it?&#8221;</p>
<p> this is got by the statement <u>{[.page(.google)]}</u></p>
<p> this is got by the statement <u>{[.page(.yahoo)]}</u></p>
<p>Here is the code for the <u>page</u> field:</p>
<blockquote><p>echo "<iframe width='450' height='200' src='" . $this->substrate . "'></iframe>";</p></blockquote>
<p>Here is the code for the <u>google</u> and <u>yahoo</u> fields respectively:</p>
<blockquote><p>http://www.google.com/<br />
http://www.yahoo.com/</p></blockquote>
<p>Easy, isn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/an-enzyme-for-transcluding-a-web-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Recipe: Dashed Attributes</title>
		<link>http://noteslog.com/post/dashed-attributes/</link>
		<comments>http://noteslog.com/post/dashed-attributes/#comments</comments>
		<pubDate>Sat, 03 Feb 2007 23:54:34 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=126</guid>
		<description><![CDATA[Another little improvement for the HTML recipe. This time is for properly highlighting attributes whose name contains a dash, like &#8220;http-equiv&#8221;. I also touched the tag rule, so that the DOCTYPE is recognized now: /* =============================================================================== Chili Recipe for the XHTML language ............................................................................... Version: 1.5b - 2007/02 - http://noteslog.com/chili/ ------------------------------------------------------------------------------- Copyright (c) 2006 Andrea Ercolino [...]]]></description>
			<content:encoded><![CDATA[<p>Another little improvement for the HTML recipe. This time is for properly highlighting attributes whose name contains a dash, like &#8220;http-equiv&#8221;. I also touched the tag rule, so that the DOCTYPE is recognized now: /*
===============================================================================
Chili Recipe for the XHTML language
...............................................................................

Version: 1.5b - 2007/02 - http://noteslog.com/chili/

-------------------------------------------------------------------------------
Copyright (c) 2006 Andrea Ercolino
http://www.opensource.org/licenses/mit-license.php
===============================================================================
*/

{
	steps: {
		  mlcom : { exp: /\<!--(?:.|\n)*?--\>/ }
		, tag   : { exp: /(?:\<\!?\w+)|(?:\>)|(?:\<\/\w+\>)|(?:\/\>)/ }
		, aname : { exp: /\s+[\w-]+(?=\s*=)/ }
        , avalue: { exp: /([\"\'])(?:(?:[^\1\\]*?(?:\1\1|\\.))*[^\1\\]*?)\1/ }
		, entity: { exp: /&[\w#]+?;/ }
	}
}</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/dashed-attributes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HTML Recipe: Multiline Attributes</title>
		<link>http://noteslog.com/post/multiline-attributes/</link>
		<comments>http://noteslog.com/post/multiline-attributes/#comments</comments>
		<pubDate>Fri, 02 Feb 2007 22:19:33 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=110</guid>
		<description><![CDATA[Some days ago I discovered that an HTML tag can haveÂ attributes whose values span multiple lines. This is very useful whenÂ the value is a piece of javascript code, which in fact is immune to white space. The HTML recipeÂ IÂ bundled to Chili 1.5 is a bit wrong, though, because it doesn&#8217;t consider that possibility. This is [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago I discovered that an HTML tag can haveÂ attributes whose values span multiple lines. This is very useful whenÂ the value is a piece of javascript code, which in fact is immune to white space.</p>
<p>The HTML recipeÂ IÂ bundled to Chili 1.5 is a bit wrong, though, because it doesn&#8217;t consider that possibility. This is one that does: /*  
===============================================================================
Chili Recipe for the HTML language
...............................................................................

Version: 1.5a - 2007/02 - http://noteslog.com/chili/

-------------------------------------------------------------------------------
Copyright (c) 2006 Andrea Ercolino
http://www.opensource.org/licenses/mit-license.php
===============================================================================
*/

{
	steps: {		
		  mlcom : { exp: /\<!--(?:.|\n)*?--\>/ }
		, tag   : { exp: /(?:\<\w+)|(?:\>)|(?:\<\/\w+\>)|(?:\/\>)/ }
		, aname : { exp: /\s+\w+(?=\s*=)/ }
        , avalue: { exp: /([\"\'])(?:(?:[^\1\\]*?(?:\1\1|\\.))*[^\1\\]*?)\1/ }
		, entity: { exp: /&[\w#]+?;/ }
	}
}</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/multiline-attributes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tolerance to loss of connectivity when auto-refreshing a page</title>
		<link>http://noteslog.com/post/tolerance-to-loss-of-connectivity-when-auto-refreshing-a-page/</link>
		<comments>http://noteslog.com/post/tolerance-to-loss-of-connectivity-when-auto-refreshing-a-page/#comments</comments>
		<pubDate>Fri, 09 Dec 2005 23:02:29 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=10</guid>
		<description><![CDATA[Refreshing content could be loaded in an invisible container and then copied to the visible one if it&#8217;s valid. The validity check could be in the content itself: a function call at the end of the body will do. Prepare two containers for your content: VisibleContainer, and HiddenContainer. Define two global script functions: refreshVisible(), and [...]]]></description>
			<content:encoded><![CDATA[<p>Refreshing content could be loaded in an invisible container and then copied to the visible one if it&#8217;s valid. The validity check could be in the content itself: a function call at the end of the body will do.</p>
<p>Prepare two containers for your content: VisibleContainer, and HiddenContainer. Define two global script functions: refreshVisible(), and refreshHidden().</p>
<p><strong>refreshHidden()</strong></p>
<ol>
<li>download fresh content to the HiddenContainer</li>
<li>reset a timer for calling refreshHidden() after x seconds</li>
</ol>
<p><strong>refreshVisible()</strong></p>
<ol>
<li>if not called from HiddenContainer then exit</li>
<li>copy fresh content from HiddenContaner to VisibleContainer</li>
</ol>
<p>Finally, call refreshHidden() from the onLoad event of VisibleContainer, and make a call to refreshVisible() from the very end of the content loaded in HiddenContainer.</p>
<p>If there is a loss of connectivity, then there is no call to refreshVisible(), and no error is shown. Also, the timer will continue to run and it will call refreshHidden() upon expiration.</p>
<p><span style="font-size: 85%">(revised text from my own comment </span><a href="http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21212992.html#12628152" target="_blank"><span style="font-size: 85%">12628152</span></a><span style="font-size: 85%"> at Experts-Exchange)</span></p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/tolerance-to-loss-of-connectivity-when-auto-refreshing-a-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
