diff --git a/install.sh b/install.sh index b742b27..ad0cc84 100644 --- a/install.sh +++ b/install.sh @@ -2,6 +2,7 @@ # Provision script created for Ubuntu 14.04 APP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +APP_USER="$( stat -c '%U' ${APP_DIR} )" echo "Provisioning..." @@ -9,7 +10,7 @@ add-apt-repository -y ppa:chris-lea/node.js apt-get update apt-get install -y python build-essential git libpcre3-dev python-software-properties \ python-pip python-virtualenv python-dev pkg-config curl libxml2-dev libxslt1-dev zlib1g-dev \ -libffi-dev nodejs screen node-cleancss libyaml-dev +libffi-dev nodejs screen libyaml-dev # Default cache is memoization @@ -40,7 +41,9 @@ virtualenv .venv source .venv/bin/activate pip install -r requirements.txt +chown -R ${APP_USER}.${APP_USER} .venv +echo "Installing start scripts" cat << EOF > /usr/local/bin/realms-wiki #!/bin/bash ${APP_DIR}/.venv/bin/python ${APP_DIR}/manage.py "\$@" diff --git a/realms/modules/wiki/models.py b/realms/modules/wiki/models.py index d2389c8..bc72b95 100644 --- a/realms/modules/wiki/models.py +++ b/realms/modules/wiki/models.py @@ -178,7 +178,10 @@ class Wiki(): meta_end = re.search("\n(\.{3}|\-{3})", content) if not meta_end: return None - return yaml.safe_load(content[0:meta_end.start()]) + try: + return yaml.safe_load(content[0:meta_end.start()]) + except Exception as e: + return {'error': e.message} def compare(self, name, old_sha, new_sha): old = self.get_page(name, sha=old_sha) diff --git a/realms/static/css/style.css b/realms/static/css/style.css index 895535d..725f096 100644 --- a/realms/static/css/style.css +++ b/realms/static/css/style.css @@ -87,7 +87,7 @@ body { right: 0; bottom: 0; font-family: Inconsolata, monospace; - font-size: 1.2em; + font-size: 1.1em; line-height: 1.3em; } diff --git a/realms/static/js/editor.js b/realms/static/js/editor.js index f1f9e3a..4ada308 100644 --- a/realms/static/js/editor.js +++ b/realms/static/js/editor.js @@ -267,6 +267,9 @@ $(function () { function initAce() { editor = ace.edit("editor"); editor.focus(); + editor.setOptions({ + enableBasicAutocompletion: true + }); } function initUi() { @@ -274,9 +277,13 @@ $(function () { fetchTheme(profile.theme, function () { $theme.find('li > a[data-value="' + profile.theme + '"]').addClass('selected'); + editor.setBehavioursEnabled(true); editor.getSession().setUseWrapMode(true); editor.setShowPrintMargin(false); - + editor.getSession().setTabSize(2); + editor.getSession().setUseSoftTabs(true); + editor.renderer.setShowInvisibles(true); + editor.renderer.setShowGutter(false); editor.getSession().setMode('ace/mode/markdown'); editor.getSession().setValue(profile.currentMd || editor.getSession().getValue()); diff --git a/realms/static/js/main.js b/realms/static/js/main.js index 1b9ad9c..e2e1e11 100644 --- a/realms/static/js/main.js +++ b/realms/static/js/main.js @@ -3,7 +3,6 @@ Handlebars.registerHelper('well', function(options) { return '
' + options.fn(this) + '
'; }); -Handlebars.registerPartial('item', '
{{ name }}
') /* © 2013 j201 * https://github.com/j201/meta-marked */ @@ -82,7 +81,7 @@ var MDR = { return id; }); } - //html = this.hook(html); + this.hook(); return html; }, @@ -98,15 +97,6 @@ var MDR = { } }, - hook: function(html) { - if (!this.doc.meta) { - return html; - } - try { - var template = Handlebars.compile(html); - return template(this.doc.meta); - } catch(e) { - return html; - } + hook: function() { } };