Added MathJax library in default template

This commit is contained in:
benweet 2013-06-14 00:25:32 +01:00
parent 18b7037764
commit 04050b2999
6 changed files with 30 additions and 17 deletions

View File

@ -186,5 +186,18 @@ define([
]); ]);
}; };
// Log error messages
googleAnalytics.onError = function(error) {
if(_.isString(error) || !error.message) {
return;
}
_gaq.push([
'_trackEvent',
"Error",
"message",
error.message
]);
};
return googleAnalytics; return googleAnalytics;
}); });

View File

@ -173,8 +173,8 @@ define([
// syncIndex associations // syncIndex associations
syncLocations = syncLocations || {}; syncLocations = syncLocations || {};
var sync = _.reduce(syncLocations, function(sync, syncAttributes, syncIndex) { var sync = _.reduce(syncLocations, function(sync, syncAttributes) {
return sync + syncIndex + ";"; return sync + syncAttributes.syncIndex + ";";
}, ";"); }, ";");
localStorage[fileIndex + ".title"] = title; localStorage[fileIndex + ".title"] = title;

View File

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>&lt;%= documentTitle %&gt;</title>
<link rel="stylesheet"
href="<%= siteUrl %>css/main-min.css" />
</head>
<body>&lt;%= documentHTML %&gt;
</body>
</html>

View File

@ -36,7 +36,11 @@ define([
// Store publishIndex // Store publishIndex
publishAttributes.publishIndex = publishIndex; publishAttributes.publishIndex = publishIndex;
// Replace provider ID by provider module in attributes // Replace provider ID by provider module in attributes
publishAttributes.provider = providerMap[publishAttributes.provider]; var provider = providerMap[publishAttributes.provider];
if(!provider) {
throw new Error("Invalid provider ID: " + publishAttributes.provider);
}
publishAttributes.provider = provider;
fileDesc.publishLocations[publishIndex] = publishAttributes; fileDesc.publishLocations[publishIndex] = publishAttributes;
} }
catch(e) { catch(e) {
@ -60,7 +64,7 @@ define([
publishAttributes: publishAttributes publishAttributes: publishAttributes
}); });
} }
catch (e) { catch(e) {
extensionMgr.onError(e); extensionMgr.onError(e);
throw e; throw e;
} }
@ -233,7 +237,7 @@ define([
$(".action-download-template").click(function() { $(".action-download-template").click(function() {
var content = publisher.applyTemplate(); var content = publisher.applyTemplate();
var title = fileMgr.getCurrentFile().title; var title = fileMgr.getCurrentFile().title;
utils.saveAs(content, title + ".txt"); utils.saveAs(content, title + (settings.template.indexOf("documentHTML") === -1 ? ".md" : ".html"));
}); });
}); });

View File

@ -18,6 +18,9 @@ define([
'<link rel="stylesheet" href="', '<link rel="stylesheet" href="',
MAIN_URL, MAIN_URL,
'css/main-min.css" />\n', 'css/main-min.css" />\n',
'<script type="text/javascript" src="',
MAIN_URL,
'lib/MathJax/MathJax.js?config=TeX-AMS_HTML"></script>\n',
'</head>\n', '</head>\n',
'<body><%= documentHTML %></body>\n', '<body><%= documentHTML %></body>\n',
'</html>' '</html>'

View File

@ -28,7 +28,11 @@ define([
// Store syncIndex // Store syncIndex
syncAttributes.syncIndex = syncIndex; syncAttributes.syncIndex = syncIndex;
// Replace provider ID by provider module in attributes // Replace provider ID by provider module in attributes
syncAttributes.provider = providerMap[syncAttributes.provider]; var provider = providerMap[syncAttributes.provider];
if(!provider) {
throw new Error("Invalid provider ID: " + syncAttributes.provider);
}
syncAttributes.provider = provider;
fileDesc.syncLocations[syncIndex] = syncAttributes; fileDesc.syncLocations[syncIndex] = syncAttributes;
} }
catch(e) { catch(e) {