[Pkg-mozext-commits] [greasemonkey] 08/45: Move extractMeta into its own file.
David Prévot
taffit at moszumanska.debian.org
Mon Nov 3 20:59:19 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository greasemonkey.
commit 23205fefc4a0cd209eeb2cca8fe5404a78d4fea4
Author: Ventero <ventero at ventero.de>
Date: Fri Sep 19 05:03:50 2014 +0200
Move extractMeta into its own file.
---
modules/extractMeta.js | 11 +++++++++++
modules/parseScript.js | 13 ++-----------
modules/script.js | 1 +
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/modules/extractMeta.js b/modules/extractMeta.js
new file mode 100644
index 0000000..02aee49
--- /dev/null
+++ b/modules/extractMeta.js
@@ -0,0 +1,11 @@
+var EXPORTED_SYMBOLS = ['extractMeta'];
+
+var gAllMetaRegexp = new RegExp(
+ '^(\u00EF\u00BB\u00BF)?// ==UserScript==([\\s\\S]*?)^// ==/UserScript==', 'm');
+
+/** Get just the stuff between ==UserScript== lines. */
+function extractMeta(aSource) {
+ var meta = aSource.match(gAllMetaRegexp);
+ if (meta) return meta[2].replace(/^\s+/, '');
+ return '';
+}
diff --git a/modules/parseScript.js b/modules/parseScript.js
index f2b363d..36c7f26 100644
--- a/modules/parseScript.js
+++ b/modules/parseScript.js
@@ -1,6 +1,6 @@
-var EXPORTED_SYMBOLS = [
- 'extractMeta', 'parse', 'gLineSplitRegexp', 'gMetaLineRegexp'];
+var EXPORTED_SYMBOLS = ['parse', 'gLineSplitRegexp', 'gMetaLineRegexp'];
+Components.utils.import('resource://greasemonkey/extractMeta.js');
Components.utils.import('resource://greasemonkey/script.js');
Components.utils.import('resource://greasemonkey/scriptIcon.js');
Components.utils.import('resource://greasemonkey/scriptRequire.js');
@@ -11,21 +11,12 @@ Components.utils.import('resource://greasemonkey/util.js');
var gIoService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var gLineSplitRegexp = /.+/g;
-var gAllMetaRegexp = new RegExp(
- '^(\u00EF\u00BB\u00BF)?// ==UserScript==([\\s\\S]*?)^// ==/UserScript==', 'm');
var gMetaLineRegexp = new RegExp('// @([^\\s:]+)(?::([a-zA-Z-]+))?(?:\\s+(.*))?');
var gStringBundle = Components
.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService)
.createBundle("chrome://greasemonkey/locale/greasemonkey.properties");
-/** Get just the stuff between ==UserScript== lines. */
-function extractMeta(aSource) {
- var meta = aSource.match(gAllMetaRegexp);
- if (meta) return meta[2].replace(/^\s+/, '');
- return '';
-}
-
/** Parse the source of a script; produce Script object. */
function parse(aSource, aUri, aFailWhenMissing, aNoMetaOk) {
var meta = extractMeta(aSource).match(gLineSplitRegexp);
diff --git a/modules/script.js b/modules/script.js
index 58ecb8b..3766cfe 100644
--- a/modules/script.js
+++ b/modules/script.js
@@ -3,6 +3,7 @@ var EXPORTED_SYMBOLS = ['Script'];
Components.utils.import('resource://gre/modules/AddonManager.jsm');
Components.utils.import('resource://greasemonkey/GM_notification.js');
Components.utils.import('resource://greasemonkey/constants.js');
+Components.utils.import('resource://greasemonkey/extractMeta.js');
Components.utils.import('resource://greasemonkey/miscapis.js');
Components.utils.import("resource://greasemonkey/parseScript.js");
Components.utils.import('resource://greasemonkey/prefmanager.js');
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git
More information about the Pkg-mozext-commits
mailing list