-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add a :print-fallback key to *options* to fall back on pr-str #18
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,10 @@ | |
The text placed between a map key and a collection value. The keyword :line | ||
will cause line breaks if the whole map does not fit on a single line. | ||
|
||
`:print-fallback` | ||
If true, falls back to to using pr-str rather than puget's default | ||
unknown-document representation | ||
|
||
`:print-meta` | ||
If true, metadata will be printed before values. If nil, defaults to the | ||
value of *print-meta*. | ||
|
@@ -55,6 +59,7 @@ | |
:strict false | ||
:map-delimiter "," | ||
:map-coll-separator " " | ||
:print-fallback false | ||
:print-meta nil | ||
:print-color false | ||
:color-markup :ansi | ||
|
@@ -121,7 +126,7 @@ | |
|
||
|
||
(defn- illegal-when-strict! | ||
"Throws an exception if strict mode is enabled. The error indincates that the | ||
"Throws an exception if strict mode is enabled. The error indicates that the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doh, nice catch. |
||
given value has no EDN representation." | ||
[value] | ||
(when (:strict *options*) | ||
|
@@ -202,14 +207,17 @@ | |
(unknown-document value (.getName (class value)) repr)) | ||
([value tag repr] | ||
(illegal-when-strict! value) | ||
[:span | ||
(color-doc :class-delimiter "#<") | ||
(color-doc :class-name tag) | ||
(color-doc :class-delimiter "@") | ||
(system-id value) | ||
" " | ||
repr | ||
(color-doc :class-delimiter ">")])) | ||
(if (:print-fallback *options*) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of just a boolean switch here, I think it'd be better to make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this a lot. I'll update my PR. |
||
[:span | ||
(pr-str value)] | ||
[:span | ||
(color-doc :class-delimiter "#<") | ||
(color-doc :class-name tag) | ||
(color-doc :class-delimiter "@") | ||
(system-id value) | ||
" " | ||
repr | ||
(color-doc :class-delimiter ">")]))) | ||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update these per the keyword selection below. For simple
pr-str
behavior, I think the keyword could be:print
to indicate it's using the normalprint-method
implementation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I had assumed we'd literally pass the print function, e.g. your
*options*
would include something like:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though a curated keyword selection might indeed be better from a usability perspective.