[Solar-svn] Revision 2825

pmjones at solarphp.com pmjones at solarphp.com
Sat Oct 6 10:53:32 CDT 2007


whitespace and comment changes


Modified: trunk/Solar/Markdown/Extra/DefList.php
===================================================================
--- trunk/Solar/Markdown/Extra/DefList.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Extra/DefList.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -62,7 +62,7 @@
     public function parse($text)
     {
         $less_than_tab = $this->_getTabWidth() - 1;
-
+        
         // Re-usable pattern to match any entire dl list:
         $whole_list = '
             (                                               # $1 = whole list
@@ -90,7 +90,7 @@
               )
             )
         '; // mx
-
+        
         $text = preg_replace_callback(
             '{
                 (?:(?<=\n\n)|\A\n?)
@@ -99,7 +99,7 @@
             array($this, '_parse'),
             $text
         );
-
+        
         return $text;
     }
     
@@ -123,8 +123,7 @@
         $result = "<dl>\n" . $result . "\n</dl>";
         return $this->_toHtmlToken($result) . "\n\n";
     }
-
-
+    
     /**
      * 
      * Process the contents of a definition list, splitting it into
@@ -141,7 +140,7 @@
     
         // trim trailing blank lines:
         $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
-
+        
         // Process definition terms.
         $list_str = preg_replace_callback(
             '{
@@ -158,7 +157,7 @@
             array($this, '_processDt'),
             $list_str
         );
-
+        
         // Process actual definitions.
         $list_str = preg_replace_callback(
             '{
@@ -176,7 +175,7 @@
             array($this, '_processDd'),
             $list_str
         );
-
+        
         return $list_str;
     }
     
@@ -213,7 +212,7 @@
     {
         $leading_line = $matches[1];
         $def          = $matches[2];
-
+        
         if ($leading_line || preg_match('/\n{2,}/', $def)) {
             $def = $this->_processBlocks($this->_outdent($def . "\n\n"));
             $def = "\n". $def ."\n";
@@ -221,7 +220,7 @@
             $def = rtrim($def);
             $def = $this->_processSpans($this->_outdent($def));
         }
-
+        
         return "\n<dd>" . $def . "</dd>\n";
     }
 }

Modified: trunk/Solar/Markdown/Extra/EmStrong.php
===================================================================
--- trunk/Solar/Markdown/Extra/EmStrong.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Extra/EmStrong.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -55,7 +55,7 @@
                         (?>                                         
                             [^_]+?                                  # Anthing not em markers.
                         |                                           
-                                                                    # Balence any regular _ emphasis inside.
+                                                                    # Balance any regular _ emphasis inside.
                             (?<![a-zA-Z0-9])_ (?=\S) (?! _) (.+?) 
                             (?<=\S) _ (?![a-zA-Z0-9])
                         )+?
@@ -91,7 +91,7 @@
             array($this, '_parseEm'),
             $text
         );
-
+        
         return $text;
     }
     

Modified: trunk/Solar/Markdown/Extra/Table.php
===================================================================
--- trunk/Solar/Markdown/Extra/Table.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Extra/Table.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -135,7 +135,7 @@
             array($this, '_parsePlain'),
             $text
         );
-
+        
         return $text;
     }
     
@@ -169,7 +169,7 @@
         $head       = $matches[1];
         $underline  = $matches[2];
         $content    = $matches[3];
-
+        
         // Remove any tailing pipes for each line.
         $head       = preg_replace('/[|] *$/m', '', $head);
         $underline  = preg_replace('/[|] *$/m', '', $underline);

Modified: trunk/Solar/Markdown/Plugin/AmpsAngles.php
===================================================================
--- trunk/Solar/Markdown/Plugin/AmpsAngles.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/AmpsAngles.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -63,14 +63,14 @@
             array($this, '_processAmp'),
             $text
         );
-
+        
         // encode naked <'s
         $text = preg_replace_callback(
             '{<(?![a-z/?\$!])}i',
             array($this, '_processLt'),
             $text
         );
-
+        
         return $text;
     }
     

Modified: trunk/Solar/Markdown/Plugin/BlockQuote.php
===================================================================
--- trunk/Solar/Markdown/Plugin/BlockQuote.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/BlockQuote.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -72,7 +72,7 @@
             array($this, '_parse'),
             $text
         );
-
+        
         return $text;
     }
     
@@ -104,7 +104,7 @@
             array($this, '_trimPreSpaces'),
             $bq
         );
-
+        
         return $this->_toHtmlToken("<blockquote>\n$bq\n</blockquote>") . "\n\n";
     }
     

Modified: trunk/Solar/Markdown/Plugin/CodeBlock.php
===================================================================
--- trunk/Solar/Markdown/Plugin/CodeBlock.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/CodeBlock.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -67,7 +67,7 @@
             array($this, '_parse'),
             $text
         );
-
+        
         return $text;
     }
     
@@ -90,7 +90,7 @@
             '',
             $code
         );
-
+        
         return "\n\n"
              . $this->_toHtmlToken("<pre><code>" . $code . "\n</code></pre>")
              . "\n\n";

Modified: trunk/Solar/Markdown/Plugin/CodeSpan.php
===================================================================
--- trunk/Solar/Markdown/Plugin/CodeSpan.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/CodeSpan.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -22,30 +22,30 @@
 /**
  * 
  * Span plugin to change `` `text` `` to `<code>text</code>`.
- *
+ * 
  * Backtick quotes are used for `<code></code>` spans.
- *
+ * 
  * You can use multiple backticks as the delimiters if you want to
  * include literal backticks in the code span. So, this input ...
- *
+ * 
  *     Just type ``foo `bar` baz`` at the prompt.
- *
+ * 
  * ... will translate to ...
- *
+ * 
  *     <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
- *
+ * 
  * There's no arbitrary limit to the number of backticks you
  * can use as delimters. If you need three consecutive backticks
  * in your code, use four for delimiters, etc.
- *
+ * 
  * You can use spaces to get literal backticks at the edges ...
- *
+ * 
  *     type `` `bar` ``
- *
+ * 
  * ... which turns into ...
- *
+ * 
  *     type <code>`bar`</code>
- *
+ * 
  * @category Solar
  * 
  * @package Solar_Markdown
@@ -93,7 +93,7 @@
             array($this, '_parse'),
             $text
         );
-
+        
         return $text;
     }
     

Modified: trunk/Solar/Markdown/Plugin/EmStrong.php
===================================================================
--- trunk/Solar/Markdown/Plugin/EmStrong.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/EmStrong.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -67,7 +67,7 @@
      */
     public function parse($text)
     {
-        # <strong> must go first:
+        // <strong> must go first:
         $text = preg_replace_callback('{
                 (                                       # $1: Marker
                     (?<!\*\*) \*\* |                    #     (not preceded by two chars of
@@ -90,14 +90,14 @@
             array($this, '_parseStrong'),
             $text
         );
-
-        # Then <em>:
+        
+        // Then <em>:
         $text = preg_replace_callback(
             '{ ( (?<!\*)\* | (?<!_)_ ) (?=\S) (?! \1) (.+?) (?<=\S) \1 }sx',
             array($this, '_parseEm'),
             $text
         );
-
+        
         return $text;
     }
     

Modified: trunk/Solar/Markdown/Plugin/Header.php
===================================================================
--- trunk/Solar/Markdown/Plugin/Header.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/Header.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -120,7 +120,7 @@
         
         return $text;
     }
