Created
December 9, 2015 13:18
-
-
Save aalexeev239/69aa20708c7ca2f0f945 to your computer and use it in GitHub Desktop.
Generate table of contents for css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var generate = function(sChapters, sPrefix, nFrom) { | |
var output1 = '', output2 = ''; | |
var prefix = sPrefix || ''; | |
var from = parseInt(nFrom) || 1; | |
var temp; | |
for (var i = 0; i < sChapters.length; i++) { | |
temp = prefix + (nFrom + i) + '. ' + sChapters[i]; | |
output1 += temp + '\n'; | |
output2 += '/\u002A---------- ' + temp + ' ----------\u002A/' + '\n'; | |
} | |
return '/\u002A\n\n' + output1 + '\n\u002A/'+'\n\n' + output2; | |
}; | |
var chapters = ['login', 'forms']; | |
console.log(generate(chapters,'th',1)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment