Changeset 3674
- Timestamp:
- 01/29/08 23:45:44 (17 months ago)
- Location:
- branches
- Files:
-
- 10 modified
-
0.10/lib/Doctrine/Task/Dql.php (modified) (1 diff)
-
0.10/manual/lib/Text/Wiki/Render/Latex/Code.php (modified) (1 diff)
-
0.10/manual/lib/Text/Wiki/Render/Xhtml/Code.php (modified) (3 diffs)
-
0.10/manual/styles/basic.css (modified) (3 diffs)
-
0.10/vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php (modified) (13 diffs)
-
0.9/lib/Doctrine/Task/Dql.php (modified) (1 diff)
-
0.9/manual/lib/Text/Wiki/Render/Latex/Code.php (modified) (1 diff)
-
0.9/manual/lib/Text/Wiki/Render/Xhtml/Code.php (modified) (3 diffs)
-
0.9/manual/styles/basic.css (modified) (3 diffs)
-
0.9/vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.10/lib/Doctrine/Task/Dql.php
r3673 r3674 35 35 public $description = 'Execute dql query and display the results', 36 36 $requiredArguments = array('models_path' => 'Specify path to your Doctrine_Record definitions.', 37 'dql_query' =>'Specify the complete dql query to execute.'),38 $optionalArguments = array( );37 'dql_query' => 'Specify the complete dql query to execute.'), 38 $optionalArguments = array('params' => 'Comma separated list of the params to replace the ? tokens in the dql'); 39 39 40 40 public function execute() -
branches/0.10/manual/lib/Text/Wiki/Render/Latex/Code.php
r2308 r3674 31 31 } 32 32 33 $text = "\\begin{lstlisting} \n$text\n\\end{lstlisting}\n\n";33 $text = "\\begin{lstlisting}[caption={} {}]\n$text\n\\end{lstlisting}\n\n"; 34 34 35 35 if ($type != '') { -
branches/0.10/manual/lib/Text/Wiki/Render/Xhtml/Code.php
r2308 r3674 31 31 'css_php' => null, // class for PHP <code> 32 32 'css_html' => null, // class for HTML <code> 33 'css_filename' => null // class for optional filename <div> 33 'css_filename' => null, // class for optional filename <div> 34 'code_begin_callback' => null 34 35 ); 35 36 … … 48 49 49 50 function token($options) 50 { 51 { 51 52 $text = $options['text']; 52 53 $attr = $options['attr']; … … 105 106 } 106 107 108 $callback = $this->getConf('code_begin_callback'); 109 if ($callback) { 110 $text = call_user_func($callback) . $text; 111 } 112 107 113 return "\n$text\n\n"; 108 114 } -
branches/0.10/manual/styles/basic.css
r2625 r3674 47 47 } 48 48 49 p.caption { 50 font-style: italic; 51 } 52 49 53 dd { 50 54 margin-bottom: 0.5em; … … 111 115 background-color: #f7f7f7; 112 116 border: 1px solid #d7d7d7; 113 117 114 118 /* Pup's Box Flow Hack, Rev 2 */ 115 119 overflow/**/: auto; … … 121 125 /* overflow: auto causes artefacts */ 122 126 overflow: hidden; 123 127 124 128 /* prevents text to be hidden by wrapping it */ 125 white-space: -moz-pre-wrap !important; 129 white-space: -moz-pre-wrap !important; 126 130 } 127 131 -
branches/0.10/vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php
r2963 r3674 35 35 /** 36 36 * Available options 37 * 37 * 38 38 * (Sensei_Doc_Section|null) section : 39 39 * Section to be rendered. If null all sections will be rendered. 40 40 * 41 41 * (string) url_prefix : 42 * All URLs pointing to sections will be prefixed with this. 42 * All URLs pointing to sections will be prefixed with this. 43 43 */ 44 44 protected $_options = array( … … 46 46 'url_prefix' => '' 47 47 ); 48 48 49 private $_chapter; 50 private $_codeListingsIndex; 51 49 52 public function __construct(Sensei_Doc_Toc $toc, array $options = array()) 50 53 { 51 54 parent::__construct($toc, $options); 52 55 53 56 $this->_wiki->setRenderConf('xhtml', 'Doclink', 'url_callback', array(&$this, 'makeUrl')); 57 $this->_wiki->setRenderConf('xhtml', 'Code', 'code_begin_callback', array(&$this, 'codeListingsNumberingCallback')); 54 58 } 55 59 56 60 /** 57 61 * Renders table of contents as nested unordered lists. 58 * 62 * 59 63 * @return string rendered table of contents 60 64 */ … … 73 77 { 74 78 $output = ''; 75 79 76 80 if ($section instanceof Sensei_Doc_Toc) { 77 81 $class = ' class="tree"'; … … 81 85 $class = ''; 82 86 } 83 87 84 88 $output .= '<ul' . $class . '>' . "\n"; 85 89 86 90 for ($i = 0; $i < $section->count(); $i++) { 87 91 $child = $section->getChild($i); 88 92 89 93 $text = $child->getIndex() . ' ' . $child->getName(); 90 94 $href = $this->makeUrl($child); 91 95 92 96 $output .= '<li><a href="' . $href . '">' . $text . '</a>'; 93 97 94 98 if ($child->count() > 0) { 95 99 $output .= "\n"; 96 100 $output .= $this->_renderToc($child); 97 101 } 98 102 99 103 $output .= '</li>' . "\n"; 100 104 } 101 105 102 106 $output .= '</ul>' . "\n"; 103 107 104 108 return $output; 105 109 } … … 114 118 { 115 119 $section = $this->_options['section']; 116 120 117 121 if ($section instanceof Sensei_Doc_Section) { 118 122 119 123 $content = $this->_renderSection($section); 120 121 } else { 122 123 // No section was set, so let's render all sections 124 125 } else { 126 127 // No section was set, so let's render all sections 124 128 $content = ''; 125 129 for ($i = 0; $i < count($this->_toc); $i++) { … … 127 131 } 128 132 } 129 133 130 134 $output = $this->_options['template']; 131 135 132 136 $output = str_replace('%TITLE%', $this->_options['title'], $output); 133 137 $output = str_replace('%AUTHOR%', $this->_options['author'], $output); … … 136 140 $output = str_replace('%TOC%', $this->renderToc(), $output); 137 141 $output = str_replace('%CONTENT%', $content, $output); 138 142 139 143 return $output; 140 144 } … … 149 153 { 150 154 $output = ''; 151 155 152 156 $title = $section->getIndex() . ' ' . $section->getName(); 153 157 $level = $section->getLevel(); 154 158 155 159 if ($level === 1) { 156 160 $class = ' class="chapter"'; … … 159 163 $class = ' class="section"'; 160 164 } 161 165 162 166 $output .= '<div' . $class .'>' . "\n"; 163 167 164 168 $output .= "<h$level>"; 165 169 166 170 if ( ! ($this->_options['section'] instanceof Sensei_Doc_Section) 167 171 || ($level > $this->_options['section']->getLevel())) { … … 172 176 $output .= $title; 173 177 } 174 178 175 179 $output .= "</h$level>"; 176 180 177 181 // Transform section contents from wiki syntax to XHTML 178 182 $output .= $this->_wiki->transform($section->getText()); 179 183 180 184 // Render children of this section recursively 181 185 for ($i = 0; $i < count($section); $i++) { 182 186 $output .= $this->_renderSection($section->getChild($i)); 183 187 } 184 188 185 189 $output .= '</div>' . "\n"; 186 187 return $output; 188 } 189 190 191 return $output; 192 } 193 190 194 public function makeUrl($section) 191 195 { … … 195 199 $path = $section; 196 200 } 197 201 198 202 $url = $this->_options['url_prefix']; 199 203 200 204 if ($this->_options['section'] instanceof Sensei_Doc_Section) { 201 205 $level = $this->_options['section']->getLevel(); 202 206 $url .= implode(':', array_slice(explode(':', $path), 0, $level)); 203 207 } 204 208 205 209 $anchor = $this->makeAnchor($section); 206 210 if ($anchor !== '') { 207 211 $url .= '#' . $anchor; 208 212 } 209 213 210 214 return $url; 211 215 } 212 216 213 217 public function makeAnchor($section) 214 218 { … … 218 222 $path = $section; 219 223 } 220 224 221 225 if ($this->_options['section'] instanceof Sensei_Doc_Section) { 222 226 $level = $this->_options['section']->getLevel(); … … 226 230 } 227 231 } 232 233 public function codeListingsNumberingCallback() 234 { 235 $this->_codeListingsIndex++; 236 $html = '<p class="caption">Listing ' . $this->_chapter . '.' 237 . $this->_codeListingsIndex . "</p>\n"; 238 return $html; 239 } 228 240 } -
branches/0.9/lib/Doctrine/Task/Dql.php
r3673 r3674 35 35 public $description = 'Execute dql query and display the results', 36 36 $requiredArguments = array('models_path' => 'Specify path to your Doctrine_Record definitions.', 37 'dql_query' =>'Specify the complete dql query to execute.'),38 $optionalArguments = array( );39 37 'dql_query' => 'Specify the complete dql query to execute.'), 38 $optionalArguments = array('params' => 'Comma separated list of the params to replace the ? tokens in the dql'); 39 40 40 public function execute() 41 41 { -
branches/0.9/manual/lib/Text/Wiki/Render/Latex/Code.php
r2308 r3674 31 31 } 32 32 33 $text = "\\begin{lstlisting} \n$text\n\\end{lstlisting}\n\n";33 $text = "\\begin{lstlisting}[caption={} {}]\n$text\n\\end{lstlisting}\n\n"; 34 34 35 35 if ($type != '') { -
branches/0.9/manual/lib/Text/Wiki/Render/Xhtml/Code.php
r2308 r3674 31 31 'css_php' => null, // class for PHP <code> 32 32 'css_html' => null, // class for HTML <code> 33 'css_filename' => null // class for optional filename <div> 33 'css_filename' => null, // class for optional filename <div> 34 'code_begin_callback' => null 34 35 ); 35 36 … … 48 49 49 50 function token($options) 50 { 51 { 51 52 $text = $options['text']; 52 53 $attr = $options['attr']; … … 105 106 } 106 107 108 $callback = $this->getConf('code_begin_callback'); 109 if ($callback) { 110 $text = call_user_func($callback) . $text; 111 } 112 107 113 return "\n$text\n\n"; 108 114 } -
branches/0.9/manual/styles/basic.css
r2625 r3674 47 47 } 48 48 49 p.caption { 50 font-style: italic; 51 } 52 49 53 dd { 50 54 margin-bottom: 0.5em; … … 111 115 background-color: #f7f7f7; 112 116 border: 1px solid #d7d7d7; 113 117 114 118 /* Pup's Box Flow Hack, Rev 2 */ 115 119 overflow/**/: auto; … … 121 125 /* overflow: auto causes artefacts */ 122 126 overflow: hidden; 123 127 124 128 /* prevents text to be hidden by wrapping it */ 125 white-space: -moz-pre-wrap !important; 129 white-space: -moz-pre-wrap !important; 126 130 } 127 131 -
branches/0.9/vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php
r2963 r3674 35 35 /** 36 36 * Available options 37 * 37 * 38 38 * (Sensei_Doc_Section|null) section : 39 39 * Section to be rendered. If null all sections will be rendered. 40 40 * 41 41 * (string) url_prefix : 42 * All URLs pointing to sections will be prefixed with this. 42 * All URLs pointing to sections will be prefixed with this. 43 43 */ 44 44 protected $_options = array( … … 46 46 'url_prefix' => '' 47 47 ); 48 48 49 private $_chapter; 50 private $_codeListingsIndex; 51 49 52 public function __construct(Sensei_Doc_Toc $toc, array $options = array()) 50 53 { 51 54 parent::__construct($toc, $options); 52 55 53 56 $this->_wiki->setRenderConf('xhtml', 'Doclink', 'url_callback', array(&$this, 'makeUrl')); 57 $this->_wiki->setRenderConf('xhtml', 'Code', 'code_begin_callback', array(&$this, 'codeListingsNumberingCallback')); 54 58 } 55 59 56 60 /** 57 61 * Renders table of contents as nested unordered lists. 58 * 62 * 59 63 * @return string rendered table of contents 60 64 */ … … 73 77 { 74 78 $output = ''; 75 79 76 80 if ($section instanceof Sensei_Doc_Toc) { 77 81 $class = ' class="tree"'; … … 81 85 $class = ''; 82 86 } 83 84 $output .= '<ul' . $class . '>' . "\n"; 85 87 88 $output .= '<ul' . $class . '>' . "\n"; 89 86 90 for ($i = 0; $i < $section->count(); $i++) { 87 91 $child = $section->getChild($i); 88 92 89 93 $text = $child->getIndex() . ' ' . $child->getName(); 90 94 $href = $this->makeUrl($child); 91 95 92 96 $output .= '<li><a href="' . $href . '">' . $text . '</a>'; 93 97 94 98 if ($child->count() > 0) { 95 99 $output .= "\n"; 96 100 $output .= $this->_renderToc($child); 97 101 } 98 102 99 103 $output .= '</li>' . "\n"; 100 104 } 101 105 102 106 $output .= '</ul>' . "\n"; 103 107 104 108 return $output; 105 109 } … … 114 118 { 115 119 $section = $this->_options['section']; 116 120 117 121 if ($section instanceof Sensei_Doc_Section) { 118 122 119 123 $content = $this->_renderSection($section); 120 121 } else { 122 123 // No section was set, so let's render all sections 124 125 } else { 126 127 // No section was set, so let's render all sections 124 128 $content = ''; 125 129 for ($i = 0; $i < count($this->_toc); $i++) { … … 127 131 } 128 132 } 129 133 130 134 $output = $this->_options['template']; 131 135 132 136 $output = str_replace('%TITLE%', $this->_options['title'], $output); 133 137 $output = str_replace('%AUTHOR%', $this->_options['author'], $output); … … 136 140 $output = str_replace('%TOC%', $this->renderToc(), $output); 137 141 $output = str_replace('%CONTENT%', $content, $output); 138 142 139 143 return $output; 140 144 } … … 149 153 { 150 154 $output = ''; 151 155 152 156 $title = $section->getIndex() . ' ' . $section->getName(); 153 157 $level = $section->getLevel(); 154 158 155 159 if ($level === 1) { 156 160 $class = ' class="chapter"'; … … 159 163 $class = ' class="section"'; 160 164 } 161 165 162 166 $output .= '<div' . $class .'>' . "\n"; 163 167 164 168 $output .= "<h$level>"; 165 169 166 170 if ( ! ($this->_options['section'] instanceof Sensei_Doc_Section) 167 171 || ($level > $this->_options['section']->getLevel())) { … … 172 176 $output .= $title; 173 177 } 174 178 175 179 $output .= "</h$level>"; 176 180 177 181 // Transform section contents from wiki syntax to XHTML 178 182 $output .= $this->_wiki->transform($section->getText()); 179 183 180 184 // Render children of this section recursively 181 185 for ($i = 0; $i < count($section); $i++) { 182 186 $output .= $this->_renderSection($section->getChild($i)); 183 187 } 184 188 185 189 $output .= '</div>' . "\n"; 186 187 return $output; 188 } 189 190 191 return $output; 192 } 193 190 194 public function makeUrl($section) 191 195 { … … 195 199 $path = $section; 196 200 } 197 201 198 202 $url = $this->_options['url_prefix']; 199 203 200 204 if ($this->_options['section'] instanceof Sensei_Doc_Section) { 201 205 $level = $this->_options['section']->getLevel(); 202 206 $url .= implode(':', array_slice(explode(':', $path), 0, $level)); 203 207 } 204 208 205 209 $anchor = $this->makeAnchor($section); 206 210 if ($anchor !== '') { 207 211 $url .= '#' . $anchor; 208 212 } 209 213 210 214 return $url; 211 215 } 212 216 213 217 public function makeAnchor($section) 214 218 { … … 218 222 $path = $section; 219 223 } 220 224 221 225 if ($this->_options['section'] instanceof Sensei_Doc_Section) { 222 226 $level = $this->_options['section']->getLevel(); … … 226 230 } 227 231 } 232 233 public function codeListingsNumberingCallback() 234 { 235 $this->_codeListingsIndex++; 236 $html = '<p class="caption">Listing ' . $this->_chapter . '.' 237 . $this->_codeListingsIndex . "</p>\n"; 238 return $html; 239 } 228 240 }