mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-07 14:23:53 +00:00
Merge pull request #181 from natecain/excludes_refactor
A small refactor and addition to exclude more files
This commit is contained in:
commit
a389f9bc8c
12
boot/boot.js
12
boot/boot.js
@ -1152,11 +1152,19 @@ $tw.loadTiddlersFromFile = function(filepath,fields) {
|
|||||||
return {filepath: filepath, type: type, tiddlers: tiddlers, hasMetaFile: !!metadata};
|
return {filepath: filepath, type: type, tiddlers: tiddlers, hasMetaFile: !!metadata};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
A default set of files for TiddlyWiki to ignore during load.
|
||||||
|
This matches what NPM ignores, and adds "*.meta" to ignore tiddler
|
||||||
|
metadata files.
|
||||||
|
*/
|
||||||
|
$tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\.hg$|^\.lock-wscript$|^\.svn$|^\.wafpickle-.*$|^CVS$|^npm-debug\.log$/;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Load all the tiddlers recursively from a directory, including honouring `tiddlywiki.files` files for drawing in external files. Returns an array of {filepath:,type:,tiddlers: [{..fields...}],hasMetaFile:}. Note that no file information is returned for externally loaded tiddlers, just the `tiddlers` property.
|
Load all the tiddlers recursively from a directory, including honouring `tiddlywiki.files` files for drawing in external files. Returns an array of {filepath:,type:,tiddlers: [{..fields...}],hasMetaFile:}. Note that no file information is returned for externally loaded tiddlers, just the `tiddlers` property.
|
||||||
*/
|
*/
|
||||||
$tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {
|
$tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {
|
||||||
excludeRegExp = excludeRegExp || /^\.DS_Store$|.meta$/;
|
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
|
||||||
var tiddlers = [];
|
var tiddlers = [];
|
||||||
if(fs.existsSync(filepath)) {
|
if(fs.existsSync(filepath)) {
|
||||||
var stat = fs.statSync(filepath);
|
var stat = fs.statSync(filepath);
|
||||||
@ -1198,7 +1206,7 @@ $tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {
|
|||||||
Load the tiddlers from a plugin folder, and package them up into a proper JSON plugin tiddler
|
Load the tiddlers from a plugin folder, and package them up into a proper JSON plugin tiddler
|
||||||
*/
|
*/
|
||||||
$tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
$tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
||||||
excludeRegExp = excludeRegExp || /^\.DS_Store$|.meta$/;
|
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
|
||||||
var stat, files, pluginInfo, pluginTiddlers = [], f, file, titlePrefix, t;
|
var stat, files, pluginInfo, pluginTiddlers = [], f, file, titlePrefix, t;
|
||||||
if(fs.existsSync(filepath)) {
|
if(fs.existsSync(filepath)) {
|
||||||
stat = fs.statSync(filepath);
|
stat = fs.statSync(filepath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user