Index: trunk/parsers/wikidom/lib/es/es.ListBlockItem.js |
— | — | @@ -147,6 +147,30 @@ |
148 | 148 | }; |
149 | 149 | |
150 | 150 | /** |
| 151 | + * Gets a depth level for the item in list. |
| 152 | + * Example: |
| 153 | + * |
| 154 | + * # level 0 |
| 155 | + * ## level 1 |
| 156 | + * # level 0 |
| 157 | + * ### level 2 |
| 158 | + * |
| 159 | + * @method |
| 160 | + * @returns {Integer} Depth level |
| 161 | + */ |
| 162 | +es.ListBlockItem.prototype.getLevel = function( position ) { |
| 163 | + var start = this.list.item, |
| 164 | + level = 0; |
| 165 | + |
| 166 | + while ( start ) { |
| 167 | + start = start.list.item; |
| 168 | + level++; |
| 169 | + } |
| 170 | + |
| 171 | + return level; |
| 172 | +}; |
| 173 | + |
| 174 | +/** |
151 | 175 | * Renders content and sub-lists. |
152 | 176 | * |
153 | 177 | * @method |