indentation-to-toggling-list

HTML

<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<div class="IndentationToTogglingList">
<pre>Part B, Origination Through Closing
	B1, Loan Application Package
		B1-1 Application Package Documentation
			B1-1-01, Contents of the Application Package 
			B1-1-02, Blanket Authorization Form  
			B1-1-03, Allowable Age of Credit Documents and Federal Income Tax Returns  
	B2 Eligibility
		B2-1, Mortgage Eligibility
			B2-1-01, Occupancy Types  
			B2-1.1, LTV CLTV, HCLTV, and Subordinate Financing
				B2-1.1-01, Loan -to -Value (LTV) Ratios  
				B2-1.1-02, Combined Loan -to -Value (CLTV) Ratios  
				B2-1.1-03, Home Equity Combined Loan -to -Value (HCLTV) Ratios
				B2-1.1-04, Subordinate Financing 
			B2-1.2, Loan Purpose 
				B2-1.2-01, Purchase Transactions 
				B2-1.2-02, Limited Cash -Out Refinance Transactions  
				B2-1.2-03, Cash -Out Refinance Transactions  
				B2-1.2-04, DELETED TOPIC: Continuity of Obligation 
				B2-1.2-05, Prohibited Refinancing Practices 
				B2-1.2-06, Payoff of Installment Land Contract Requirements</pre>
</div>

CSS

ol.Directory {
  line-height: normal;
}
ol.Directory li
{
  list-style: none;
}
ol.Directory li label
{
  color:navy;
}
ol.Directory li label.ToggleOnClick
{
  cursor: pointer;
  font-weight: 600;
}

JavaScript

jQuery(function($) {

    'use strict';
    IndentationToTogglingList();
    return;

    function IndentationToList(options) {

        return Main(options);


        function Interpolate(template, variables) {
            var names = Object.keys(variables);
            var result = template;
            for (var i = 0, iTop = names.length; i < iTop; i++) {
                var name = names[i];
                var value = variables[name];
                var re = RegExp('\\b' + name + '\\b', 'g');
                result = result.replace(re, value);
            }
            return result;
        }

        function Parse(lineText, lineNumber, indent) {
            var aux = lineText.split(indent);
            var result = {
                'level': aux.length - 1,
                'label': aux.pop(),
                'line': lineNumber
            };
            return result;
        }

        function InitOptions(options) {
            var defaultOptions = {
                indent: '  ',
                templates: {
                    folder: '<li class="folder"> <label class="ToggleOnClick" for="ID">FOLDER</label> <ol>CONTENT</ol> </li>',
                    file: '<li class="File">FILE</li>',
                    folderWithoutContent: '<li class="Folder"><label for="ID">FOLDER</label></li>',
                    contentWithoutFolder: '<ol class="Directory">CONTENT</ol>'
                },
                text: ''
            };
            if (options.constructor.name !== 'Object') {
                options = {
                    text: String(options)
                };
            }
            var result = {
                indent: options.indent || defaultOptions.indent,
                templates: options.templates || defaultOptions.templates,
                text: options.text
            };
            return result;
        }

        function InitLines(text) {
            var result = text.
            replace('\r\n', '\n'). // remove double line...