-
+    
     /**
      * 
      * Support callback for top-level setext headers ("h1").

Modified: trunk/Solar/Markdown/Plugin/Html.php
===================================================================
--- trunk/Solar/Markdown/Plugin/Html.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/Html.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -98,7 +98,7 @@
     public function parse($text)
     {
         $less_than_tab = $this->_getTabWidth() - 1;
-
+        
         // We only want to do this for block-level HTML tags, such as
         // headers, lists, and tables. That's because we still want to
         // wrap <p>s around "paragraphs" that are wrapped in
@@ -109,7 +109,7 @@
         
         $block_tags_b = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|'.
                         'script|noscript|form|fieldset|iframe|math';
-
+        
         // First, look for nested blocks, for example:
         // 
         //     <div>
@@ -138,7 +138,7 @@
             array($this, '_parse'),
             $text
         );
-
+        
         // Now match more liberally, simply from `\n<tag>` to `</tag>\n`
         $text = preg_replace_callback("{
                     (                           # save in $1
@@ -154,7 +154,7 @@
             array($this, '_parse'),
             $text
         );
-
+        
         // Special case just for <hr />. It was easier to make a special
         // case than to make the other regex more complicated.
         $text = preg_replace_callback('{
@@ -176,7 +176,7 @@
             array($this, '_parse'),
             $text
         );
-
+        
         // Special case for standalone HTML comments:
         $text = preg_replace_callback('{
                 (?:
@@ -198,7 +198,7 @@
             array($this, '_parse'),
             $text
         );
-
+        
         return $text;
     }
     

Modified: trunk/Solar/Markdown/Plugin/Image.php
===================================================================
--- trunk/Solar/Markdown/Plugin/Image.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/Image.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -75,22 +75,22 @@
               !\[
                 ('.$this->_nested_brackets.')   # alt text = $2
               \]
-
+              
               [ ]?                              # one optional space
               (?:\n[ ]*)?                       # one optional newline followed by spaces
                             
               \[            
                 (.*?)                           # id = $3
               \]
-
+            
             )
             }xs', 
             array($this, '_parseReference'),
             $text
         );
-
-        # Next, handle inline images:  ![alt text](url "optional title")
-        # Don't forget: encode * and _
+        
+        // Next, handle inline images:  ![alt text](url "optional title")
+        // Don't forget: encode * and _
         $text = preg_replace_callback('{
             (                                   # wrap whole match in $1
               !\[
@@ -112,7 +112,7 @@
             array($this, '_parseInline'),
             $text
         );
-
+        
         return $text;
     }
     
@@ -130,12 +130,12 @@
         $whole_match = $matches[1];
         $alt         = $matches[2];
         $name        = strtolower(trim($matches[3]));
-
+        
         if (empty($name)) {
             // for shortcut links like ![this][].
             $name = strtolower($alt);
         }
-
+        
         $link = $this->_markdown->getLink($name);
         if ($link) {
             
@@ -154,7 +154,7 @@
             // no matching link reference
             $result = $whole_match;
         }
-
+        
         // encode special Markdown characters
         $result = $this->_encode($result);
         

Modified: trunk/Solar/Markdown/Plugin/Link.php
===================================================================
--- trunk/Solar/Markdown/Plugin/Link.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/Link.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -83,7 +83,7 @@
                   \\[
                     (".$this->_nested_brackets.")    # link text = $2
                   \\]
-
+                  
                   [ ]?                               # one optional space
                   (?:\\n[ ]*)?                       # one optional newline followed by spaces
                                                  
@@ -95,7 +95,7 @@
             array($this, '_parseReference'),
             $text
         );
-
+        
         // Next, inline-style links: [link text](url "optional title")
         $text = preg_replace_callback("{
                 (                                   # wrap whole match in $1
@@ -117,7 +117,7 @@
             array($this, '_parseInline'),
             $text
         );
-
+        
         return $text;
     }
     
@@ -135,7 +135,7 @@
         $whole_match = $matches[1];
         $alt_text    = $matches[2];
         $name        = strtolower(trim($matches[3]));
-
+        
         if (empty($name)) {
             // for shortcut links like [this][].
             $name = strtolower($alt_text);
@@ -177,7 +177,7 @@
     {
         $alt_text = $this->_escape($matches[2]);
         $href     = $this->_escape($matches[3]);
-
+        
         $result   = "<a href=\"$href\"";
         
         if (! empty($matches[6])) {
@@ -189,7 +189,7 @@
         
         // encode special Markdown characters
         $result = $this->_encode($result);
-
+        
         return $this->_toHtmlToken($result);
     }
 }

Modified: trunk/Solar/Markdown/Plugin/List.php
===================================================================
--- trunk/Solar/Markdown/Plugin/List.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/List.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -88,14 +88,14 @@
     public function parse($text)
     {
         $less_than_tab = $this->_getTabWidth() - 1;
-
+        
         // Re-usable patterns to match list item bullets and number markers:
         $marker_ul  = '[*+-]';
         $marker_ol  = '\d+[.]';
         $marker_any = "(?:$marker_ul|$marker_ol)";
-
+        
         $markers = array($marker_ul, $marker_ol);
-
+        
         foreach ($markers as $marker) {
             // Re-usable pattern to match any entire ul or ol list:
             $whole_list = '
@@ -139,7 +139,7 @@
                 );
             }
         }
-
+        
         return $text;
     }
     
@@ -185,7 +185,7 @@
      */
     protected function _parseNested($matches)
     {
-        # Re-usable patterns to match list item bullets and number markers:
+        // Re-usable patterns to match list item bullets and number markers:
         $marker_ul  = '[*+-]';
         $marker_ol  = '\d+[.]';
         $marker_any = "(?:$marker_ul|$marker_ol)";
@@ -195,8 +195,8 @@
     
         $marker_any = ( $list_type == "ul" ? $marker_ul : $marker_ol );
     
-        # Turn double returns into triple returns, so that we can make a
-        # paragraph for the last item in a list, if necessary:
+        // Turn double returns into triple returns, so that we can make a
+        // paragraph for the last item in a list, if necessary:
         $list = preg_replace("/\n{2,}/", "\n\n\n", $list);
         $result = $this->_processItems($list, $marker_any);
         return $this->_toHtmlToken("<$list_type>\n" . $result . "</$list_type>") . "\n\n"; // extra \n?
@@ -239,7 +239,7 @@
         // change the syntax rules such that sub-lists must start with a
         // starting cardinal number; for example "1." or "a.".
         $this->_list_level ++;
-
+        
         // trim trailing blank lines:
         $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
         
@@ -255,7 +255,7 @@
             array($this, '_processItemsCallback'),
             $list_str
         );
-
+        
         $this->_list_level --;
         return $list_str;
     }
@@ -274,7 +274,7 @@
         $item = $matches[4];
         $leading_line =& $matches[1];
         $leading_space =& $matches[2];
-
+        
         if ($leading_line || preg_match('/\n{2,}/', $item)) {
             $item = $this->_processBlocks($this->_outdent($item));
         } else {

Modified: trunk/Solar/Markdown/Plugin/Prefilter.php
===================================================================
--- trunk/Solar/Markdown/Plugin/Prefilter.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/Prefilter.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -57,13 +57,13 @@
     {
         // Standardize DOS and Mac OS 9 line endings
         $text = str_replace(array("\r\n", "\r"), "\n", $text);
-
+        
         // Make sure $text ends with a couple of newlines:
         $text .= "\n\n";
-
+        
         // Convert tabs to spaces in a surprisingly nice-looking way.
         $text = $this->_tabsToSpaces($text);
-
+        
         // Convert lines consisting only of spaces and tabs to simple
         // newlines.
         //
@@ -79,7 +79,7 @@
     /**
      * 
      * Replaces tabs with the appropriate number of spaces.
-     *
+     * 
      * <http://www.mail-archive.com/macperl-anyperl@perl.org/msg00144.html>
      * 
      * > It will take into account the length of the string before the tab

Modified: trunk/Solar/Markdown/Plugin/StripLinkDefs.php
===================================================================
--- trunk/Solar/Markdown/Plugin/StripLinkDefs.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/StripLinkDefs.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -57,8 +57,8 @@
     public function prepare($text)
     {
         $less_than_tab = $this->_getTabWidth() - 1;
-
-        # Link defs are in the form: ^[id]: url "optional title"
+        
+        // Link defs are in the form: ^[id]: url "optional title"
         $text = preg_replace_callback('{
                 ^[ ]{0,'.$less_than_tab.'}\[(.+)\]:  # id = $1
                   [ \t]*                             

Modified: trunk/Solar/Markdown/Plugin/Uri.php
===================================================================
--- trunk/Solar/Markdown/Plugin/Uri.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Plugin/Uri.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -89,8 +89,8 @@
             array($this, '_parse'),
             $text
         );
-
-        # Email addresses: <address at domain.foo>
+        
+        // email addresses: <address at domain.foo>
         $text = preg_replace_callback('{
                 <
                     (?:mailto:)?
@@ -104,10 +104,10 @@
             array($this, '_parseEmail'),
             $text
         );
-
+        
         return $text;
     }
-
+    
     /**
      * 
      * Support callback for inline URIs.
@@ -152,7 +152,7 @@
         $addr = $matches[1];
         $addr = "mailto:" . $addr;
         $length = strlen($addr);
-
+        
         // leave ':' alone (to spot mailto: later)
         // this is super-slow; it makes the callback one time for each
         // character in the string except ':'.
@@ -161,11 +161,12 @@
             array($this, '_obfuscateEmail'),
             $addr
         );
-
+        
         $addr = "<a href=\"$addr\">$addr</a>";
-        # strip the mailto: from the visible part
+        
+        // strip the mailto: from the visible part
         $addr = preg_replace('/">.+?:/', '">', $addr);
-
+        
         return $addr;
     }
     

Modified: trunk/Solar/Markdown/Wiki/Header.php
===================================================================
--- trunk/Solar/Markdown/Wiki/Header.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Wiki/Header.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -143,7 +143,7 @@
         // done
         return $text;
     }
-
+    
     /**
      * 
      * Support callback for ATX headers.
@@ -185,7 +185,7 @@
     {
         return $this->_header('h1', $matches);
     }
-
+    
     /**
      * 
      * Support callback for H2 headers.
@@ -199,7 +199,7 @@
     {
         return $this->_header('h2', $matches);
     }
-
+    
     /**
      * 
      * Support callback for H3 headers.
@@ -213,7 +213,7 @@
     {
         return $this->_header('h3', $matches);
     }
-
+    
     /**
      * 
      * Support callback for H4 headers.

Modified: trunk/Solar/Markdown/Wiki/Link.php
===================================================================
--- trunk/Solar/Markdown/Wiki/Link.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Wiki/Link.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -191,7 +191,7 @@
      * @param array $config Array of user-defined configuariont values.
      * 
      */
-    public function __construct($config)
+    public function __construct($config = null)
     {
         parent::__construct($config);
         $this->_class = get_class($this);
@@ -410,7 +410,7 @@
         $pos = strpos($matches[1], '::');
         $site = trim(substr($matches[1], 0, $pos));
         $page = trim(substr($matches[1], $pos + 2));
-
+        
         // does the requested interwiki site exist?
         if (empty($this->_interwiki[$site])) {
             return $matches[0];

Modified: trunk/Solar/Markdown/Wiki/MethodSynopsis.php
===================================================================
--- trunk/Solar/Markdown/Wiki/MethodSynopsis.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown/Wiki/MethodSynopsis.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -97,7 +97,7 @@
         'throws'        => "\n    <span class=\"throws\">throws <span class=\"type\">%type</span></span>",
         'list_sep'      => ', ',
     );
-
+    
     /**
      * 
      * Converts method synopsis to XHTML markup.
@@ -202,18 +202,18 @@
         $html['%access'] = str_replace('%access', $this->_escape($access), $this->_config['access']);
         $html['%return'] = str_replace('%return', $this->_escape($return), $this->_config['return']);
         $html['%method'] = str_replace('%method', $this->_escape($method), $this->_config['method']);
-
+        
         // params
         $list = array();
         foreach ($params as $key => $val) {
-
+            
             // is there a default value?
             if (! is_null($val['default'])) {
                 $item = $this->_config['param_default'];
             } else {
                 $item = $this->_config['param'];
             }
-
+            
             // add the param elements
             $item = str_replace('%type',    $this->_escape($val['type']),    $item);
             $item = str_replace('%name',    $this->_escape($val['name']),    $item);
@@ -221,7 +221,7 @@
             $list[] = $item;
         }
         $html['%params'] = implode($this->_config['list_sep'], $list);
-
+        
         // throws
         $list = array();
         foreach ($throws as $type) {
@@ -229,10 +229,10 @@
             $item = str_replace('%type', $this->_escape($type), $item);
             $list[] = $item;
         }
-
+        
         // insert throws into output
         $html['%throws'] = implode($this->_config['list_sep'], $list);
-
+        
         // build the whole thing
         $html = str_replace(
             array_keys($html),

Modified: trunk/Solar/Markdown.php
===================================================================
--- trunk/Solar/Markdown.php	2007-10-06 15:52:14 UTC (rev 2824)
+++ trunk/Solar/Markdown.php	2007-10-06 15:53:31 UTC (rev 2825)
@@ -734,7 +734,7 @@
     {
         $index = 0;
         $list = array();
-
+        
         $match = '(?s:<!(?:--.*?--\s*)+>)|'.    # comment
                  '(?s:<\?.*?\?>)|'.             # processing instruction
                                                 # regular tags
@@ -749,7 +749,7 @@
                 $list[] = array('tag', $part);
             }
         }
-
+        
         return $list;
     }
     




More information about the Solar-svn mailing list