Permalink
Browse files

Raise GEM version. Clean out old gems. Add new 1.1.2 build (hit highl…

…ighting fix)
  • Loading branch information...
1 parent ca9884f commit 6186b5126f7716b01981e6bed474f985478211ce Matt Sanford committed May 11, 2010
View
2 Rakefile
@@ -9,7 +9,7 @@ require 'digest'
spec = Gem::Specification.new do |s|
s.name = "twitter-text"
- s.version = "1.1.1"
+ s.version = "1.1.2"
s.authors = ["Matt Sanford", "Patrick Ewing", "Ben Cherry", "Britt Selvitelle"]
s.email = ["matt@twitter.com", "patrick.henry.ewing@gmail.com", "bcherry@gmail.com", "bs@brittspace.com"]
s.homepage = "http://twitter.com"
View
1 TODO
@@ -1,4 +1,3 @@
TODO:
* @mentions preceded by a dash should work. "I am great -@greatguy"
- * HitHighlighter tests should be moved to the conformance suite
View
29 doc/classes/Twitter/HitHighlighter.html
@@ -169,6 +169,7 @@ <h3 class="section-bar">Public Instance methods</h3>
<span class="ruby-identifier">result</span> = <span class="ruby-value str">&quot;&quot;</span>
<span class="ruby-identifier">chunk_index</span>, <span class="ruby-identifier">chunk</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">chunks</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">chunk_chars</span> = <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">&quot;mb_chars&quot;</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">mb_chars</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">&quot;chars&quot;</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">chars</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">&quot;[]&quot;</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">chars</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">chunk</span>
<span class="ruby-identifier">prev_chunks_len</span> = <span class="ruby-value">0</span>
<span class="ruby-identifier">chunk_cursor</span> = <span class="ruby-value">0</span>
<span class="ruby-identifier">start_in_chunk</span> = <span class="ruby-keyword kw">false</span>
@@ -177,36 +178,46 @@ <h3 class="section-bar">Public Instance methods</h3>
<span class="ruby-identifier">placed</span> = <span class="ruby-keyword kw">false</span>
<span class="ruby-keyword kw">until</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">hit</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">prev_chunks_len</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">length</span> <span class="ruby-keyword kw">do</span>
- <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">chunk</span>[<span class="ruby-identifier">chunk_cursor</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">start_in_chunk</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">hit</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">prev_chunks_len</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">length</span>
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">chunk_chars</span>[<span class="ruby-identifier">chunk_cursor</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">start_in_chunk</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">hit</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">prev_chunks_len</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">chunk_chars</span>.<span class="ruby-identifier">length</span>
<span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">tag</span>
<span class="ruby-identifier">placed</span> = <span class="ruby-keyword kw">true</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-comment cmt"># correctly handle highlights that end on the final character.</span>
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text_after</span> = <span class="ruby-identifier">chunks</span>[<span class="ruby-identifier">chunk_index</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>]
- <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;#{text_after}&gt;&quot;</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tag_text</span> = <span class="ruby-identifier">chunks</span>[<span class="ruby-identifier">chunk_index</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>]
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;#{tag_text}&gt;&quot;</span>
<span class="ruby-keyword kw">end</span>
- <span class="ruby-identifier">prev_chunks_len</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">length</span>
+
+ <span class="ruby-identifier">prev_chunks_len</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">chunk_chars</span>.<span class="ruby-identifier">length</span>
<span class="ruby-identifier">chunk_cursor</span> = <span class="ruby-value">0</span>
<span class="ruby-identifier">chunk_index</span> <span class="ruby-operator">+=</span> <span class="ruby-value">2</span>
<span class="ruby-identifier">chunk</span> = <span class="ruby-identifier">chunks</span>[<span class="ruby-identifier">chunk_index</span>]
+ <span class="ruby-identifier">chunk_chars</span> = <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">&quot;mb_chars&quot;</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">mb_chars</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">&quot;chars&quot;</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">chars</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">&quot;[]&quot;</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">chars</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">chunk</span>
<span class="ruby-identifier">start_in_chunk</span> = <span class="ruby-keyword kw">false</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">placed</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">nil?</span>
<span class="ruby-identifier">hit_spot</span> = <span class="ruby-identifier">hit</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">prev_chunks_len</span>
- <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">chunk</span>[<span class="ruby-identifier">chunk_cursor</span><span class="ruby-operator">...</span><span class="ruby-identifier">hit_spot</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">tag</span>
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">chunk_chars</span>[<span class="ruby-identifier">chunk_cursor</span><span class="ruby-operator">...</span><span class="ruby-identifier">hit_spot</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">tag</span>
<span class="ruby-identifier">chunk_cursor</span> = <span class="ruby-identifier">hit_spot</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">%</span> <span class="ruby-value">2</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
<span class="ruby-identifier">start_in_chunk</span> = <span class="ruby-keyword kw">true</span>
<span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">placed</span> = <span class="ruby-keyword kw">true</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># ultimate fallback, hits that run off the end get a closing tag</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">placed</span>
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">tag</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">nil?</span>
- <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">chunk</span>[<span class="ruby-identifier">chunk_cursor</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
- <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">index</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">chunk_index</span><span class="ruby-operator">+</span><span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">chunks</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">chunk</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">chunk_cursor</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">chunk_chars</span>.<span class="ruby-identifier">length</span>
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">chunk_chars</span>[<span class="ruby-identifier">chunk_cursor</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-identifier">chunk_index</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>).<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">chunks</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">index</span>.<span class="ruby-identifier">even?</span> <span class="ruby-value">? </span><span class="ruby-identifier">chunks</span>[<span class="ruby-identifier">index</span>] <span class="ruby-operator">:</span> <span class="ruby-node">&quot;&lt;#{chunks[index]}&gt;&quot;</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
View
2 doc/created.rid
@@ -1 +1 @@
-Mon, 26 Apr 2010 11:40:34 -0700
+Tue, 11 May 2010 10:59:53 -0700
View
2 doc/files/README_rdoc.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Mon Apr 26 11:22:09 -0700 2010</td>
+ <td>Fri Apr 30 11:18:50 -0700 2010</td>
</tr>
</table>
</div>
View
2 doc/files/lib/autolink_rb.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Mon Apr 26 11:22:09 -0700 2010</td>
+ <td>Fri Apr 30 11:18:50 -0700 2010</td>
</tr>
</table>
</div>
View
2 doc/files/lib/hithighlighter_rb.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Mon Apr 26 11:40:26 -0700 2010</td>
+ <td>Tue May 11 10:59:03 -0700 2010</td>
</tr>
</table>
</div>
View
2 doc/files/lib/regex_rb.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Mon Apr 26 11:14:07 -0700 2010</td>
+ <td>Fri Apr 30 11:18:51 -0700 2010</td>
</tr>
</table>
</div>
View
2 doc/files/lib/twitter-text_rb.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Mon Apr 26 11:22:09 -0700 2010</td>
+ <td>Fri Apr 30 11:18:51 -0700 2010</td>
</tr>
</table>
</div>
View
BIN pkg/twitter-text-1.0.1.gem
Binary file not shown.
View
BIN pkg/twitter-text-1.0.2.gem
Binary file not shown.
View
BIN pkg/twitter-text-1.0.3.gem
Binary file not shown.
View
BIN pkg/twitter-text-1.0.4.gem
Binary file not shown.
View
BIN pkg/twitter-text-1.0.gem
Binary file not shown.
View
BIN pkg/twitter-text-1.1.2.gem
Binary file not shown.

0 comments on commit 6186b51

Please sign in to comment.