Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link olid macro #9348

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
067929e
link olid macro
May 27, 2024
2f13250
fix typo
mekarpeles Jun 18, 2024
ee40b64
behind
psyren99 Jun 29, 2024
f6bd556
Merge branch 'internetarchive:master' into 2283/linking_to_olid
psyren99 Jun 30, 2024
1c2e082
Merge branch '2283/linking_to_olid' of github.com:psyren99/openlibrary
psyren99 Jun 30, 2024
a3d8728
new olid function to edition
psyren99 Jun 30, 2024
e14bf74
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 30, 2024
b488387
removing olid
psyren99 Jun 30, 2024
20c3c28
Merge branch '2283/linking_to_olid' of github.com:psyren99/openlibrar…
psyren99 Jun 30, 2024
11788b9
Merge branch 'master' of github.com:psyren99/openlibrary into 2283/li…
psyren99 Jun 30, 2024
4683a88
test olid link
psyren99 Jun 30, 2024
9dc27b4
olid test in wrong file
psyren99 Jul 2, 2024
0819948
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 2, 2024
df7e6af
Merge branch 'master' of https://github.com/internetarchive/openlibrary
psyren99 Aug 31, 2024
2a6b8ec
Merge branch '2283/linking_to_olid' of github.com:psyren99/openlibrary
psyren99 Aug 31, 2024
94814f6
olid
psyren99 Sep 4, 2024
6d798c3
pre commit
psyren99 Sep 4, 2024
b63f535
Revert "Deleted unused files. (#9454)"
psyren99 Jan 19, 2025
957679f
checkout master of merge conflict files
RayBB Jan 22, 2025
3144f6f
Merge branch 'master' into 2283/linking_to_olid
RayBB Jan 22, 2025
da95568
Merge branch 'master' of https://github.com/internetarchive/openlibrary
psyren99 Feb 16, 2025
99d7e8d
Merge branch 'internetarchive:master' into 2283/linking_to_olid
psyren99 Feb 21, 2025
3101be4
adding authors and covers
psyren99 Feb 21, 2025
729729b
pre commit
psyren99 Feb 21, 2025
44739c5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 21, 2025
f973d96
Merge branch 'master' of https://github.com/internetarchive/openlibrary
psyren99 Feb 22, 2025
4e72446
behind
psyren99 Jun 29, 2024
4c9ae72
link olid macro
May 27, 2024
669ae67
fix typo
mekarpeles Jun 18, 2024
5e101cb
new olid function to edition
psyren99 Jun 30, 2024
b3784d5
removing olid
psyren99 Jun 30, 2024
fe359e1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 30, 2024
0ce0a36
test olid link
psyren99 Jun 30, 2024
41ce331
olid test in wrong file
psyren99 Jul 2, 2024
134d569
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 2, 2024
11963bd
olid
psyren99 Sep 4, 2024
aa8dcf1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 21, 2025
db0b27e
fixing working tree
psyren99 Feb 22, 2025
21ab22b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions openlibrary/macros/OLID.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$def with (q="#")

$ edition = query_param('edition', q)
$ results = find_matches(olid, q)
Copy link
Member

@mekarpeles mekarpeles Jun 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_matches isn't a public function that's available here. It either needs to be passed in as a parameter, made a @public function, or be added to plugins/openlibrary/code.py as a template global: https://github.com/internetarchive/openlibrary/blob/master/openlibrary/plugins/openlibrary/code.py#L1146-L1171

I think though that find_matches is probably just the wrong function to use. We likely want to use some existing global function to do a web.ctx.site.things get for the specific olid (open library id)

$ olid = edition.key. split("/")[-1])

$if(olid == q):
<a href="edition.key">edition.title</a>
$else:
<a href="results.key">olid</a>