-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix #118] Display Video output with Kindly
Issue: Wolfram may return `(Video <path to file> ...)` and we want to be able to display it nicely in a Clay or compatible notebook. Fix: Add ns with a fn to try add display metadata to all results, call it from eval.
- Loading branch information
Showing
4 changed files
with
36 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(ns wolframite.impl.kindly-support | ||
"Add Kindly annotations to eval results to improve their display in compatible tools, such as Clay") | ||
|
||
(defn- head [expr] | ||
(when (list? expr) | ||
(first expr))) | ||
|
||
(defn- video->url | ||
"Extract the url from `(Video \"url..\" ...)`" | ||
[expr] | ||
{:pre [(= (head expr) 'Video)]} | ||
(second expr)) | ||
|
||
(defn maybe-add-kindly-meta [expr] | ||
{:pre [expr]} | ||
(->> (cond | ||
(= (head expr) 'Video) | ||
{:kind/video true | ||
:kindly/options {:kindly/f video->url}}) | ||
(with-meta expr))) |
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