more consistent pathname output
This commit is contained in:
джерело
78aa491fee
коміт
30ea318126
@ -16,12 +16,21 @@ angular.module('myApp.post', ['ngRoute'])
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
DesiraeService.meta().then(function (desi) {
|
DesiraeService.meta().then(function (desi) {
|
||||||
console.warn(desi);
|
/*
|
||||||
|
if (!scope.site.base_url) {
|
||||||
|
window.alert("Please go to the site tab and add a url first");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
scope.blogdir = desi.blogdir.path.replace(/^\/(Users|home)\/[^\/]+\//, '~/');
|
scope.blogdir = desi.blogdir.path.replace(/^\/(Users|home)\/[^\/]+\//, '~/');
|
||||||
scope.site = desi.site;
|
scope.site = desi.site;
|
||||||
scope.env = desi.site;
|
scope.env = desi.site;
|
||||||
newPost();
|
newPost();
|
||||||
|
|
||||||
|
if (/dropbox/.test(scope.site.base_url)) {
|
||||||
|
scope.env.explicitIndexes = true;
|
||||||
|
}
|
||||||
|
|
||||||
updateDate();
|
updateDate();
|
||||||
}).catch(function (e) {
|
}).catch(function (e) {
|
||||||
window.alert("An Error Occured. Most errors that occur in the init phase are parse errors in the config files or permissions errors on files or directories, but check the error console for details.");
|
window.alert("An Error Occured. Most errors that occur in the init phase are parse errors in the config files or permissions errors on files or directories, but check the error console for details.");
|
||||||
@ -95,8 +104,11 @@ angular.module('myApp.post', ['ngRoute'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
selected.url = window.path.join(scope.site.base_url + window.path.join(scope.site.base_path, post.yml.permalink));
|
selected.url = window.path.join(scope.site.base_url + window.path.join(scope.site.base_path, post.yml.permalink));
|
||||||
|
if (scope.env.explicitIndexes && /\/$/.test(selected.url)) {
|
||||||
|
selected.url += 'index.html';
|
||||||
|
}
|
||||||
selected.abspath = window.path.join(scope.blogdir, selected.path);
|
selected.abspath = window.path.join(scope.blogdir, selected.path);
|
||||||
selected.sourcepath = window.path.join((selected.collection || 'posts'), scope.slug + '.' + selected.format);
|
selected.sourcepath = window.path.join(scope.blogdir, (selected.collection || 'posts'), scope.slug + '.' + selected.format);
|
||||||
};
|
};
|
||||||
scope.onFrontmatterChange = function () {
|
scope.onFrontmatterChange = function () {
|
||||||
var data
|
var data
|
||||||
@ -120,7 +132,11 @@ angular.module('myApp.post', ['ngRoute'])
|
|||||||
if (!/\.html?$/.test(window.path.basename(post.yml.permalink))) {
|
if (!/\.html?$/.test(window.path.basename(post.yml.permalink))) {
|
||||||
scope.selected.path = window.path.join(scope.selected.path.replace(/\.w+$/, ''), 'index.html');
|
scope.selected.path = window.path.join(scope.selected.path.replace(/\.w+$/, ''), 'index.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.selected.url = window.path.join(scope.site.base_url + window.path.join(scope.site.base_path, post.yml.permalink));
|
scope.selected.url = window.path.join(scope.site.base_url + window.path.join(scope.site.base_path, post.yml.permalink));
|
||||||
|
if (scope.env.explicitIndexes && /\/$/.test(scope.selected.url)) {
|
||||||
|
scope.selected.url += 'index.html';
|
||||||
|
}
|
||||||
scope.selected.abspath = window.path.join(scope.blogdir, scope.selected.path);
|
scope.selected.abspath = window.path.join(scope.blogdir, scope.selected.path);
|
||||||
scope.selected.sourcepath = window.path.join((scope.selected.collection || 'posts'), scope.slug + '.' + scope.selected.format);
|
scope.selected.sourcepath = window.path.join((scope.selected.collection || 'posts'), scope.slug + '.' + scope.selected.format);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
Завантаження…
x
Посилання в новій задачі
Block a user