Fix links in tweets when there's a prefix #479

Merged
philgyford merged 2 commits from fix-html-for-tweet-2 into master 2018-01-08 06:36:12 -08:00
philgyford commented 2018-01-06 11:08:19 -08:00 (Migrated from github.com)

If a tweet had a prefix (@names that it was replying to) then the length
of these is counted in the indices that show the locations of entities
within the tweet. But we were applying those indices to the 'display'
part of the tweet that doesn't include the prefix.

So, if the tweet was:

@bob Please meet @bill

and the prefix was @bob , then the indices for linking @bill
are something like 17,21. But we were applying the link around
@bill to the display text part of the tweet, which is:

Please meet @bill

And so the indices no longer lined up with @bill.

Now they do, and the same for URLs and hashtags.

If a tweet had a prefix (@names that it was replying to) then the length of these is counted in the indices that show the locations of entities within the tweet. But we were applying those indices to the 'display' part of the tweet that doesn't include the prefix. So, if the tweet was: @bob Please meet @bill and the prefix was `@bob `, then the indices for linking `@bill` are something like `17,21`. But we were applying the link around `@bill` to the display text part of the tweet, which is: Please meet @bill And so the indices no longer lined up with `@bill`. Now they do, and the same for URLs and hashtags.
coveralls commented 2018-01-06 11:10:04 -08:00 (Migrated from github.com)

Coverage Status

Coverage decreased (-0.6%) to 57.027% when pulling 73982c78f4 on philgyford:fix-html-for-tweet-2 into 354e31b914 on ryanmcgrath:master.

[![Coverage Status](https://coveralls.io/builds/14931991/badge)](https://coveralls.io/builds/14931991) Coverage decreased (-0.6%) to 57.027% when pulling **73982c78f4bd541c82916c77d7aeb4ad757e9007 on philgyford:fix-html-for-tweet-2** into **354e31b914bfcd496c68f401df21f220977e5d5b on ryanmcgrath:master**.
philgyford commented 2018-01-06 11:12:02 -08:00 (Migrated from github.com)

Darn, python 2! I will get that working tomorrow.

Darn, python 2! I will get that working tomorrow.
coveralls commented 2018-01-06 11:55:41 -08:00 (Migrated from github.com)

Coverage Status

Coverage increased (+0.1%) to 57.703% when pulling 2cfdaaf6e4 on philgyford:fix-html-for-tweet-2 into 354e31b914 on ryanmcgrath:master.

[![Coverage Status](https://coveralls.io/builds/14932261/badge)](https://coveralls.io/builds/14932261) Coverage increased (+0.1%) to 57.703% when pulling **2cfdaaf6e44ced237edc493147c16a38a60926eb on philgyford:fix-html-for-tweet-2** into **354e31b914bfcd496c68f401df21f220977e5d5b on ryanmcgrath:master**.
coveralls commented 2018-01-06 11:55:41 -08:00 (Migrated from github.com)

Coverage Status

Coverage increased (+0.1%) to 57.703% when pulling 2cfdaaf6e4 on philgyford:fix-html-for-tweet-2 into 354e31b914 on ryanmcgrath:master.

[![Coverage Status](https://coveralls.io/builds/14932261/badge)](https://coveralls.io/builds/14932261) Coverage increased (+0.1%) to 57.703% when pulling **2cfdaaf6e44ced237edc493147c16a38a60926eb on philgyford:fix-html-for-tweet-2** into **354e31b914bfcd496c68f401df21f220977e5d5b on ryanmcgrath:master**.
philgyford commented 2018-01-06 11:56:15 -08:00 (Migrated from github.com)

Phew, that's that!

Phew, that's that!
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/twython#479
No description provided.