Skip to content

Commit

Permalink
Updated typography commands
Browse files Browse the repository at this point in the history
  • Loading branch information
ttscoff committed Jun 16, 2009
1 parent 5cf3875 commit 000977b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
7 changes: 5 additions & 2 deletions Commands/Blogsmith Typography Preview.tmCommand
Expand Up @@ -28,7 +28,9 @@ end
def strip_html(string,removals)
iterations = string.scan(/<[^>]+>/).length
while iterations > 0
string.sub!(/(<[^>]+>)/,"%#{removals.length}%")
subnum = removals.length
subnum = "0" + subnum.to_s if subnum.to_s.length == 1
string.sub!(/(<[^>]+>)/,"%#{subnum}%")
removals += $1.to_a
iterations -= 1
end
Expand Down Expand Up @@ -67,7 +69,8 @@ def restore_replacements(string,removals)
removals.each_with_index {|removal,x|
x = "0" + x.to_s if x.to_s.length == 1
m = string.match(/%#{x}([^%]+)?%/)
if m[1].nil?
next if m.nil?
if m[1].nil?
string.sub!(/%#{x}%/,removals[x.to_i])
else
if removals[x.to_i] =~ /\[[^\]]+\]([\[\(][^\]\)]+[\]\)])/
Expand Down
10 changes: 8 additions & 2 deletions Commands/Blogsmith Typography.tmCommand
Expand Up @@ -6,6 +6,9 @@
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby -wKU
SUPPORT = ENV['TM_SUPPORT_PATH']
require SUPPORT + '/lib/exit_codes'
require 'erb'
# CHANGE: 3/27/09 search for $32.25 with no trailing US, accounts for possible space ($32 US)
Expand All @@ -22,7 +25,9 @@ end
def strip_html(string,removals)
iterations = string.scan(/&lt;[^&gt;]+&gt;/).length
while iterations &gt; 0
string.sub!(/(&lt;[^&gt;]+&gt;)/,"%#{removals.length}%")
subnum = removals.length
subnum = "0" + subnum.to_s if subnum.to_s.length == 1
string.sub!(/(&lt;[^&gt;]+&gt;)/,"%#{subnum}%")
removals += $1.to_a
iterations -= 1
end
Expand Down Expand Up @@ -61,7 +66,8 @@ def restore_replacements(string,removals)
removals.each_with_index {|removal,x|
x = "0" + x.to_s if x.to_s.length == 1
m = string.match(/%#{x}([^%]+)?%/)
if m[1].nil?
next if m.nil?
if m[1].nil?
string.sub!(/%#{x}%/,removals[x.to_i])
else
if removals[x.to_i] =~ /\[[^\]]+\]([\[\(][^\]\)]+[\]\)])/
Expand Down
Expand Up @@ -33,7 +33,9 @@ end
def strip_html(string,removals)
iterations = string.scan(/&lt;[^&gt;]+&gt;/).length
while iterations &gt; 0
string.sub!(/(&lt;[^&gt;]+&gt;)/,"%#{removals.length}%")
subnum = removals.length
subnum = "0" + subnum.to_s if subnum.to_s.length == 1
string.sub!(/(&lt;[^&gt;]+&gt;)/,"%#{subnum}%")
removals += $1.to_a
iterations -= 1
end
Expand Down Expand Up @@ -72,7 +74,8 @@ def restore_replacements(string,removals)
removals.each_with_index {|removal,x|
x = "0" + x.to_s if x.to_s.length == 1
m = string.match(/%#{x}([^%]+)?%/)
if m[1].nil?
next if m.nil?
if m[1].nil?
string.sub!(/%#{x}%/,removals[x.to_i])
else
if removals[x.to_i] =~ /\[[^\]]+\]([\[\(][^\]\)]+[\]\)])/
Expand Down Expand Up @@ -205,6 +208,9 @@ html_footer
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby -wKU

SUPPORT = ENV['TM_SUPPORT_PATH']
require SUPPORT + '/lib/exit_codes'
require 'erb'

# CHANGE: 3/27/09 search for $32.25 with no trailing US, accounts for possible space ($32 US)
Expand All @@ -221,7 +227,9 @@ end
def strip_html(string,removals)
iterations = string.scan(/&lt;[^&gt;]+&gt;/).length
while iterations &gt; 0
string.sub!(/(&lt;[^&gt;]+&gt;)/,"%#{removals.length}%")
subnum = removals.length
subnum = "0" + subnum.to_s if subnum.to_s.length == 1
string.sub!(/(&lt;[^&gt;]+&gt;)/,"%#{subnum}%")
removals += $1.to_a
iterations -= 1
end
Expand Down Expand Up @@ -260,7 +268,8 @@ def restore_replacements(string,removals)
removals.each_with_index {|removal,x|
x = "0" + x.to_s if x.to_s.length == 1
m = string.match(/%#{x}([^%]+)?%/)
if m[1].nil?
next if m.nil?
if m[1].nil?
string.sub!(/%#{x}%/,removals[x.to_i])
else
if removals[x.to_i] =~ /\[[^\]]+\]([\[\(][^\]\)]+[\]\)])/
Expand Down Expand Up @@ -351,6 +360,6 @@ print restore_replacements(newstring + string,removals)</string>
<key>scope</key>
<string>text.html,text.html.markdown,text.html.markdown.multimarkdown</string>
<key>uuid</key>
<string>8BA9BA89-00ED-47C5-A137-35E9C64A205C</string>
<string>24AEA2EE-846A-4246-A326-7F2FC9727E97</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions info.plist
Expand Up @@ -112,6 +112,7 @@
<key>ordering</key>
<array>
<string>8BA9BA89-00ED-47C5-A137-35E9C64A205C</string>
<string>24AEA2EE-846A-4246-A326-7F2FC9727E97</string>
<string>7D554CE8-6BD2-4D30-A8AC-13D434443102</string>
<string>925F2507-B49C-43A6-B521-53315894BD0A</string>
<string>363B0133-F480-495C-B68B-9122101D9DE1</string>
Expand Down

0 comments on commit 000977b

Please sign in to comment.