Skip to content

Commit

Permalink
Some more rules , 35/45 done ...
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.php.net/repository/pear/packages/Text_Wiki/trunk@206394 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
bertrand Gugger committed Feb 4, 2006
1 parent d798cb8 commit 3818bb5
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 89 deletions.
3 changes: 2 additions & 1 deletion Text/Wiki/Render/Docbook/Embed.php
Expand Up @@ -40,7 +40,8 @@ class Text_Wiki_Render_Docbook_Embed extends Text_Wiki_Render {

function token($options)
{
return $options['text'];
return "<para>\n<![CDATA[\n" . strip_tags($options['text']) .
"\n]]>\n</para>\n";
}
}
?>
2 changes: 1 addition & 1 deletion Text/Wiki/Render/Docbook/Include.php
Expand Up @@ -14,7 +14,7 @@
*/

/**
* This class renders included maekup in DocBook. (empty)
* This class renders included markup in DocBook. (empty)
*
* @category Text
* @package Text_Wiki_Docbook
Expand Down
3 changes: 1 addition & 2 deletions Text/Wiki/Render/Docbook/Newline.php
Expand Up @@ -25,10 +25,9 @@
*/
class Text_Wiki_Render_Docbook_Newline extends Text_Wiki_Render {


function token($options)
{
return "<br />\n";
return "<literallayout>\n</literallayout>";
}
}

