Skip to content

Commit

Permalink
Added fields for AppTap ID and Post Excerpt to template and Autofill …
Browse files Browse the repository at this point in the history
…commands
  • Loading branch information
ttscoff committed Jul 8, 2011
1 parent 4986bd6 commit d2d3907
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Commands/Copy for Posting (Autofill).tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ end
def get_headers(html)
headers = []
html.scan(/^(doctype|title|link|categories|tags)\: ([^\n]+)?/im) { |match|
html.scan(/^(doctype|title|link|categories|tags|appid|excerpt)\: ([^\n]+)?/im) { |match|
if match[0] =~ /[Cc]ategories/ && match[1] =~ /[^ ;0-9]/
$caterror += "WARNING: Categories were entered in the wrong format. They should be numeric and separated by semicolons, as created by the Categories command.\n\n"
elsif match[1] =~ /^[\s\n]*$/ || match[1].nil?
Expand All @@ -62,7 +62,7 @@ def get_headers(html)
headers << { 'title' => match[0], 'value' => match[1].strip } unless match[0] == 'doctype'
end
}
['title:','link:','categories:','tags:'].each { |header|
['title:','link:','categories:','tags:','appid','excerpt'].each { |header|
$caterror += %Q{WARNING: No "#{header}" header\n\n} if html.scan(/#{header}/i)[0].nil?
}
headers
Expand All @@ -89,7 +89,7 @@ html.gsub!(/[‘’]/,'\'')
unless html.to_s.empty?
begin
o = "(function doit() {"
o += "var errormsg=false,link=false,title=false,categories=false,tags=false,content=false,continued=false;"
o += "var errormsg=false,link=false,title=false,categories=false,tags=false,content=false,continued=false,appid=false,excerpt=false;"
headers.each {|h| o += %Q{#{h['title'].to_s}='#{url_escape(h['value'].to_s)}';} }
o += %Q^errormsg="#{url_escape($caterror)}";^ unless $caterror == ""
content = nil
Expand All @@ -109,6 +109,8 @@ begin
o += %Q^if(continued){var oEditor2=FCKeditorAPI.GetInstance("postcontinued");oEditor2.SetHTML(unescape(continued));}^
o += %Q^}else{CKEDITOR.instances.postcontent.setData(unescape(content));^
o += %Q^if(continued){CKEDITOR.instances.postcontinued.setData(unescape(continued));}}^
o += %Q^if(appid)blogsmith.addMetaData('post_apptapID',unescape(appid));^
o += %Q^if(excerpt)blogsmith.addMetaData('post_excerpt',unescape(excerpt));^
o += %Q^buildSlug();pageUpdated();^
o += %Q^if(errormsg){alert(unescape(errormsg));}^
o += "})();"
Expand Down
3 changes: 2 additions & 1 deletion Templates/Blogsmith Markdown Post.tmTemplate/template_in.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title:
link:
categories:
tags:

appid:
excerpt:

<!-- more -->

0 comments on commit d2d3907

Please sign in to comment.