Diff
Added: trunk/Sungrazr/Docs/Docbook/Book.php ( => )
Property changes on: trunk/Sungrazr/Docs/Docbook/Book.php
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/CodeSpan.php (0 => 115)
--- trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/CodeSpan.php (rev 0)
+++ trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/CodeSpan.php 2008-02-25 22:26:13 UTC (rev 115)
@@ -0,0 +1,29 @@
+<?php
+/**
+ *
+ * DocBook span plugin to change `` `text` `` to `<literal>text</literal>`.
+ *
+ *
+ */
+class Sungrazr_Docs_Docbook_Markdown_Plugin_CodeSpan extends Solar_Markdown_Plugin_CodeSpan
+{
+ /**
+ *
+ * Support callback for code spans.
+ *
+ * @param string $matches Matches from preg_replace_callback().
+ *
+ * @return string The replacement text.
+ *
+ */
+ protected function _parse($matches)
+ {
+ $c = $matches[2];
+ $c = preg_replace('/^[ \t]*/', '', $c); // leading whitespace
+ $c = preg_replace('/[ \t]*$/', '', $c); // trailing whitespace
+ $c = $this->_escape($c);
+ $c = "<literal>$c</literal>";
+ return $this->_toHtmlToken($c);
+ }
+
+}
Property changes on: trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/CodeSpan.php
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/EmStrong.php (0 => 115)
--- trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/EmStrong.php (rev 0)
+++ trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/EmStrong.php 2008-02-25 22:26:13 UTC (rev 115)
@@ -0,0 +1,48 @@
+<?php
+/**
+ *
+ * Docbook span plugin to insert emphasis and strong tags.
+ *
+ * * `*foo*` and `_foo_` become `<emphasis>foo</emphasis>`.
+ *
+ * * `**bar**` and `__bar__` become `<emphasis role="strong">bar</emphasis>`.
+ *
+ * * `***zim***` and `___zim___` become `<emphasis role="strong"><emphasis>zim</emphasis></emphasis>`.
+ *
+ * * `**_zim_**` and `__*zim*__` become `<emphasis role="strong"><emphasis>zim</emphasis></emphasis>`.
+ */
+class Sungrazr_Docs_Docbook_Markdown_Plugin_EmStrong extends Solar_Markdown_Plugin_EmStrong
+{
+ /**
+ *
+ * Support callback for strong tags.
+ *
+ * @param string $matches Matches from preg_replace_callback().
+ *
+ * @return string The replacement text.
+ *
+ */
+ protected function _parseStrong($matches)
+ {
+ return $this->_toHtmlToken('<emphasis role="strong">')
+ . $matches[2]
+ . $this->_toHtmlToken("</emphasis>");
+ }
+
+ /**
+ *
+ * Support callback for em tags.
+ *
+ * @param string $matches Matches from preg_replace_callback().
+ *
+ * @return string The replacement text.
+ *
+ */
+ protected function _parseEm($matches)
+ {
+ return $this->_toHtmlToken("<emphasis>")
+ . $matches[2]
+ . $this->_toHtmlToken("</emphasis>");
+ }
+
+}
Property changes on: trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/EmStrong.php
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/Paragraph.php (0 => 115)
--- trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/Paragraph.php (rev 0)
+++ trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/Paragraph.php 2008-02-25 22:26:13 UTC (rev 115)
@@ -0,0 +1,36 @@
+<?php
+class Sungrazr_Docs_Docbook_Markdown_Plugin_Paragraph extends Solar_Markdown_Plugin_Paragraph
+{
+
+ /**
+ *
+ * Forms paragraphs from source text.
+ *
+ * @param string $text Portion of the Markdown source text.
+ *
+ * @return string The transformed XHTML.
+ *
+ */
+ public function parse($text)
+ {
+ // Strip leading and trailing lines:
+ $text = preg_replace(array('/\A\n+/', '/\n+\z/'), '', $text);
+
+ // split into possible paragraphs
+ $grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY);
+
+ // Wrap <p> tags around apparent paragraphs.
+ foreach ($grafs as $key => $value) {
+ if (! $this->_isHtmlToken($value)) {
+ // not an HTML token, looks like a paragraph.
+ $value = $this->_processSpans($value);
+ $value = preg_replace('/^([ \t]*)/', '<para>', $value);
+ $value .= "</para>";
+ $grafs[$key] = $this->_toHtmlToken($value);
+ }
+ }
+
+ // done!
+ return implode("\n\n", $grafs);
+ }
+}
\ No newline at end of file
Property changes on: trunk/Sungrazr/Docs/Docbook/Markdown/Plugin/Paragraph.php
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/Sungrazr/Docs/Docbook/Markdown.php (0 => 115)
--- trunk/Sungrazr/Docs/Docbook/Markdown.php (rev 0)
+++ trunk/Sungrazr/Docs/Docbook/Markdown.php 2008-02-25 22:26:13 UTC (rev 115)
@@ -0,0 +1,64 @@
+<?php
+
+class Sungrazr_Docs_Docbook_Markdown extends Solar_Markdown {
+
+ protected $_Sungrazr_Docs_Docbook_Markdown = array(
+ 'tab_width' => 4,
+
+ 'tidy' => false,
+
+ 'plugins' => array(
+ // pre-processing on the source as a whole
+ 'Solar_Markdown_Plugin_Prefilter',
+ 'Solar_Markdown_Plugin_StripLinkDefs',
+
+ // blocks
+ //'Solar_Markdown_Plugin_Header',
+ //'Solar_Markdown_Plugin_HorizRule',
+ //'Solar_Markdown_Plugin_List',
+ //'Solar_Markdown_Plugin_CodeBlock',
+ //'Solar_Markdown_Plugin_BlockQuote',
+ //'Solar_Markdown_Plugin_Html',
+ 'Sungrazr_Docs_Docbook_Markdown_Plugin_Paragraph',
+
+ // spans
+ 'Sungrazr_Docs_Docbook_Markdown_Plugin_CodeSpan',
+ //'Solar_Markdown_Plugin_Image',
+ //'Solar_Markdown_Plugin_Link',
+ //'Solar_Markdown_Plugin_Uri',
+ //'Solar_Markdown_Plugin_Encode',
+ //'Solar_Markdown_Plugin_AmpsAngles',
+ 'Sungrazr_Docs_Docbook_Markdown_Plugin_EmStrong',
+ //'Solar_Markdown_Plugin_Break',
+ ),
+ );
+
+ protected $_original_plugins;
+
+ /**
+ *
+ * Constructor.
+ *
+ * Loads the plugins, builds a list of characters to encode, and
+ * builds the list of block-type and span-type plugin classes.
+ *
+ * @param array $config User-defined configuration values.
+ *
+ */
+ public function __construct($config = null)
+ {
+ parent::__construct($config);
+ }
+
+ public function disablePlugins($list = array())
+ {
+ if (! empty($list)) {
+ $this_original_plugins = $this->_plugins();
+ }
+ }
+
+ public function restorePlugins()
+ {
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/Sungrazr/Docs/Docbook/Markdown.php
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/Sungrazr/Docs/Docbook.php (0 => 115)
--- trunk/Sungrazr/Docs/Docbook.php (rev 0)
+++ trunk/Sungrazr/Docs/Docbook.php 2008-02-25 22:26:13 UTC (rev 115)
@@ -0,0 +1,71 @@
+<?php
+
+class Sungrazr_Docs_Docbook extends Solar_Base
+{
+ protected $_w;
+ protected $_markdown;
+
+ /**
+ *
+ * User-provided configuration.
+ *
+ * Keys are ...
+ *
+ * `element`
+ * : (string) The element class for the factory, default
+ * 'Sungrazr_Docs_Docbook_RefEntry'.
+ *
+ * @var array
+ *
+ */
+ protected $_Sungrazr_Docs_Docbook = array(
+ 'markdown' => array(
+ // pre-processing on the source as a whole
+ 'Solar_Markdown_Plugin_Prefilter',
+ 'Solar_Markdown_Plugin_StripLinkDefs',
+
+ // blocks
+ //'Solar_Markdown_Plugin_Header',
+ //'Solar_Markdown_Plugin_HorizRule',
+ //'Solar_Markdown_Plugin_List',
+ //'Solar_Markdown_Plugin_CodeBlock',
+ //'Solar_Markdown_Plugin_BlockQuote',
+ //'Solar_Markdown_Plugin_Html',
+ 'Sungrazr_Markdown_Plugin_Paragraph',
+
+ // spans
+ 'Sungrazr_Markdown_Plugin_CodeSpan',
+ //'Solar_Markdown_Plugin_Image',
+ //'Solar_Markdown_Plugin_Link',
+ //'Solar_Markdown_Plugin_Uri',
+ //'Solar_Markdown_Plugin_Encode',
+ //'Solar_Markdown_Plugin_AmpsAngles',
+ 'Sungrazr_Markdown_Plugin_EmStrong',
+ //'Solar_Markdown_Plugin_Break',
+ ),
+ );
+
+ /**
+ *
+ * Factory method to create server adapter objects.
+ *
+ * @return Sungrazr_Server_Adapter
+ *
+ */
+ // public function solarFactory()
+ // {
+ // // bring in the config and get the adapter class.
+ // $config = $this->_config;
+ // $class = $config['element'];
+ // unset($config['element']);
+ //
+ // return Solar::factory($class, $config);
+ // }
+
+
+ public function __construct($config = null)
+ {
+ $this->_w = new XMLWriter();
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/Sungrazr/Docs/Docbook.php
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/Sungrazr/Docs/Phpdoc.php (114 => 115)
--- trunk/Sungrazr/Docs/Phpdoc.php 2008-02-25 21:34:42 UTC (rev 114)
+++ trunk/Sungrazr/Docs/Phpdoc.php 2008-02-25 22:26:13 UTC (rev 115)
@@ -103,6 +103,10 @@
}
$param = @$tmp[0];
$subparam = @$tmp[1];
+ // did we find a sub-sub param with the same split string?
+ if (! empty($tmp[2])) {
+ $subsubparam = $tmp[2];
+ }
// sub-sub-param?
$tmp2 = array();