Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Address the comments in PR.
Browse files Browse the repository at this point in the history
  • Loading branch information
iammrigank committed Jun 10, 2016
1 parent d0d4388 commit d0b0713
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions lib/DDG/Spice/Goodreads.pm
Expand Up @@ -3,6 +3,7 @@ package DDG::Spice::Goodreads;
use strict;
use DDG::Spice;
use URI::Escape;
use Text::Trim;

# Caching
spice is_cached => 1;
Expand Down Expand Up @@ -39,10 +40,11 @@ spice from => '([^-]+)-([^-]+)';
# Triggers
triggers startend => "goodreads", "gr";

my $book_pattern = qr/(list )?(of )?books? ?(written )?(on|by|about) /i;
my $goodreads_pattern = qr/(goodreads|gr)/i;

# Handle statement
handle query_clean => sub {
my $book_pattern = qr/(list )?(of )?books? ?(written )?(on|by|about) /i;
my $goodreads_pattern = qr/(goodreads|gr)/i;
return unless $_ =~ $book_pattern;

my $search_type =
Expand All @@ -51,7 +53,7 @@ handle query_clean => sub {
: "title";
$_ =~ s/$book_pattern//g; # removing the book query pattern from query
$_ =~ s/$goodreads_pattern//g; # removing the goodreads trigger pattern from query
$_ =~ s/^\s+|\s+$//g; # trim spaces from queries
$_ = trim($_); # trim spaces from queries
return "$search_type-$_" if $_;

return;
Expand Down
4 changes: 2 additions & 2 deletions share/spice/goodreads/goodreads.css
Expand Up @@ -7,10 +7,10 @@
To change this template use Tools | Templates.
*/

.record__cell--key {
.zci--goodreads .record__cell--key {
width: 13em !important;
}

.record__cell--value {
.zci--goodreads .record__cell--value {
font-weight: bold;
}
2 changes: 1 addition & 1 deletion share/spice/goodreads/goodreads.js
Expand Up @@ -59,7 +59,7 @@

$.getScript(book_details_uri + book.id.text, function (data) {
var book = data.GoodreadsResponse.book;
var description = book.description.text || "-- No Description Found --";
var description = book.description.text || "Description unavailable";

item.set({
abstract: description && Handlebars.helpers.ellipsis(description.replace(/<\/?\w*>/gm, ''), 400),
Expand Down

0 comments on commit d0b0713

Please sign in to comment.