forked from twitter-archive/twitter-text-rb
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Purge the repo and change the README to point to the canonical repo
- Loading branch information
Showing
29 changed files
with
2 additions
and
3,445 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,115 +1,4 @@ | ||
== twitter-text | ||
|
||
A gem that provides text processing routines for Twitter Tweets. The major | ||
reason for this is to unify the various auto-linking and extraction of | ||
usernames, lists, hashtags and URLs. | ||
|
||
== Extraction Examples | ||
|
||
# Extraction | ||
class MyClass | ||
include Twitter::Extractor | ||
usernames = extract_mentioned_screen_names("Mentioning @twitter and @jack") | ||
# usernames = ["twitter", "jack"] | ||
end | ||
|
||
# Extraction with a block argument | ||
class MyClass | ||
include Twitter::Extractor | ||
extract_reply_screen_name("@twitter are you hiring?").do |username| | ||
# username = "twitter" | ||
end | ||
end | ||
|
||
== Auto-linking Examples | ||
|
||
# Auto-link | ||
class MyClass | ||
include Twitter::Autolink | ||
|
||
html = auto_link("link @user, please #request") | ||
end | ||
|
||
# For Ruby on Rails you want to add this to app/helpers/application_helper.rb | ||
module ApplicationHelper | ||
include Twitter::Autolink | ||
end | ||
|
||
# Now the auto_link function is available in every view. So in index.html.erb: | ||
<%= auto_link("link @user, please #request") %> | ||
|
||
=== Usernames | ||
|
||
Username extraction and linking matches all valid Twitter usernames but does | ||
not verify that the username is a valid Twitter account. | ||
|
||
=== Lists | ||
|
||
Auto-link and extract list names when they are written in @user/list-name | ||
format. | ||
|
||
=== Hashtags | ||
|
||
Auto-link and extract hashtags, where a hashtag can contain most letters or | ||
numbers but cannot be solely numbers and cannot contain punctuation. | ||
|
||
=== URLs | ||
|
||
Auto-linking and extraction of URLs differs from the Rails default so that it | ||
will work correctly in Tweets written in languages that do not include spaces | ||
between words. | ||
|
||
=== International | ||
|
||
Special care has been taken to be sure that auto-linking and extraction work | ||
in Tweets of all languages. This means that languages without spaces between | ||
words should work equally well. | ||
|
||
=== Hit Highlighting | ||
|
||
Use to provide emphasis around the "hits" returned from the Search API, built | ||
to work against text that has been auto-linked already. | ||
|
||
=== Conformance | ||
|
||
To run the Conformance suite, you'll need to add that project as a git submodule. From the root twitter-text-rb directory, run: | ||
|
||
git submodule add git@github.com:twitter/twitter-text-conformance.git test/twitter-text-conformance/ | ||
git submodule init | ||
git submodule update | ||
|
||
=== Thanks | ||
|
||
Thanks to everybody who has filed issues, provided feedback or contributed patches. Patches courtesy of: | ||
|
||
* At Twitter … | ||
* Matt Sanford - http://github.com/mzsanford | ||
* Raffi Krikorian - http://github.com/r | ||
* Ben Cherry - http://github.com/bcherry | ||
* Patrick Ewing - http://github.com/hoverbird | ||
* Jeff Smick - http://github.com/sprsquish | ||
* Kenneth Kufluk - https://github.com/kennethkufluk | ||
* Keita Fujii - https://github.com/keitaf | ||
* Yoshimasa Niwa - https://github.com/niw | ||
|
||
* Patches from the community … | ||
* Jean-Philippe Bougie - http://github.com/jpbougie | ||
* Erik Michaels-Ober - https://github.com/sferik | ||
|
||
* Anyone who has filed an issue. It helps. Really. | ||
|
||
=== Copyright and License | ||
|
||
Copyright 2011 Twitter, Inc. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this work except in compliance with the License. | ||
You may obtain a copy of the License in the LICENSE file, or at: | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
The canonical version of twitter-text-rb can now be found at | ||
https://github.com/twitter/twitter-text-rb |
Oops, something went wrong.