This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
XSL = <<-EOXSL | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="xml" encoding="ISO-8859-1"/> | |
<xsl:param name="indent-increment" select="' '"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This version allows LHS to be any expression | |
// (and makes sure it's only evaluated once by storing the result) | |
let (?.) = macro { | |
rule infix { $lhs:expr | $rhs:ident } => { | |
(function ($tmp) { | |
return $tmp === null ? null : $tmp.$rhs; | |
})($lhs) | |
} | |
} |