-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidated less file for multipurpose use w FTS suggestion card
- Loading branch information
1 parent
078cdf8
commit 7f16afd
Showing
6 changed files
with
38 additions
and
19 deletions.
There are no files selected for viewing
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
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,24 +1,34 @@ | ||
$def with (q, doc=None) | ||
|
||
$ ia = doc.get('fields', {}).get('identifier', [''])[0] | ||
$ ia_base_url = "https://archive.org" | ||
$ availability = doc.get('availability', {}) | ||
$ snippets = doc.get('highlight', {}).get('text', ['']) | ||
$ snippets = doc.get('highlight', {}).get('text', [''])[:2] | ||
$ page_nums = doc.get('fields', {}).get('page_num', []) | ||
$ page = ', '.join([str(num) for num in page_nums]) | ||
$if len(page_nums) == 1 and isinstance(page_nums[0], list): | ||
$ page_nums = page_nums[0] | ||
$ page = ', '.join(str(num) for num in page_nums) | ||
|
||
<ul class="fsi-snippet"> | ||
$for snippet in snippets: | ||
$if snippet: | ||
<li class="fsi-snippet__main fsi-snippet__full-results"> | ||
<div class="fsi-snippet__quotation-mark">$_('❝')</div> | ||
<a class="fsi-snippet__link" href="$ia_base_url/details/$ia" data-ol-link-track="SearchInsideCard|QuoteClick"> | ||
…$:(snippet.replace("<", "«").replace(">", "»").replace("{{{", "<mark class='highlight'><strong>").replace("}}}", "</strong></mark>"))… | ||
</a> | ||
<div class="fsi-snippet__quotation-mark">$_('❞')</div> | ||
$if page: | ||
<span class="fsi-snippet__page-num" href="$ia_base_url/details/$ia"> | ||
<a data-ol-link-track="SearchInsideCard|QuoteClick">$_('Page: %(page)s', page=page)</a> | ||
</span> | ||
</li> | ||
</ul> | ||
|
||
|
||
$if snippets: | ||
<section class="fulltext-excerpts" aria-label="search results from: $doc['edition']['title']"> | ||
<ul> | ||
$for snippet in snippets: | ||
$if snippet: | ||
<li class="fulltext-excerpt"> | ||
…$:(snippet.replace("<", "«").replace(">", "»").replace("{{{", "<mark class='highlight'><strong>").replace("}}}", "</strong></mark>"))… | ||
</li> | ||
</ul> | ||
</section> | ||
|
||
$if availability.get('status') == 'open': | ||
<p class="center"><a href="https://archive.org/stream/$(ia)?ref=ol&access=1#search/$(q)">$_("See All Results")</a></p> | ||
|
||
$if availability.get('status') == 'borrow_available': | ||
<p class="center">$_("Borrow") & <a href="https://archive.org/stream/$(ia)?ref=ol&access=1#search/$(q)">$_("See All Results")</a></p> | ||
<p class="center">$_("Borrow") & <a href="https://archive.org/stream/$(ia)?ref=ol&access=1#search/$(q)">$_("See All Results")</a></p> |
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
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
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
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