http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94179

Revision: 94179
Author:   inez
Date:     2011-08-10 18:06:47 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
Implementation of getLevel method that gets a depth level for the item in list.

Modified Paths:
--------------
    trunk/parsers/wikidom/lib/es/es.ListBlockItem.js

Modified: trunk/parsers/wikidom/lib/es/es.ListBlockItem.js
===================================================================
--- trunk/parsers/wikidom/lib/es/es.ListBlockItem.js    2011-08-10 18:05:43 UTC 
(rev 94178)
+++ trunk/parsers/wikidom/lib/es/es.ListBlockItem.js    2011-08-10 18:06:47 UTC 
(rev 94179)
@@ -147,6 +147,30 @@
 };
 
 /**
+ * Gets a depth level for the item in list.
+ * Example:
+ * 
+ * # level 0
+ * ## level 1
+ * # level 0
+ * ### level 2
+ * 
+ * @method
+ * @returns {Integer} Depth level
+ */
+es.ListBlockItem.prototype.getLevel = function( position ) {
+       var start = this.list.item,
+               level = 0;
+
+       while ( start ) {
+               start = start.list.item;
+               level++;
+       }
+
+       return level;
+};
+
+/**
  * Renders content and sub-lists.
  * 
  * @method


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to