Changeset 514862
- Timestamp:
- 03/05/2012 07:03:23 PM (14 years ago)
- Location:
- wp-auto-columns/trunk
- Files:
-
- 2 edited
-
include/HTMLSplitter.php (modified) (6 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-auto-columns/trunk/include/HTMLSplitter.php
r514831 r514862 30 30 ); 31 31 $this->headers = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'); 32 $this->splittable = array('div', 'p', 'ul' );32 $this->splittable = array('div', 'p', 'ul', 'ol'); 33 33 $this->break = array('br'); 34 34 } … … 71 71 $current_tag = $node->name; 72 72 73 $item = 1; 74 $start = 1; 73 75 $children = array(); 74 76 foreach ($node->children as $childNode) … … 86 88 { 87 89 // construct node 88 $nodeText = $this->constructStartTag($node) . implode('', $children) . '</' . $current_tag . '>'; 90 $nodeText = $this->constructStartTag($node, $start) . implode('', $children) . '</' . $current_tag . '>'; 91 $start = $item + 1; 89 92 $cols[$column][] = $nodeText; 90 93 $children = array(); … … 98 101 } 99 102 } 103 104 if ($childNode->name == 'li') 105 { 106 $item++; 107 } 100 108 } 101 109 … … 104 112 { 105 113 // construct node 106 $nodeText = $this->constructStartTag($node ) . implode('', $children) . '</' . $current_tag . '>';114 $nodeText = $this->constructStartTag($node, $start) . implode('', $children) . '</' . $current_tag . '>'; 107 115 $cols[$column][] = $nodeText; 108 116 … … 147 155 * @return string 148 156 */ 149 protected function constructStartTag($node )157 protected function constructStartTag($node, $start = '') 150 158 { 151 159 $ret = '<'; 152 160 $ret .= $node->name; 153 161 154 if ($node->node->hasAttributes() )162 if ($node->node->hasAttributes() || $node->name == 'ol') 155 163 { 156 164 $attributes = array(); 165 166 if ($node->name == 'ol') 167 { 168 $attributes[] = 'start="' . $start . '"'; 169 } 157 170 158 171 $length = $node->node->attributes->length; -
wp-auto-columns/trunk/readme.txt
r514833 r514862 5 5 Requires at least: 3.1.0 6 6 Tested up to: 3.3.1 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 9 9 Wrap block of text with shortcode. It will be split into columns. Automagically. … … 19 19 * splits long paragraphs and unordered lists; 20 20 * keeps text with headers; 21 * does not split ordered lists to keep right order.22 21 23 22 Wrap block of text with `[auto_columns]...[/auto_columns]` shortcode. It will produce markup like … … 53 52 == Changelog == 54 53 55 = 1.0 = 54 = 1.0.1 = 55 * Fixed `<ol>` behavior 56 57 = 1.0.0 = 56 58 * First public release 57 59
Note: See TracChangeset
for help on using the changeset viewer.