Fixed Tumblr post format when publishing using template

This commit is contained in:
benweet 2013-10-27 20:27:39 +00:00
parent 293aac30ed
commit 627087891e
5 changed files with 23 additions and 8 deletions

View File

@ -41,7 +41,7 @@ define([
var htmlCode = _.template(buttonHtmlCode.config.template, {
documentTitle: selectedFileDesc.title,
documentMarkdown: selectedFileDesc.content,
trimmedDocumentMarkdown: selectedFileDesc.content.substring(selectedFileDesc.frontMatter ? selectedFileDesc.frontMatter._frontMatter.length : 0),
strippedDocumentMarkdown: selectedFileDesc.content.substring(selectedFileDesc.frontMatter ? selectedFileDesc.frontMatter._frontMatter.length : 0),
documentHTML: html,
frontMatter: selectedFileDesc.frontMatter,
publishAttributes: undefined,

View File

@ -6,7 +6,7 @@ Available variables:
<li>
<b>documentMarkdown</b>: document in Markdown format</li>
<li>
<b>trimmedDocumentMarkdown</b>: document without front matter</li>
<b>strippedDocumentMarkdown</b>: document without front matter</li>
<li>
<b>documentHTML</b>: document in HTML format</li>
<li>

View File

@ -1,9 +1,10 @@
define([
"underscore",
"settings",
"utils",
"classes/Provider",
"helpers/tumblrHelper"
], function(_, utils, Provider, tumblrHelper) {
], function(_, settings, utils, Provider, tumblrHelper) {
var tumblrProvider = new Provider("tumblr", "Tumblr");
tumblrProvider.publishPreferencesInputIds = [
@ -16,7 +17,22 @@ define([
frontMatter.tags !== undefined && (labelList = frontMatter.tags);
}
_.isString(labelList) && (labelList = _.compact(labelList.split(/[\s,]/)));
tumblrHelper.upload(publishAttributes.blogHostname, publishAttributes.postId, labelList.join(','), publishAttributes.format == "markdown" ? "markdown" : "html", title, content, function(error, postId) {
// Deduce format from publishAttributes/template
var format = (function() {
if(publishAttributes.format == 'html') {
return 'html';
}
if(publishAttributes.format == 'template') {
var template = publishAttributes.customTmpl || settings.template;
if(template.indexOf("documentHTML") !== -1) {
return 'html';
}
}
return 'markdown';
})();
tumblrHelper.upload(publishAttributes.blogHostname, publishAttributes.postId, labelList.join(','), format, title, content, function(error, postId) {
if(error) {
callback(error);
return;

View File

@ -62,7 +62,7 @@ define([
return _.template(template, {
documentTitle: fileDesc.title,
documentMarkdown: fileDesc.content,
trimmedDocumentMarkdown: fileDesc.content.substring(fileDesc.frontMatter ? fileDesc.frontMatter._frontMatter.length : 0),
strippedDocumentMarkdown: fileDesc.content.substring(fileDesc.frontMatter ? fileDesc.frontMatter._frontMatter.length : 0),
documentHTML: html,
frontMatter: fileDesc.frontMatter,
publishAttributes: publishAttributes

View File

@ -1215,15 +1215,14 @@ div.dropdown-menu textarea {
.title-icon-category {
display: inline-block;
opacity: 0.1;
margin-top: -4px;
margin-top: -2px;
margin-left: -2px;
margin-right: 2px;
font-size: 14px;
vertical-align: top;
.file-title-navbar & {
font-size: 16px;
margin-top: -2px;
margin-left: -4px;
margin-left: -3px;
}
}