Added my "version 2" renderer as a branch.

This commit is contained in:
Derick Rethans
2012-02-23 14:44:43 +00:00
parent af708bd864
commit 0b0886a0bf
8 changed files with 4211 additions and 0 deletions

25
10gen.css Normal file
View File

@@ -0,0 +1,25 @@
h1
{
background-color: #1a3e7f;
}
div.footer
{
height: 105px;
width: 1024px;
top: 645px;
position: absolute;
background-color: #1a3e7f;
clear: both;
}
div.footer img
{
margin-left: 20px;
margin-right: 20px;
}
pre
{
font-size: 150%;
}

2
IE8.js Normal file

File diff suppressed because one or more lines are too long

588
core.css Normal file
View File

@@ -0,0 +1,588 @@
body
{
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background: #d3d7cf;
overflow-x: hidden;
font-size: 125%;
}
.xlarge
{
font-size: 333%;
}
.large
{
font-size: 150%;
}
.pre p
{
font-family: monospace;
white-space: pre;
}
div.whole-slide
{
width: 1024px;
height: 760px;
}
div.title-slide
{
text-align: center;
font-family: Arial, sans-serif;
}
div.section-slide
{
font-size: 300%;
overflow: hidden;
}
div.section-slide div p
{
text-align: center;
color: #eeeeec;
background-color: #75507b;
margin-top: 320px;
margin-bottom: 0px;
}
div.event-title
{
font-size: 2em;
margin-top: 3em;
margin-bottom: 1em;
}
div.event-date
{
font-size: 1.25em;
}
div.event-presenter
{
font-size: 1em;
}
pre
{
background: #eeeeec;
}
div.result pre
{
background: #ad7fa8;
}
div.result pre.xdebug-var-dump
{
background: #eeeeec;
}
div.result p
{
font-size: 100%;
}
ul.tiny
{
font-size: 50%;
}
ul.tiny li p strong
{
font-size: 150%;
}
div.slideCount
{
position: absolute;
width: 99%;
text-align: right;
margin-right: 2em;
top: 0.2em;
font-size: small;
color: #aaa;
}
div.main div.article div.body, div.side div.body
{
border: solid 1px #babdb6;
background: #eeeeec;
}
div.articleListItem
{
padding-top: 3em;
}
div.articleListItem:first-child
{
padding-top: 0em;
}
p
{
font-family: serif;
margin-top: 0;
margin-bottom: 0.1em;
line-height: 110%;
font-size: 150%;
}
dd, dt
{
font-family: serif;
line-height: 140%;
}
li p
{
margin-bottom: 0.1em;
margin-top: 0.1em;
}
div.comment div.article div.body li p
{
margin-bottom: 0em;
margin-top: 0em;
padding-top: 0em;
padding-bottom: 0em;
}
div.comment div.article div.body ul
{
padding-bottom: 1em;
}
div.addComment p
{
font-family: sans-serif;
}
pre
{
margin: 0.5em;
border: solid 1px #babdb6;
overflow: auto;
}
p, pre, h1, h2, h3, h4, div.articleMetaData, div.commentMetaData, dl
{
padding: 0.25em;
}
div, ol, li, ul, table
{
margin: 0;
padding: 0;
}
li
{
margin-left: 2em;
}
h1
{
font-size: 166%;
color: #eeeeec;
background-color: #75507b;
}
h2
{
font-size: 125%;
color: #d3d7cf;
background-color: #75507b;
}
h3
{
font-size: 113%;
}
div.comment h1, div.comment h2
{
background-color: transparent;
color: #000;
}
div.addComment a
{
color: #000000;
}
h1 a
{
text-decoration: none;
background-color: #75507b;
color: #eeeeec;
}
h2 a, h3 a, h4 a
{
text-decoration: none;
color: #eeeeec;
}
h1, h2, h3, h4
{
margin-top: 0;
margin-bottom: 0.5em;
}
div.articleMetaData, div.commentMetaData
{
margin-top: 0.5em;
margin-bottom: 0.5em;
}
a
{
color: #5c3566;
}
a:hover, div.addComment a:hover
{
color: #75507b;
}
h1 a:hover
{
color: #d3d7cf;
}
div.commentList
{
clear: both;
}
div.commentListJoindin
{
margin-bottom: 2em;
}
div.comment, div.addComment
{
background-color: #ad7fa8;
margin-left: 1em;
margin-top: 0.5em;
margin-right: 0.5em;
}
div.previewComment div.article div.body div.comment
{
margin: 0.5em;
}
div.addComment form
{
background: #eeeeec;
border: 1px solid #cd9fc8;
margin-bottom: 1em;
}
div.location, div.commentName
{
font-weight: bold;
}
div.date
{
font-style: italic;
}
div.comment div.article div.body
{
border: 1px solid #cd9fc8;
}
img
{
text-align: center;
margin: 0 auto;
display: block;
}
p.attribution
{
text-align: right;
font-size: 50%;
margin-top: -16px;
color: gray;
}
img.inline
{
display: inline;
vertical-align: middle;
}
img.left
{
float: left;
margin: 0.5em 0.5em 0.5em 0;
}
img.right
{
float: right;
margin: 0.5em 0 0.5em 0.5em;
}
img.icon
{
display: inline;
border: 0;
}
div.addComment th
{
text-align: left;
}
div.addComment td, div.addComment th
{
vertical-align: top;
}
div.addComment table
{
padding-right: 1em;
}
div.addComment table, div.addComment td, div.addComment textarea
{
width: 100%;
}
div.addComment span.note
{
font-size: 75%;
color: #555753;
}
div.header
{
vertical-align: center;
}
div.header ul
{
position: relative;
left: 0.42em;
top: 3em;
}
div.header ul li
{
display: inline;
margin: 0.3em;
padding: 0em;
}
div.header ul li a
{
color: #eeeeec;
text-decoration: none;
font-size: 125%;
}
div.header ul li a:hover
{
text-decoration: underline;
}
div.footer
{
font-size: 75%;
padding: 0.5em;
text-align: center;
}
div.footer a
{
color: #eeeeec;
}
p.extend
{
text-align: right;
}
div#dopplr-blog-badge
{
margin: 0 auto;
padding-top: 2em;
padding-bottom: 2em;
}
ul.lifeline
{
list-style-type: none;
}
ul.lifeline li div div.source
{
color: #555753;
text-align: right;
}
ul.lifeline li
{
margin: 0.5em;
padding-top: 0.25em;
padding-bottom: 1em;
clear: both;
border-top: dashed 1px #888a85;
}
ul.lifeline li:first-child
{
border-top: none;
}
div.flickr div.center
{
text-align: center;
}
div.flickr div.center img
{
margin-top: 0.5em;
margin-bottom: 0.5em;
}
p.comment
{
margin: 0;
padding: 0;
}
span.hide
{
display: none;
}
div.commentErrors
{
background-color: #ef2929;
}
div.commentOk
{
background-color: #73d216;
}
div.validationMessage
{
margin-left: 1em;
border-right: solid 1px #babdb6;
background: #eeeeec;
}
div.validationMessage h1
{
margin-bottom: 0;
}
div.lines
{
padding: 1em 0;
}
div.line
{
font-family: monospace;
white-space: pre;
}
div.lineWithError
{
font-family: monospace;
white-space: pre;
background-color: #ef2929;
color: #eeeeec;
}
ul.errorMessages li
{
padding-top: 0.5em;
padding-bottom: 0.5em;
}
.footnote
{
vertical-align: super;
font-size: 80%;
}
ul.footnotes li p
{
display: inline;
}
code
{
margin: 0;
padding: 0 0.2em;
border: solid 1px #babdb6;
}
div.talk-comments
{
display: none;
}
div.rating
{
float: right;
}
p.extend
{
display: none;
}
table.xdebug-error
{
width: 80%;
margin: 0 auto;
}
.vim-export
{
color: #ffffff;
background-color: #000000;
overflow: auto;
white-space: nowrap;
font-size: 80%;
width: 80%;
margin: 0 auto;
}
div.center-page
{
font-size: 400%;
text-align: center;
}
div.text-overlay
{
position: absolute;
top: 0px;
width: 100%;
}
div.text-overlay h1
{
font-size: 3em;
text-align: center;
opacity: 0.8;
}

19
jquery-1.3.2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

3312
phpqrcode.php Normal file

File diff suppressed because it is too large Load Diff

51
pres2.js Normal file
View File

@@ -0,0 +1,51 @@
$(document).ready(function() {
$("*[class^='effect']").hide();
$("*[class^='effect-fade-out']").show();
});
function processNextEvent()
{
var effect = $("*[class^='effect']:first");
if (effect.length) {
var class = effect.attr('class');
if (class == 'effect-slide') {
$(effect).slideDown();
$(effect).removeClass(class);
} else if (class == 'effect-fade-in-out') {
$(effect).fadeIn( 250 );
$(effect).removeClass(class);
$(effect).addClass( 'effect-fade-out' );
} else if (class == 'effect-fade-out') {
$(effect).fadeOut( 250, function() { processNextEvent(); } );
$(effect).removeClass(class);
} else if (class == 'effect-fade-in') {
$(effect).fadeIn( 250 );
$(effect).removeClass(class);
} else if (class == 'effect-hide') {
$(effect).show();
$(effect).removeClass(class);
}
} else {
document.location = '/show2.php/profiling-4dev11/3';
}
}
function processPrevEvent()
{
document.location = '/show2.php/profiling-4dev11/1';
}
$('*').keypress(function(event) {
if (event.keyCode == '39') {
processNextEvent();
event.preventDefault();
}
if (event.keyCode == '37') {
processPrevEvent();
event.preventDefault();
}
});

