|
|
@ -8,6 +8,7 @@ from unicodedata import normalize |
|
|
|
from urllib.parse import quote as url_encode |
|
|
|
from urllib.parse import quote as url_encode |
|
|
|
from urllib.parse import unquote as url_decode |
|
|
|
from urllib.parse import unquote as url_decode |
|
|
|
import string |
|
|
|
import string |
|
|
|
|
|
|
|
import json |
|
|
|
|
|
|
|
|
|
|
|
def os_path_separators(): |
|
|
|
def os_path_separators(): |
|
|
|
seps = ['/','\\'] |
|
|
|
seps = ['/','\\'] |
|
|
@ -53,12 +54,21 @@ class Document: |
|
|
|
self.doc_path = doc_path |
|
|
|
self.doc_path = doc_path |
|
|
|
self.valid = True |
|
|
|
self.valid = True |
|
|
|
|
|
|
|
|
|
|
|
# TODO: actually read document settings |
|
|
|
# Init default values |
|
|
|
self.settings = { |
|
|
|
self.settings = { |
|
|
|
'multiversion': False, |
|
|
|
'multiversion': False, |
|
|
|
'default_version': 'main' |
|
|
|
'default_version': '' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Read settings.json (if it exists) |
|
|
|
|
|
|
|
json_settings_filename = self.doc_path + '/settings.json' |
|
|
|
|
|
|
|
if os.path.exists(json_settings_filename): |
|
|
|
|
|
|
|
with open(json_settings_filename) as f: |
|
|
|
|
|
|
|
json_settings = json.load(f) |
|
|
|
|
|
|
|
for key in self.settings: |
|
|
|
|
|
|
|
if key in json_settings: |
|
|
|
|
|
|
|
self.settings[key] = json_settings[key] |
|
|
|
|
|
|
|
|
|
|
|
def build(self): |
|
|
|
def build(self): |
|
|
|
multiversion_build = self.settings['multiversion'] |
|
|
|
multiversion_build = self.settings['multiversion'] |
|
|
|
|
|
|
|
|
|
|
|