node/jade-middleware.js
function hasMatchingJadeFileInPages(srcDir, url, pages, jadeOptions, callback) {
    if (typeof pages[url] === 'undefined') {
        // get the possible jade file path
        var extension = path.extname(url);
        var jadeFilePath;
        var htmlFilePath;
        if (extension === ".html" /* || extension === ".htm" */) {
            jadeFilePath = path.join(srcDir, url.substring(0, url.length - extension.length) + ".jade");
            htmlFilePath = path.join(srcDir, url);
        } else {
            jadeFilePath = path.join(srcDir, url + "/index.jade");
            htmlFilePath = path.join(srcDir, url + "/index.html");
        }
        // see if the jadefile exsists
        fs.exists(jadeFilePath, function (exsits) {
            // store the result in a new HTML page
            pages[url] = new HTMLPage({
                matchingJadeFilePath: (exsits)?jadeFilePath:null,
                htmlFilePath: htmlFilePath,
                jadeOptions: jadeOptions
            });
            callback(!!pages[url].matchingJadeFilePath, pages[url]);
        });
    } else {
        callback(!!pages[url].matchingJadeFilePath, pages[url]);
    }
}
function hasMatchingJadeFileInPages(srcDir, url, pages, jadeOptions, callback) {
    if (typeof pages[url] === 'undefined') {
        // get the possible jade file path
        var extension = path.extname(url);
        var jadeFilePath;
        var htmlFilePath;
        if (extension === ".html" /* || extension === ".htm" */) {
            jadeFilePath = path.join(srcDir, url.substring(0, url.length - extension.length) + ".jade");
            htmlFilePath = path.join(srcDir, url);
        } else {
            jadeFilePath = path.join(srcDir, url + "/index.jade");
            htmlFilePath = path.join(srcDir, url + "/index.html");
        }
        // see if the jadefile exsists
        fs.exists(jadeFilePath, function (exsits) {
            // store the result in a new HTML page
            pages[url] = new HTMLPage({
                matchingJadeFilePath: (exsits)?jadeFilePath:null,
                htmlFilePath: htmlFilePath,
                jadeOptions: jadeOptions
            });
            callback(!!pages[url].matchingJadeFilePath, pages[url]);
        });
    } else {
        callback(!!pages[url].matchingJadeFilePath, pages[url]);
    }
}
function hasMatchingJadeFileInPages ( srcDir , url , pages , jadeOptions , callback ) { if ( typeof pages [ url ] === 'undefined' ) { // get the possible jade file path var extension = path . extname ( url ) ; var jadeFilePath ; var htmlFilePath ; if ( extension === ".html" /* || extension === ".htm" */ ) { jadeFilePath = path . join ( srcDir , url . substring ( 0 , url . length - extension . length ) + ".jade" ) ; htmlFilePath = path . join ( srcDir , url ) ; } else { jadeFilePath = path . join ( srcDir , url + "/index.jade" ) ; htmlFilePath = path . join ( srcDir , url + "/index.html" ) ; } // see if the jadefile exsists fs . exists ( jadeFilePath , function ( exsits ) { // store the result in a new HTML page pages [ url ] = new HTMLPage ( { matchingJadeFilePath : ( exsits ) ? jadeFilePath : null , htmlFilePath : htmlFilePath , jadeOptions : jadeOptions } ) ; callback ( ! ! pages [ url ] . matchingJadeFilePath , pages [ url ] ) ; } ) ; } else { callback ( ! ! pages [ url ] . matchingJadeFilePath , pages [ url ] ) ; } }
creates a jade page if it doesn't exist in cache
creates a jade page if it doesn t exist in cache