Liking cljdoc? Tell your friends :D

scicloj.zulipdata.emoji

Helpers for displaying Zulip reactions as actual glyphs or images.

A reaction's :reaction-type and :emoji-code (as carried in the views/reactions-long projection) determine what to render:

  • "unicode_emoji":emoji-code is a hyphen-separated sequence of unicode codepoints. "1f64f" is 🙏, "1f3f4-200d-2620-fe0f" is 🏴‍☠️.
  • "realm_emoji" / "zulip_extra_emoji":emoji-code is the workspace's custom-emoji id; the source URL lives in the /realm/emoji endpoint.
Helpers for displaying Zulip reactions as actual glyphs or images.

A reaction's `:reaction-type` and `:emoji-code` (as carried in the
`views/reactions-long` projection) determine what to render:

- `"unicode_emoji"` — `:emoji-code` is a hyphen-separated sequence
  of unicode codepoints. `"1f64f"` is 🙏,
  `"1f3f4-200d-2620-fe0f"` is 🏴‍☠️.
- `"realm_emoji"` / `"zulip_extra_emoji"` — `:emoji-code` is the
  workspace's custom-emoji id; the source URL lives in the
  `/realm/emoji` endpoint.
raw docstring

decode-unicodeclj

(decode-unicode emoji-code)

Decode a hyphen-separated unicode codepoint sequence into a string. "1f64f" → "🙏", "1f3f4-200d-2620-fe0f" → "🏴‍☠️".

Decode a hyphen-separated unicode codepoint sequence into a string.
`"1f64f"` → "🙏", `"1f3f4-200d-2620-fe0f"` → "🏴‍☠️".
sourceraw docstring

displayclj

(display realm-emoji reaction-type emoji-code emoji-name)

Render a reaction as a value suitable for a kind/table cell. Given a realm-emoji map (from realm-emoji-map) and a reaction's three identifying fields, returns:

  • For unicode_emoji: the glyph as a string.
  • For realm_emoji / zulip_extra_emoji: a kind/hiccup <img> element pointing at the realm emoji's :source_url.
  • Otherwise (or when the realm id is unknown): nil.

In a tablecloth pipeline, the natural call is

(tc/map-columns :emoji [:reaction-type :emoji-code :emoji-name]
                (partial emoji/display realm-emoji))
Render a reaction as a value suitable for a `kind/table` cell. Given
a realm-emoji map (from `realm-emoji-map`) and a reaction's three
identifying fields, returns:

- For `unicode_emoji`: the glyph as a string.
- For `realm_emoji` / `zulip_extra_emoji`: a `kind/hiccup` `<img>`
  element pointing at the realm emoji's `:source_url`.
- Otherwise (or when the realm id is unknown): `nil`.

In a tablecloth pipeline, the natural call is

    (tc/map-columns :emoji [:reaction-type :emoji-code :emoji-name]
                    (partial emoji/display realm-emoji))
sourceraw docstring

realm-emoji-mapclj

(realm-emoji-map)

Fetch the workspace's custom-emoji map from /realm/emoji. Returns {:<id> {:source_url ... :name ... ...}} keyed by the realm emoji's id (as keyword).

Fetch the workspace's custom-emoji map from `/realm/emoji`.
Returns `{:<id> {:source_url ... :name ... ...}}` keyed by the
realm emoji's id (as keyword).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close