mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
Update public wiki (#2868)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { mediaUrl, gettext, siteRoot } from './constants';
|
||||
import { mediaUrl, gettext, serviceURL } from './constants';
|
||||
import { strChineseFirstPY } from './pinyin-by-unicode';
|
||||
|
||||
export const Utils = {
|
||||
@@ -404,30 +404,59 @@ export const Utils = {
|
||||
},
|
||||
|
||||
isInternalMarkdownLink: function(url, repoID) {
|
||||
var re = new RegExp(siteRoot + 'lib/' + repoID + '.*\.md$');
|
||||
var re = new RegExp(serviceURL + '/lib/' + repoID + '.*\.md$');
|
||||
return re.test(url);
|
||||
},
|
||||
|
||||
isInternalDirLink: function(url, repoID) {
|
||||
var re = new RegExp(siteRoot + 'library/' + repoID + '.*');
|
||||
var re = new RegExp(serviceURL + '/library/' + repoID + '.*');
|
||||
return re.test(url);
|
||||
},
|
||||
|
||||
getPathFromInternalMarkdownLink: function(url, repoID) {
|
||||
var re = new RegExp(siteRoot + 'lib/' + repoID + '/file' + '(.*\.md)');
|
||||
var re = new RegExp(serviceURL + '/lib/' + repoID + '/file' + '(.*\.md)');
|
||||
var array = re.exec(url);
|
||||
var path = decodeURIComponent(array[1]);
|
||||
return path;
|
||||
},
|
||||
|
||||
getPathFromInternalDirLink: function(url, repoID, repoName) {
|
||||
var re = new RegExp(siteRoot + 'library/' + repoID + '/' + repoName + '(/.*)');
|
||||
var repoName = encodeURIComponent(repoName);
|
||||
var re = new RegExp(serviceURL + '/library/' + repoID + '/' + repoName + '(/.*)');
|
||||
var array = re.exec(url);
|
||||
var path = decodeURIComponent(array[1]);
|
||||
|
||||
return path;
|
||||
},
|
||||
|
||||
isWikiInternalMarkdownLink: function(url, slug) {
|
||||
var slug = encodeURIComponent(slug);
|
||||
var re = new RegExp(serviceURL + '/wikis/' + slug + '.*\.md$');
|
||||
return re.test(url);
|
||||
},
|
||||
|
||||
isWikiInternalDirLink: function(url, slug) {
|
||||
var slug = encodeURIComponent(slug);
|
||||
var re = new RegExp(serviceURL + '/wikis/' + slug + '.*');
|
||||
return re.test(url);
|
||||
},
|
||||
|
||||
getPathFromWikiInternalMarkdownLink: function(url, slug) {
|
||||
var slug = encodeURIComponent(slug);
|
||||
var re = new RegExp(serviceURL + '/wikis/' + slug + '(.*\.md)');
|
||||
var array = re.exec(url);
|
||||
var path = decodeURIComponent(array[1]);
|
||||
return path;
|
||||
},
|
||||
|
||||
getPathFromWikiInternalDirLink: function(url, slug) {
|
||||
var slug = encodeURIComponent(slug);
|
||||
var re = new RegExp(serviceURL + '/wikis/' + slug+ '(/.*)');
|
||||
var array = re.exec(url);
|
||||
var path = decodeURIComponent(array[1]);
|
||||
return path;
|
||||
},
|
||||
|
||||
compareTwoWord: function(wordA, wordB) {
|
||||
// compare wordA and wordB at lower case
|
||||
// if wordA >= wordB, return 1
|
||||
@@ -577,6 +606,17 @@ export const Utils = {
|
||||
}
|
||||
});
|
||||
return items;
|
||||
}
|
||||
},
|
||||
|
||||
changeMarkdownNodes: function(nodes, fn) {
|
||||
nodes.map((item) => {
|
||||
fn(item);
|
||||
if (item.nodes && item.nodes.length > 0){
|
||||
Utils.changeMarkdownNodes(item.nodes, fn);
|
||||
}
|
||||
});
|
||||
|
||||
return nodes;
|
||||
},
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user