scottsteinbeck / commandbox-gitbook

A CommandBox module for converting a Gitbook into an eBook
25 stars 3 forks source link

Allow for a settings json, much like how old gitbook did it via `book.json` #26

Open lmajano opened 5 years ago

lmajano commented 5 years ago

This is a future enhancement. The old gitbook had a book.json in the root which was used to specify many of the export capabilities of the book. The settings that can be stored here can be:

{
    "gitbook": ">=2.0.1",
    "isbn": "978-1511982085",
    "pdf": {
        "margin": {
            "bottom": 56,
            "left": 25,
            "right": 25,
            "top": 56
        }
    },
    "plugins": [
        "richquotes",
        "edit-link",
        "github",
        "advanced-emoji",
        "sitemap",
        "collapsible-chapters",
        "anchors",
        "versions"
    ],
    "pluginsConfig": {
        "edit-link": {
            "base": "https://github.com/ortus-docs/coldbox-docs/tree/master",
            "label": "Edit This Page"
        },
        "github": {
            "url": "https://github.com/coldbox/coldbox-platform"
        },
        "sitemap": {
            "hostname": "https://coldbox.ortusbooks.com"
        },
         "versions": {
            "gitbookConfigURL": "https://raw.githubusercontent.com/ortus-docs/coldbox-docs/master/book.json",
            "options": [
                {
                    "value": "https://rackt.github.io/history/v1.3.0/",
                    "text": "Latest - v5.0.0",
                    "selected": true
                },
                {
                    "value": "https://coldbox.ortusbooks.com/content/v/v4.3.0/full/",
                    "text": "Version 4.3.0"
                },
                {
                    "value": "https://coldbox.ortusbooks.com/content/v/v4.1.0/",
                    "text": "Version 4.1.0"
                }

            ]
        }
    },
    "links": {
        "sharing": {
            "facebook": false,
            "twitter": false
        }
    }
}
bdw429s commented 5 years ago

@lmajano Scott and I have talked a lot about a JSON file for configuration, but the problem is where to store it. I already have a list of settings to allow users to specify for PDF exporting,

https://github.com/scottsteinbeck/commandbox-gitbook/blob/master/commands/gitbook/generate-pdf.cfc#L9-L18

But since the PDF tool is based on the export, and a Gitbook need not even have a Git repo, there's no good way to have a permanent place to store a JSON file We could just require the user to create it in the root of the unzipped export, but if they are re-downloading the zip on a regular basis, they'd be deleting the old export and would need to manually copy the file each time.

Our last idea was to have a setting inside the JSON that pointed to the export zip and keep the JSON up one directory by convention.