summaryrefslogtreecommitdiffstats
path: root/lib/constants
diff options
context:
space:
mode:
Diffstat (limited to 'lib/constants')
-rw-r--r--lib/constants/__tests__/configSchema.js46
-rw-r--r--lib/constants/configDefault.js6
-rw-r--r--lib/constants/configFiles.js5
-rw-r--r--lib/constants/configSchema.js194
-rw-r--r--lib/constants/defaultBlocks.js51
-rw-r--r--lib/constants/defaultFilters.js15
-rw-r--r--lib/constants/defaultPlugins.js29
-rw-r--r--lib/constants/extsAsciidoc.js4
-rw-r--r--lib/constants/extsMarkdown.js5
-rw-r--r--lib/constants/ignoreFiles.js6
-rw-r--r--lib/constants/pluginAssetsFolder.js2
-rw-r--r--lib/constants/pluginHooks.js8
-rw-r--r--lib/constants/pluginPrefix.js5
-rw-r--r--lib/constants/pluginResources.js6
-rw-r--r--lib/constants/templatesFolder.js2
-rw-r--r--lib/constants/themePrefix.js4
16 files changed, 0 insertions, 388 deletions
diff --git a/lib/constants/__tests__/configSchema.js b/lib/constants/__tests__/configSchema.js
deleted file mode 100644
index efc99b9..0000000
--- a/lib/constants/__tests__/configSchema.js
+++ /dev/null
@@ -1,46 +0,0 @@
-var jsonschema = require('jsonschema');
-var schema = require('../configSchema');
-
-describe('configSchema', function() {
-
- function validate(cfg) {
- var v = new jsonschema.Validator();
- return v.validate(cfg, schema, {
- propertyName: 'config'
- });
- }
-
- describe('structure', function() {
-
- it('should accept dot in filename', function() {
- var result = validate({
- structure: {
- readme: 'book-intro.adoc'
- }
- });
-
- expect(result.errors.length).toBe(0);
- });
-
- it('should accept uppercase in filename', function() {
- var result = validate({
- structure: {
- readme: 'BOOK.adoc'
- }
- });
-
- expect(result.errors.length).toBe(0);
- });
-
- it('should not accept filepath', function() {
- var result = validate({
- structure: {
- readme: 'folder/myFile.md'
- }
- });
-
- expect(result.errors.length).toBe(1);
- });
-
- });
-});
diff --git a/lib/constants/configDefault.js b/lib/constants/configDefault.js
deleted file mode 100644
index 0d95883..0000000
--- a/lib/constants/configDefault.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var Immutable = require('immutable');
-var jsonSchemaDefaults = require('json-schema-defaults');
-
-var schema = require('./configSchema');
-
-module.exports = Immutable.fromJS(jsonSchemaDefaults(schema));
diff --git a/lib/constants/configFiles.js b/lib/constants/configFiles.js
deleted file mode 100644
index a67fd74..0000000
--- a/lib/constants/configFiles.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// Configuration files to test (sorted)
-module.exports = [
- 'book.js',
- 'book.json'
-];
diff --git a/lib/constants/configSchema.js b/lib/constants/configSchema.js
deleted file mode 100644
index d2126c6..0000000
--- a/lib/constants/configSchema.js
+++ /dev/null
@@ -1,194 +0,0 @@
-var FILENAME_REGEX = '^[a-zA-Z-._\d,\s]+$';
-
-module.exports = {
- '$schema': 'http://json-schema.org/schema#',
- 'id': 'https://gitbook.com/schemas/book.json',
- 'title': 'GitBook Configuration',
- 'type': 'object',
- 'properties': {
- 'root': {
- 'type': 'string',
- 'title': 'Path fro the root folder containing the book\'s content'
- },
- 'title': {
- 'type': 'string',
- 'title': 'Title of the book, default is extracted from README'
- },
- 'isbn': {
- 'type': 'string',
- 'title': 'ISBN for published book'
- },
- 'language': {
- 'type': 'string',
- 'title': 'Language of the book'
- },
- 'author': {
- 'type': 'string',
- 'title': 'Name of the author'
- },
- 'gitbook': {
- 'type': 'string',
- 'default': '*',
- 'title': 'GitBook version to match'
- },
- 'direction': {
- 'type': 'string',
- 'enum': ['ltr', 'rtl'],
- 'title': 'Direction of texts, default is detected in the pages'
- },
- 'theme': {
- 'type': 'string',
- 'default': 'default',
- 'title': 'Name of the theme plugin to use'
- },
- 'variables': {
- 'type': 'object',
- 'title': 'Templating context variables'
- },
- 'plugins': {
- 'oneOf': [
- { '$ref': '#/definitions/pluginsArray' },
- { '$ref': '#/definitions/pluginsString' }
- ],
- 'default': []
- },
- 'pluginsConfig': {
- 'type': 'object',
- 'title': 'Configuration for plugins'
- },
- 'structure': {
- 'type': 'object',
- 'properties': {
- 'langs': {
- 'default': 'LANGS.md',
- 'type': 'string',
- 'title': 'File to use as languages index',
- 'pattern': FILENAME_REGEX
- },
- 'readme': {
- 'default': 'README.md',
- 'type': 'string',
- 'title': 'File to use as preface',
- 'pattern': FILENAME_REGEX
- },
- 'glossary': {
- 'default': 'GLOSSARY.md',
- 'type': 'string',
- 'title': 'File to use as glossary index',
- 'pattern': FILENAME_REGEX
- },
- 'summary': {
- 'default': 'SUMMARY.md',
- 'type': 'string',
- 'title': 'File to use as table of contents',
- 'pattern': FILENAME_REGEX
- }
- },
- 'additionalProperties': false
- },
- 'pdf': {
- 'type': 'object',
- 'title': 'PDF specific configurations',
- 'properties': {
- 'pageNumbers': {
- 'type': 'boolean',
- 'default': true,
- 'title': 'Add page numbers to the bottom of every page'
- },
- 'fontSize': {
- 'type': 'integer',
- 'minimum': 8,
- 'maximum': 30,
- 'default': 12,
- 'title': 'Font size for the PDF output'
- },
- 'fontFamily': {
- 'type': 'string',
- 'default': 'Arial',
- 'title': 'Font family for the PDF output'
- },
- 'paperSize': {
- 'type': 'string',
- 'enum': ['a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'legal', 'letter'],
- 'default': 'a4',
- 'title': 'Paper size for the PDF'
- },
- 'chapterMark': {
- 'type': 'string',
- 'enum': ['pagebreak', 'rule', 'both', 'none'],
- 'default': 'pagebreak',
- 'title': 'How to mark detected chapters'
- },
- 'pageBreaksBefore': {
- 'type': 'string',
- 'default': '/',
- 'title': 'An XPath expression. Page breaks are inserted before the specified elements. To disable use the expression: "/"'
- },
- 'margin': {
- 'type': 'object',
- 'properties': {
- 'right': {
- 'type': 'integer',
- 'title': 'Right Margin',
- 'minimum': 0,
- 'maximum': 100,
- 'default': 62
- },
- 'left': {
- 'type': 'integer',
- 'title': 'Left Margin',
- 'minimum': 0,
- 'maximum': 100,
- 'default': 62
- },
- 'top': {
- 'type': 'integer',
- 'title': 'Top Margin',
- 'minimum': 0,
- 'maximum': 100,
- 'default': 56
- },
- 'bottom': {
- 'type': 'integer',
- 'title': 'Bottom Margin',
- 'minimum': 0,
- 'maximum': 100,
- 'default': 56
- }
- }
- }
- }
- }
- },
- 'required': [],
- 'definitions': {
- 'pluginsArray': {
- 'type': 'array',
- 'items': {
- 'oneOf': [
- { '$ref': '#/definitions/pluginObject' },
- { '$ref': '#/definitions/pluginString' }
- ]
- }
- },
- 'pluginsString': {
- 'type': 'string'
- },
- 'pluginString': {
- 'type': 'string'
- },
- 'pluginObject': {
- 'type': 'object',
- 'properties': {
- 'name': {
- 'type': 'string'
- },
- 'version': {
- 'type': 'string'
- }
- },
- 'additionalProperties': false,
- 'required': ['name']
- }
- }
-};
diff --git a/lib/constants/defaultBlocks.js b/lib/constants/defaultBlocks.js
deleted file mode 100644
index 74d1f1f..0000000
--- a/lib/constants/defaultBlocks.js
+++ /dev/null
@@ -1,51 +0,0 @@
-var Immutable = require('immutable');
-var TemplateBlock = require('../models/templateBlock');
-
-module.exports = Immutable.Map({
- html: TemplateBlock({
- name: 'html',
- process: function(blk) {
- return blk;
- }
- }),
-
- code: TemplateBlock({
- name: 'code',
- process: function(blk) {
- return {
- html: false,
- body: blk.body
- };
- }
- }),
-
- markdown: TemplateBlock({
- name: 'markdown',
- process: function(blk) {
- return this.book.renderInline('markdown', blk.body)
- .then(function(out) {
- return { body: out };
- });
- }
- }),
-
- asciidoc: TemplateBlock({
- name: 'asciidoc',
- process: function(blk) {
- return this.book.renderInline('asciidoc', blk.body)
- .then(function(out) {
- return { body: out };
- });
- }
- }),
-
- markup: TemplateBlock({
- name: 'markup',
- process: function(blk) {
- return this.book.renderInline(this.ctx.file.type, blk.body)
- .then(function(out) {
- return { body: out };
- });
- }
- })
-});
diff --git a/lib/constants/defaultFilters.js b/lib/constants/defaultFilters.js
deleted file mode 100644
index 35025cc..0000000
--- a/lib/constants/defaultFilters.js
+++ /dev/null
@@ -1,15 +0,0 @@
-var Immutable = require('immutable');
-var moment = require('moment');
-
-module.exports = Immutable.Map({
- // Format a date
- // ex: 'MMMM Do YYYY, h:mm:ss a
- date: function(time, format) {
- return moment(time).format(format);
- },
-
- // Relative Time
- dateFromNow: function(time) {
- return moment(time).fromNow();
- }
-});
diff --git a/lib/constants/defaultPlugins.js b/lib/constants/defaultPlugins.js
deleted file mode 100644
index 6d15971..0000000
--- a/lib/constants/defaultPlugins.js
+++ /dev/null
@@ -1,29 +0,0 @@
-var Immutable = require('immutable');
-var PluginDependency = require('../models/pluginDependency');
-
-var pkg = require('../../package.json');
-
-/**
- * Create a PluginDependency from a dependency of gitbook
- * @param {String} pluginName
- * @return {PluginDependency}
- */
-function createFromDependency(pluginName) {
- var npmID = PluginDependency.nameToNpmID(pluginName);
- var version = pkg.dependencies[npmID];
-
- return PluginDependency.create(pluginName, version);
-}
-
-/*
- * List of default plugins for all books,
- * default plugins should be installed in node dependencies of GitBook
- */
-module.exports = Immutable.List([
- 'highlight',
- 'search',
- 'lunr',
- 'sharing',
- 'fontsettings',
- 'theme-default'
-]).map(createFromDependency);
diff --git a/lib/constants/extsAsciidoc.js b/lib/constants/extsAsciidoc.js
deleted file mode 100644
index b2f4ce4..0000000
--- a/lib/constants/extsAsciidoc.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = [
- '.adoc',
- '.asciidoc'
-];
diff --git a/lib/constants/extsMarkdown.js b/lib/constants/extsMarkdown.js
deleted file mode 100644
index 44bf36b..0000000
--- a/lib/constants/extsMarkdown.js
+++ /dev/null
@@ -1,5 +0,0 @@
-module.exports = [
- '.md',
- '.markdown',
- '.mdown'
-];
diff --git a/lib/constants/ignoreFiles.js b/lib/constants/ignoreFiles.js
deleted file mode 100644
index aac225e..0000000
--- a/lib/constants/ignoreFiles.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// Files containing ignore pattner (sorted by priority)
-module.exports = [
- '.ignore',
- '.gitignore',
- '.bookignore'
-];
diff --git a/lib/constants/pluginAssetsFolder.js b/lib/constants/pluginAssetsFolder.js
deleted file mode 100644
index cd44722..0000000
--- a/lib/constants/pluginAssetsFolder.js
+++ /dev/null
@@ -1,2 +0,0 @@
-
-module.exports = '_assets';
diff --git a/lib/constants/pluginHooks.js b/lib/constants/pluginHooks.js
deleted file mode 100644
index 2d5dcaa..0000000
--- a/lib/constants/pluginHooks.js
+++ /dev/null
@@ -1,8 +0,0 @@
-module.exports = [
- 'init',
- 'finish',
- 'finish:before',
- 'config',
- 'page',
- 'page:before'
-];
diff --git a/lib/constants/pluginPrefix.js b/lib/constants/pluginPrefix.js
deleted file mode 100644
index c7f2dd0..0000000
--- a/lib/constants/pluginPrefix.js
+++ /dev/null
@@ -1,5 +0,0 @@
-
-/*
- All GitBook plugins are NPM packages starting with this prefix.
-*/
-module.exports = 'gitbook-plugin-';
diff --git a/lib/constants/pluginResources.js b/lib/constants/pluginResources.js
deleted file mode 100644
index ae283bf..0000000
--- a/lib/constants/pluginResources.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var Immutable = require('immutable');
-
-module.exports = Immutable.List([
- 'js',
- 'css'
-]);
diff --git a/lib/constants/templatesFolder.js b/lib/constants/templatesFolder.js
deleted file mode 100644
index aad6a72..0000000
--- a/lib/constants/templatesFolder.js
+++ /dev/null
@@ -1,2 +0,0 @@
-
-module.exports = '_layouts';
diff --git a/lib/constants/themePrefix.js b/lib/constants/themePrefix.js
deleted file mode 100644
index 99428de..0000000
--- a/lib/constants/themePrefix.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/*
- All GitBook themes plugins name start with this prefix once shorted.
-*/
-module.exports = 'theme-'; \ No newline at end of file