/** * 处理默认参数 * @param defaultOption * @param configOption */ function handlerOption(defaultOption, configOption) { if (configOption) { for (var item in defaultOption) { if (item in configOption) { defaultOption[item] = configOption[item]; } } } } function start(bookIns, page) { const defaultOption = { copyright: 'for GitBook.', update_label: 'update : ', update_format: 'YYYY-MM-DD HH:mm:ss' } /** * [configOption: config option] * @type {Object} */ var configOption = bookIns.config.get('pluginsConfig')['page-footer-ex']; // 处理配置参数 handlerOption(defaultOption, configOption); var _copy = '' + defaultOption.copyright + '' var wrap = ' \n\n' + '' page.content = page.content + wrap; } module.exports = start;