function Book(opts) {
    if (!(this instanceof Book)) return new Book(opts);

    this.opts = _.defaults(opts || {}, {
        fs: null,

        // Root path for the book
        root: '',

        // Extend book configuration
        config: {},

        // Log function
        log: function(msg) {
            process.stdout.write(msg);
        },

        // Log level
        logLevel: 'info'
    });

    if (!opts.fs) throw error.ParsingError(new Error('Book requires a fs instance'));

    // Root path for the book
    this.root = opts.root;

    // If multi-lingual, book can have a parent
    this.parent = opts.parent;
    if (this.parent) {
        this.language = path.relative(this.parent.root, this.root);
    }

    // A book is linked to an fs, to access its content
    this.fs = opts.fs;

    // Rules to ignore some files
    this.ignore = Ignore();
    this.ignore.addPattern([
        // Skip Git stuff
        '.git/',

        // Skip OS X meta data
        '.DS_Store',

        // Skip stuff installed by plugins
        'node_modules',

        // Skip book outputs
        '_book',
        '*.pdf',
        '*.epub',
        '*.mobi'
    ]);

    // Create a logger for the book
    this.log = new Logger(opts.log, opts.logLevel);

    // Create an interface to access the configuration
    this.config = new Config(this, opts.config);

    // Interfaces for the book structure
    this.readme = new Readme(this);
    this.summary = new Summary(this);
    this.glossary = new Glossary(this);

    // Multilinguals book
    this.langs = new Langs(this);
    this.books = [];

    // List of page in the book
    this.pages = {};

    // Deprecation for templates
    Object.defineProperty(this, 'options', {
        get: function () {
            this.log.warn.ln('"options" property is deprecated, use config.get(key) instead');
            return this.config.options;
        }
    });

    _.bindAll(this);

    // Loop for template filters/blocks
    error.deprecateField(this, 'book', this, '"book" property is deprecated, use "this" directly instead');
}
/*
The Book class is an interface for parsing books content.
It does not require to run on Node.js, isnce it only depends on the fs implementation
*/
The Book class is an interface for parsing books content.
It does not require to run on Node.js, isnce it only depends on the fs implementation
The Book class is an interface for parsing books content . It does not require to run on Node . js isnce it only depends on the fs implementation
function Book(opts) {
    if (!(this instanceof Book)) return new Book(opts);
    this.opts = _.defaults(opts || {}, {
        fs: null,
        root: '',
        config: {},
        log: function(msg) {
            process.stdout.write(msg);
        },
        logLevel: 'info'
    });
    if (!opts.fs) throw error.ParsingError(new Error('Book requires a fs instance'));
    this.root = opts.root;
    this.parent = opts.parent;
    if (this.parent) {
        this.language = path.relative(this.parent.root, this.root);
    }
    this.fs = opts.fs;
    this.ignore = Ignore();
    this.ignore.addPattern([
        '.git/',
        '.DS_Store',
        'node_modules',
        '_book',
        '*.pdf',
        '*.epub',
        '*.mobi'
    ]);
    this.log = new Logger(opts.log, opts.logLevel);
    this.config = new Config(this, opts.config);
    this.readme = new Readme(this);
    this.summary = new Summary(this);
    this.glossary = new Glossary(this);
    this.langs = new Langs(this);
    this.books = [];
    this.pages = {};
    Object.defineProperty(this, 'options', {
        get: function () {
            this.log.warn.ln('"options" property is deprecated, use config.get(key) instead');
            return this.config.options;
        }
    });
    _.bindAll(this);
    error.deprecateField(this, 'book', this, '"book" property is deprecated, use "this" directly instead');
}
function Book ( opts ) { if ( ! ( this instanceof Book ) ) return new Book ( opts ) ; this . opts = _ . defaults ( opts || { } , { fs : null , root : '' , config : { } , log : function ( msg ) { process . stdout . write ( msg ) ; } , logLevel : 'info' } ) ; if ( ! opts . fs ) throw error . ParsingError ( new Error ( 'Book requires a fs instance' ) ) ; this . root = opts . root ; this . parent = opts . parent ; if ( this . parent ) { this . language = path . relative ( this . parent . root , this . root ) ; } this . fs = opts . fs ; this . ignore = Ignore ( ) ; this . ignore . addPattern ( [ '.git/' , '.DS_Store' , 'node_modules' , '_book' , '*.pdf' , '*.epub' , '*.mobi' ] ) ; this . log = new Logger ( opts . log , opts . logLevel ) ; this . config = new Config ( this , opts . config ) ; this . readme = new Readme ( this ) ; this . summary = new Summary ( this ) ; this . glossary = new Glossary ( this ) ; this . langs = new Langs ( this ) ; this . books = [ ] ; this . pages = { } ; Object . defineProperty ( this , 'options' , { get : function ( ) { this . log . warn . ln ( '"options" property is deprecated, use config.get(key) instead' ) ; return this . config . options ; } } ) ; _ . bindAll ( this ) ; error . deprecateField ( this , 'book' , this , '"book" property is deprecated, use "this" directly instead' ) ; }
The Book class is an interface for parsing books content.
The Book class is an interface for parsing books content .
// Root path for the book // Extend book configuration // Log function // Log level // Root path for the book // If multi-lingual, book can have a parent // A book is linked to an fs, to access its content // Rules to ignore some files // Skip Git stuff // Skip OS X meta data // Skip stuff installed by plugins // Skip book outputs // Create a logger for the book // Create an interface to access the configuration // Interfaces for the book structure // Multilinguals book // List of page in the book // Deprecation for templates // Loop for template filters/blocks