makeRst

SourceFile.makeRst(fs, dir_path)

ソース

    makeRst(fs, dir_path) {
        var rst = "";

        rst += this.fileName + "\n";
        rst += "=".repeat(this.fileName.length) + "\n\n";

        if (this.comment != null) {

            rst += "説明\n^^^^^^\n\n";
            rst += this.comment + "\n\n";
        }

        rst += `

.. toctree::
    :maxdepth: 1
    :caption: 関数:

`;

        for(let fnc of this.functions) {
            fnc.makeRst(fs, dir_path);

            rst += "    " + fnc.fncName + "\n";
        }


        rst += `

.. toctree::
    :maxdepth: 1
    :caption: クラス:

`;

        for(let cls of this.classes) {
            fs.mkdirsSync(dir_path + cls.className);
            cls.makeRst(fs, dir_path + cls.className + "/");

            rst += "    " + cls.className + "/index\n";
        }

        fs.writeFile(dir_path + 'index.rst', rst);
    }