Expand Down
2 changes: 1 addition & 1 deletion Text/Wiki/Render/Docbook/Page.php
Expand Up @@ -40,7 +40,7 @@ class Text_Wiki_Render_Docbook_Page extends Text_Wiki_Render {

function token($options)
{
return 'PAGE MARKER HERE*&^%$#^$%*PAGEMARKERHERE';
return '<phrase role="pagebreak"></phrase>' . "\n";
}
}
?>
16 changes: 3 additions & 13 deletions Text/Wiki/Render/Docbook/Paragraph.php
Expand Up @@ -25,10 +25,6 @@
*/
class Text_Wiki_Render_Docbook_Paragraph extends Text_Wiki_Render {

var $conf = array(
'css' => null
);

/**
*
* Renders a token into text matching the requested format.
Expand All @@ -44,16 +40,10 @@ class Text_Wiki_Render_Docbook_Paragraph extends Text_Wiki_Render {

function token($options)
{
extract($options); //type

if ($type == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "<p$css>";
}

if ($type == 'end') {
return "</p>\n\n";
if ($options['type'] == 'start') {
return "<para>";
}
return '</para>';
}
}
?>
2 changes: 1 addition & 1 deletion Text/Wiki/Render/Docbook/Preformatted.php
Expand Up @@ -40,7 +40,7 @@ class Text_Wiki_Render_Docbook_Preformatted extends Text_Wiki_Render {

function token($options)
{
return '<pre>'.$options['text'].'</pre>';
return "<para>\n<![CDATA[\n" . $options['text'] . "\n]]>\n</para>\n";
}
}
?>
31 changes: 12 additions & 19 deletions Text/Wiki/Render/Docbook/Revise.php
Expand Up @@ -26,11 +26,10 @@
class Text_Wiki_Render_Docbook_Revise extends Text_Wiki_Render {

var $conf = array(
'css_ins' => null,
'css_del' => null
'role_ins' => 'inserted',
'role_del' => 'deleted'
);


/**
*
* Renders a token into text matching the requested format.
Expand All @@ -46,23 +45,17 @@ class Text_Wiki_Render_Docbook_Revise extends Text_Wiki_Render {

function token($options)
{
if ($options['type'] == 'del_start') {
$css = $this->formatConf(' class="%s"', 'css_del');
return "<del$css>";
}

if ($options['type'] == 'del_end') {
return "</del>";
}

if ($options['type'] == 'ins_start') {
$css = $this->formatConf(' class="%s"', 'css_ins');
return "<ins$css>";
}

if ($options['type'] == 'ins_end') {
return "</ins>";
switch ($options['type']) {
'del_start':
return '<emphasis' .
(($role = $this->getConf('role_del', 'deleted')) ?
' role="' . $role . '"' : '') . '>';
'ins_start':
return '<emphasis' .
(($role = $this->getConf('role_ins', 'inserted')) ?
' role="' . $role . '"' : '') . '>';
}
return '</emphasis>';
}
}
?>
26 changes: 13 additions & 13 deletions Text/Wiki/Render/Docbook/Specialchar.php
Expand Up @@ -25,19 +25,19 @@
*/
class Text_Wiki_Render_Docbook_SpecialChar extends Text_Wiki_Render {

var $types = array('~bs~' => '&#92;',
'~hs~' => '&nbsp;',
'~amp~' => '&amp;',
'~ldq~' => '&ldquo;',
'~rdq~' => '&rdquo;',
'~lsq~' => '&lsquo;',
'~rsq~' => '&rsquo;',
'~c~' => '&copy;',
'~--~' => '&mdash;',
'" -- "' => '&mdash;',
'&quot; -- &quot;' => '&mdash;',
'~lt~' => '&lt;',
'~gt~' => '&gt;');
var $types = array('~bs~' => '&#092;',
'~hs~' => '&#160;', // &nbsp;
'~amp~' => '&#038;', // &amp;
'~ldq~' => '&#8220;', // &ldquo;
'~rdq~' => '&#8221;', // &rdquo;
'~lsq~' => '&#8216;', // &lsquo;
'~rsq~' => '&#8217;', // &rsquo;
'~c~' => '&#169;', // &copy;
'~--~' => '&#8212;', // &mdash;
'" -- "' => '&#8212;', // &mdash;
'&quot; -- &quot;' => '&#8212;', // &mdash;
'~lt~' => '&#060;', // &lt;
'~gt~' => '&#062'); // &gt;

function token($options)
{
Expand Down
12 changes: 2 additions & 10 deletions Text/Wiki/Render/Docbook/Subscript.php
Expand Up @@ -25,10 +25,6 @@
*/
class Text_Wiki_Render_Docbook_Subscript extends Text_Wiki_Render {

var $conf = array(
'css' => null
);

/**
*
* Renders a token into text matching the requested format.
Expand All @@ -45,13 +41,9 @@ class Text_Wiki_Render_Docbook_Subscript extends Text_Wiki_Render {
function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "<sub$css>";
}

if ($options['type'] == 'end') {
return '</sub>';
return '<subscript>';
}
return '</subscript>';
}
}
?>
12 changes: 2 additions & 10 deletions Text/Wiki/Render/Docbook/Superscript.php
Expand Up @@ -25,10 +25,6 @@
*/
class Text_Wiki_Render_Docbook_Superscript extends Text_Wiki_Render {

var $conf = array(
'css' => null
);

/**
*
* Renders a token into text matching the requested format.
Expand All @@ -45,13 +41,9 @@ class Text_Wiki_Render_Docbook_Superscript extends Text_Wiki_Render {
function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "<sup$css>";
}

if ($options['type'] == 'end') {
return '</sup>';
return '<superscript>';
}
return '</superscript>';
}
}
?>
13 changes: 2 additions & 11 deletions Text/Wiki/Render/Docbook/Tt.php
Expand Up @@ -25,11 +25,6 @@
*/
class Text_Wiki_Render_Docbook_Tt extends Text_Wiki_Render {


var $conf = array(
'css' => null
);

/**
*
* Renders a token into text matching the requested format.
Expand All @@ -46,13 +41,9 @@ class Text_Wiki_Render_Docbook_Tt extends Text_Wiki_Render {
function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "<tt$css>";
}

if ($options['type'] == 'end') {
return '</tt>';
return "<code>";
}
return '</code>';
}
}
?>
11 changes: 4 additions & 7 deletions Text/Wiki/Render/Docbook/Underline.php
Expand Up @@ -26,7 +26,7 @@
class Text_Wiki_Render_Docbook_Underline extends Text_Wiki_Render {

var $conf = array(
'css' => null
'role' => 'underline'
);

/**
Expand All @@ -44,14 +44,11 @@ class Text_Wiki_Render_Docbook_Underline extends Text_Wiki_Render {

function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "<u$css>";
}

if ($options['type'] == 'end') {
return '</u>';
return '</emphasis>';
}
return '<emphasis' . (($role = $this->getConf('role', 'underline')) ?
' role="' . $role . '"' : '') . '>';
}
}
?>

0 comments on commit 3818bb5

Please sign in to comment.