6
qrcode.php Normal file
View File

@@ -0,0 +1,6 @@
<?php
header( 'Content-Type: image/png' );
include 'phpqrcode.php';
QRcode::png($_GET['d'], false, "M", 10, 2);
?>

208
show2.php Normal file
View File

@@ -0,0 +1,208 @@
<?php
require '/home/derick/dev/zetacomponents/trunk/Base/src/ezc_bootstrap.php';
class PresFormatter implements ezcTemplateCustomFunction
{
public static function getCustomFunctionDefinition( $name )
{
switch ( $name )
{
case 'format_text':
case 'get_attribute':
case 'replace_properties':
case 'run_code':
$def = new ezcTemplateCustomFunctionDefinition();
$def->class = __CLASS__;
$def->method = $name;
return $def;
}
}
static public function run_code( $code )
{
ob_start();
try
{
eval( "?>$code" );
}
catch( Exception $e )
{
// ignore
}
$val = ob_get_contents();
ob_clean();
return $val;
}
static public function format_text( $pres, $text )
{
$ret = $text;
# $ret = preg_replace('/\*([\S ]+?)([^\\\])\*/','<strong>\1\2</strong>',$str);
$ret = preg_replace('/#([[:alnum:]]+?)#/','&\1;',$ret);
$ret = preg_replace('/\b_([\S ]+?)_\b/','<u>\1</u>',$ret);
// blink
$ret = str_replace('\*',chr(1),$ret);
$ret = preg_replace('/\*\*([\S ]+?)\*\*/','<blink>\1</blink>',$ret);
$ret = str_replace(chr(1),'\*',$ret);
// bold
$ret = str_replace('\*',chr(1),$ret);
$ret = preg_replace('/\*([\S ]+?)\*/','<strong>\1</strong>',$ret);
$ret = str_replace(chr(1),'\*',$ret);
// italics
$ret = str_replace('\~',chr(1),$ret);
$ret = preg_replace('/~([\S ]+?)~/','<i>\1</i>',$ret);
$ret = str_replace(chr(1),'\~',$ret);
// monospace font
$ret = str_replace('\%',chr(1),$ret);
$ret = preg_replace('/%([\S ]+?)%/', '<tt>\1</tt>', $ret);
$ret = str_replace(chr(1),'%',$ret);
// Hack by arjen: allow more than one word to be coloured
$ret = preg_replace('/\|([0-9a-fA-F]+?)\|([\S ]+?)\|/','<span style="color: #\1">\2</span>',$ret);
$ret = preg_replace('/\^([[:alnum:]]+?)\^/','<sup>\1</sup>',$ret);
$ret = preg_replace('/\@([[:alnum:]]+?)\@/','<sub>\1</sub>',$ret);
// Quick hack by arjen: BR/ and TAB/ pseudotags from conversion
$ret = preg_replace('/BR\//','<BR/>',$ret);
$ret = preg_replace('/TAB\//',' ',$ret);
$ret = preg_replace('/([\\\])([*#_|^@%])/', '\2', $ret);
$ret = preg_replace('/:-:(.*?):-:/e','$pres->\\1',$ret);
return $ret;
}
static public function replace_properties( $pres, $value )
{
$value = preg_replace('/:-:(.*?):-:/e','$pres->\\1', $value);
return $value;
}
static public function get_attribute( $node, $attribute )
{
$attr_value = $node->getAttribute( $attribute );
return PresFormatter::replace_properties( $GLOBALS['pres'], $attr_value );
}
}
class PresRst implements ezcTemplateCustomFunction
{
public static function getCustomFunctionDefinition( $name )
{
switch ( $name )
{
case 'title':
$def = new ezcTemplateCustomFunctionDefinition();
$def->class = __CLASS__;
$def->method = $name;
return $def;
}
}
public function title( $text, $marker )
{
return $text . "\n" . str_repeat( $marker, strlen( $text ) ) . "\n\n";
}
}
$tc = ezcTemplateConfiguration::getInstance();
$tc->addExtension( 'PresFormatter' );
$tc->addExtension( 'PresRst' );
$base = $_SERVER['DOCUMENT_ROOT'] . 'presentations/';
@list( $dummy, $prest, $slideNr ) = explode( '/', $_SERVER['PATH_INFO'] );
if ( $slideNr === null || $slideNr === '' )
{
$slideNr = 0;
}
$pres = new Presentation( $prest );
if ( $slideNr === 'pdf' )
{
header( 'Content-type: text/plain' );
$pres->renderToRst( "/tmp/{$prest}.rst" );
}
else
{
echo $pres->display( $slideNr );
}
class Presentation
{
private $properties;
public $slideFiles;
public $base;
public $presName;
function __get( $name )
{
return $this->properties[$name];
}
function __construct( $pres )
{
$this->presName = $pres;
$presFile = $GLOBALS['base'] . $pres . '.xml';
$xml = simplexml_load_file( $presFile );
foreach (
array(
'title', 'event', 'location', 'date', 'speaker',
'email', 'url', 'joindin', 'twitter'
) as $prop )
{
$this->properties[$prop] = (string) $xml->$prop;
}
$this->properties['talk_id'] = $pres;
$this->slideFiles = array();
foreach ( $xml->slide as $slide )
{
$this->slideFiles[] = (string) $slide;
}
// template configuration
$templateDir = 'default';
if ( isset( $xml['templatePath'] ) )
{
$templateDir = (string) $xml['templateDir'];
}
$this->css = array( "core.css" );
if ( isset( $xml['css'] ) )
{
$this->css[] = $xml['css'];
}
$tc = ezcTemplateConfiguration::getInstance();
$tc->templatePath = $GLOBALS['base'] . 'templates/' . $templateDir;
$tc->compilePath = '/tmp/template-cache';
}
function display( $slideNr )
{
$xml = new DomDocument;
$xml->load( $GLOBALS['base'] . $this->slideFiles[$slideNr] );
$parts = explode( '/', $this->slideFiles[$slideNr] );
$this->base = '/presentations/slides/' . join( '', array_slice( $parts, -2, 1 ) ) . '/';
$tpl = new ezcTemplate();
$tpl->send->node = $xml->documentElement;
$tpl->send->pres = $this;
$tpl->send->slideNr = $slideNr;
$tpl->send->css = $this->css;
echo $tpl->process( 'slide.ezt' );
}
function renderToRst( $filename )
{
$tpl = new ezcTemplate();
$tpl->send->pres = $this;
echo $tpl->process( 'rst/presentation.ezt' );
}
}