aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-01-07 22:29:04 +0000
committerMichael Williamson <mike@zwobble.org>2014-01-07 22:29:04 +0000
commitbfc33eec2b0a22e4bb0ee2412ec22df636134330 (patch)
tree065db6da90cbdc17ddc85d38e2f8e8303dc33ee1 /lib
parentbc6e9ac4ee638fdc11019c979e3f03b9d7098e3f (diff)
Append standard style map to custom style map
Diffstat (limited to 'lib')
-rw-r--r--lib/options-reader.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/options-reader.js b/lib/options-reader.js
index 3cac969..fa215f4 100644
--- a/lib/options-reader.js
+++ b/lib/options-reader.js
@@ -28,13 +28,28 @@ var standardOptions = exports._standardOptions = {
function readOptions(options) {
options = options || {};
- if (options.styleMap && _.isString(options.styleMap)) {
- options.styleMap = options.styleMap.split("\n").map(function(line) {
+ var fullOptions = extend(standardOptions, options);
+
+ fullOptions.styleMap = readStyleMap(options).concat(standardOptions.styleMap);
+
+ return fullOptions;
+}
+
+function readStyleMap(options) {
+ var customStyleMap = readCustomStyleMap(options.styleMap);
+ return customStyleMap;
+}
+
+function readCustomStyleMap(styleMap) {
+ if (!styleMap) {
+ return [];
+ } else if (_.isString(styleMap)) {
+ return styleMap.split("\n").map(function(line) {
return style(line.trim());
});
+ } else {
+ return styleMap;
}
-
- return extend(standardOptions, options);
}