-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Sampler2.html: Sampler2.php | ||
php Sampler2.php > Sampler2.html |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<style type="text/css" media="all">@import "bootstrap.css";</style> | ||
|
||
<div class="container"><div class="row"><div class="span10"><h1>FOML Sampler</h1><p>See <a href="https://github.com/guyc/FOML">the FOML Github repo</a> for details.</p><div style="margin-top:20px"><h3>Doctype Node</h3><p>All complete FOML documents should start with this as the first line.</p><div style="margin-left:40px"><h4>FOML</h4><pre>!!!</pre><h4>PHP</h4><pre><?php echo '<?xml version="1.0" encoding="utf-8"?>' ?></pre><h4>XSL-FO</h4><pre><?xml version="1.0" encoding="utf-8"?></pre></div></div><div style="margin-top:20px"><h3>Shell-style Comments</h3><p>HAML shell style comments are evaluated as PHP, and resolve to the rarely-used PHP shell-style comment.</p><div style="margin-left:40px"><h4>FOML</h4><pre>-# This generates no XSL-FO at all</pre><h4>PHP</h4><pre><?php # This generates no XSL-FO at all | ||
; | ||
?></pre><h4>XSL-FO</h4><pre></pre></div></div><div style="margin-top:20px"><h3>XML Comments</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre> | ||
/ This should become an XML comment | ||
and so should this indented continuation. | ||
</pre><h4>PHP</h4><pre><!-- This should become an XML comment and so should this indented continuation. --> | ||
</pre><h4>XSL-FO</h4><pre><!-- This should become an XML comment and so should this indented continuation. --> | ||
</pre></div></div><div style="margin-top:20px"><h3>Simple XML Node</h3><p>If a namespace is not explicitly defined, the fo namespace is used.</p><div style="margin-left:40px"><h4>FOML</h4><pre>%flow | ||
</pre><h4>PHP</h4><pre><fo:flow > | ||
</fo:flow> | ||
</pre><h4>XSL-FO</h4><pre><fo:flow > | ||
</fo:flow> | ||
</pre></div></div><div style="margin-top:20px"><h3>XML Node with an explicit namespace</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre>%xsl:stylesheet | ||
</pre><h4>PHP</h4><pre><xsl:stylesheet > | ||
</xsl:stylesheet> | ||
</pre><h4>XSL-FO</h4><pre><xsl:stylesheet > | ||
</xsl:stylesheet> | ||
</pre></div></div><div style="margin-top:20px"><h3>XML Node self-closing</h3><p>End the tag with a "/" to make the node self-closing.</p><div style="margin-left:40px"><h4>FOML</h4><pre>%flow/</pre><h4>PHP</h4><pre><fo:flow /> | ||
</pre><h4>XSL-FO</h4><pre><fo:flow /> | ||
</pre></div></div><div style="margin-top:20px"><h3>XML Node with attributes</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre>%flow(flow-name="xsl-region-body")</pre><h4>PHP</h4><pre><fo:flow flow-name="xsl-region-body"> | ||
</fo:flow> | ||
</pre><h4>XSL-FO</h4><pre><fo:flow flow-name="xsl-region-body"> | ||
</fo:flow> | ||
</pre></div></div><div style="margin-top:20px"><h3>XML Node with explicit namespace, arguments and auto-close</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre>%fo:block(border-after-style="dashed") /</pre><h4>PHP</h4><pre><fo:block border-after-style="dashed"/> | ||
</pre><h4>XSL-FO</h4><pre><fo:block border-after-style="dashed"/> | ||
</pre></div></div><div style="margin-top:20px"><h3>Simple Text</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre>We will rule over all this land, & we will call it... "This Land".</pre><h4>PHP</h4><pre>We will rule over all this land, & we will call it... "This Land". | ||
</pre><h4>XSL-FO</h4><pre>We will rule over all this land, & we will call it... "This Land". | ||
</pre></div></div><div style="margin-top:20px"><h3>Line Continuation</h3><p>Note that the final line must end with a pipe character too.</p><div style="margin-left:40px"><h4>FOML</h4><pre> | ||
%table( | | ||
table-layout="fixed" | | ||
width="100%" | | ||
border-collapse="separate" | | ||
) | | ||
</pre><h4>PHP</h4><pre><fo:table table-layout="fixed" width="100%" border-collapse="separate" > | ||
</fo:table> | ||
</pre><h4>XSL-FO</h4><pre><fo:table table-layout="fixed" width="100%" border-collapse="separate" > | ||
</fo:table> | ||
</pre></div></div><div style="margin-top:20px"><h3>PHP Execution</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre>- print "hello"</pre><h4>PHP</h4><pre><?php print "hello" | ||
; | ||
?></pre><h4>XSL-FO</h4><pre>hello</pre></div></div><div style="margin-top:20px"><h3>PHP Evaluation</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre>= 24 * 60 * 60</pre><h4>PHP</h4><pre><?php print 24 * 60 * 60 | ||
; | ||
?></pre><h4>XSL-FO</h4><pre>86400</pre></div></div><div style="margin-top:20px"><h3>PHP Conditionals</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre> | ||
- $x = 4 * 4 | ||
- if ($x>15) | ||
Thao | ||
- else | ||
Vang | ||
</pre><h4>PHP</h4><pre><?php $x = 4 * 4 | ||
; | ||
if ($x>15) | ||
{ | ||
?>Thao | ||
<?php } | ||
else | ||
{ | ||
?>Vang | ||
<?php } | ||
?></pre><h4>XSL-FO</h4><pre>Thao | ||
</pre></div></div><div style="margin-top:20px"><h3>PHP Iteration</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre> | ||
- for ($i=0;$i<3;$i++) | ||
%table-cell | ||
%block | ||
= $i * $i | ||
</pre><h4>PHP</h4><pre><?php for ($i=0;$i<3;$i++) | ||
{ | ||
?><fo:table-cell > | ||
<fo:block > | ||
<?php print $i * $i | ||
; | ||
?></fo:block> | ||
</fo:table-cell> | ||
<?php } | ||
?></pre><h4>XSL-FO</h4><pre><fo:table-cell > | ||
<fo:block > | ||
0</fo:block> | ||
</fo:table-cell> | ||
<fo:table-cell > | ||
<fo:block > | ||
1</fo:block> | ||
</fo:table-cell> | ||
<fo:table-cell > | ||
<fo:block > | ||
4</fo:block> | ||
</fo:table-cell> | ||
</pre></div></div><div style="margin-top:20px"><h3>Node with text follow-on</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre>%fo:block(border-after-style="dashed") text in extension</pre><h4>PHP</h4><pre><fo:block border-after-style="dashed"> | ||
text in extension | ||
</fo:block> | ||
</pre><h4>XSL-FO</h4><pre><fo:block border-after-style="dashed"> | ||
text in extension | ||
</fo:block> | ||
</pre></div></div><div style="margin-top:20px"><h3>Node with evaluation follow-on</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre>%fo:block(border-after-style="dashed") = 22/7 // evaluation in extension</pre><h4>PHP</h4><pre><fo:block border-after-style="dashed"> | ||
<?php print 22/7 // evaluation in extension | ||
; | ||
?></fo:block> | ||
</pre><h4>XSL-FO</h4><pre><fo:block border-after-style="dashed"> | ||
3.1428571428571</fo:block> | ||
</pre></div></div><div style="margin-top:20px"><h3>Node with execution follow-on</h3><p></p><div style="margin-left:40px"><h4>FOML</h4><pre>%fo:block(border-after-style="dashed") - print 22/7 // execution in extension</pre><h4>PHP</h4><pre><fo:block border-after-style="dashed"> | ||
<?php print 22/7 // execution in extension | ||
; | ||
?></fo:block> | ||
</pre><h4>XSL-FO</h4><pre><fo:block border-after-style="dashed"> | ||
3.1428571428571</fo:block> | ||
</pre></div></div><div style="margin-top:20px"><h3>Special Case #1 : The Importance of New-Lines in Generated PHP</h3><p>This example illustrates why the automatically-generated semi-colon is preceeded by a new-line. Without it the semi-colon would be commented out in this example.</p><div style="margin-left:40px"><h4>FOML</h4><pre> | ||
- $x = 22/7 // these slashes break the auto-semicolon logic | ||
= $x | ||
</pre><h4>PHP</h4><pre><?php $x = 22/7 // these slashes break the auto-semicolon logic | ||
; | ||
print $x | ||
; | ||
?></pre><h4>XSL-FO</h4><pre>3.1428571428571</pre></div></div><div style="margin-top:20px"><h3>Special Case #2 : Self-closing Node with child-nodes</h3><p>Indented subnodes of a self-closing nodes will NOT be enclosed by the closed node. You wouldn't do this on purpose.</p><div style="margin-left:40px"><h4>FOML</h4><pre>%flow/ | ||
%inline | ||
appears to be a child of flow</pre><h4>PHP</h4><pre><fo:flow /> | ||
<fo:inline > | ||
appears to be a child of flow | ||
</fo:inline> | ||
</pre><h4>XSL-FO</h4><pre><fo:flow /> | ||
<fo:inline > | ||
appears to be a child of flow | ||
</fo:inline> | ||
</pre></div></div></div></div></div> |