Liking cljdoc? Tell your friends :D

dk.simongray.webmention.mention

What you need to show a mention, read from the microformats of its source: its kind, its author and its content.

The kind follows the Response Type Algorithm of Post Type Discovery, the W3C Note of 18 January 2018 at https://www.w3.org/TR/post-type-discovery/. The author follows the authorship algorithm at https://indieweb.org/authorship-spec, and the h-card of a page follows https://microformats.org/wiki/representative-h-card-parsing, as microformats-clj reads them.

The steps behind these functions are in dk.simongray.webmention.items and dk.simongray.webmention.content, which aren't part of the API.

What you need to show a mention, read from the microformats of its
source: its kind, its author and its content.

The kind follows the Response Type Algorithm of Post Type Discovery, the
W3C Note of 18 January 2018 at https://www.w3.org/TR/post-type-discovery/.
The author follows the authorship algorithm at
https://indieweb.org/authorship-spec, and the h-card of a page follows
https://microformats.org/wiki/representative-h-card-parsing, as
microformats-clj reads them.

The steps behind these functions are in dk.simongray.webmention.items
and dk.simongray.webmention.content, which aren't part of the API.
raw docstring

author!clj/s

(author! report)
(author! {:keys [mf2 url source] :as report} opts)

The author of the mention in the report of a verification, by the authorship algorithm, as a map of its :name, :url and :photo, with opts.

When the page names its author by the URL of the author's page alone, it fetches that page for the h-card whose url and uid are that of the page, or else whose url is that of a rel=me link there. Failing that, it takes the h-card with that url on the page of the mention, and else the author is the :url alone. The opts are those of webmention/default-options. In ClojureScript, it gives a promise.

The author of the mention in the `report` of a verification, by the
authorship algorithm, as a map of its :name, :url and :photo, with
`opts`.

When the page names its author by the URL of the author's page alone,
it fetches that page for the h-card whose url and uid are that of the
page, or else whose url is that of a rel=me link there. Failing that, it
takes the h-card with that url on the page of the mention, and else the
author is the :url alone. The `opts` are those of
webmention/default-options. In ClojureScript, it gives a promise.
sourceraw docstring

content-elementclj/s

(content-element [tag attrs & children :as element])

The element of a mention's content as your page shows it:

  • a heading as a paragraph, so that it stays out of the page's outline
  • an image as its alt text, so that it doesn't load from another site
  • a link with rel="nofollow ugc", as content that a stranger wrote
The `element` of a mention's content as your page shows it:

- a heading as a paragraph, so that it stays out of the page's outline
- an image as its alt text, so that it doesn't load from another site
- a link with rel="nofollow ugc", as content that a stranger wrote
sourceraw docstring

entryclj/s

(entry mf2 url)

The h-entry that the page at url with the parsed mf2 is about: the one whose url is that of the page, or else the first at the top of the page or in a feed there. Nil when it has none.

The h-entry that the page at `url` with the parsed `mf2` is about: the
one whose url is that of the page, or else the first at the top of the
page or in a feed there. Nil when it has none.
sourceraw docstring

kindclj/s

(kind entry)
(kind entry target)

The kind of response that the h-entry entry is to target: :rsvp, :repost, :like, :reply, :bookmark, or else :mention.

A property counts when one of its values is the target, as a URL or as the url of an embedded h-cite, so that a reply to another page that mentions the target is a mention of it. An RSVP is a reply to the target with an rsvp of yes, no, maybe or interested. Without a target, any URL counts.

The kind of response that the h-entry `entry` is to `target`: :rsvp,
:repost, :like, :reply, :bookmark, or else :mention.

A property counts when one of its values is the target, as a URL or as
the url of an embedded h-cite, so that a reply to another page that
mentions the target is a mention of it. An RSVP is a reply to the
target with an rsvp of yes, no, maybe or interested. Without a target,
any URL counts.
sourceraw docstring

representative-cardclj/s

(representative-card mf2 url)

The representative h-card of the page at url with the parsed mf2, as a map of its :name, :url and :photo, those it has, or nil when it has none.

It's the first h-card whose url and uid are the URL of the page, or else the first whose url is that of a rel=me link of the page, or else the only h-card, if its url is that of the page.

The representative h-card of the page at `url` with the parsed `mf2`, as
a map of its :name, :url and :photo, those it has, or nil when it has
none.

It's the first h-card whose url and uid are the URL of the page, or else
the first whose url is that of a rel=me link of the page, or else the
only h-card, if its url is that of the page.
sourceraw docstring

response-propertiesclj/s

The kinds of response and the property by which a response is of each, in the order that they count.

The kinds of response and the property by which a response is of each,
in the order that they count.
sourceraw docstring

summaryclj/s

(summary report)
(summary {:keys [mf2 url source target] page-title :title :as report} opts)

The mention in the report of a verification, as a map of what a page shows of it, by opts:

  • :source and :target, as in the report
  • :kind, as kind gives it
  • :url, the URL of the mention, which can differ from the source, e.g. for a post that a bridge sent on, and else the URL of the source
  • :author, the :name, :url and :photo of the author's h-card, or the :url of the author's page alone, for which author! finds the rest
  • :name, the title of an article
  • :published, as the page has it
  • :content, the :text and the sanitized :hiccup of the content, or else of the summary
  • :in-reply-to, the URLs that it replies to
  • :rsvp, the answer of an RSVP

Each key is left out when the page has nothing for it. The opts are these, and those of html-pieces for the Hiccup of the content, with content-element as the :element-fn unless they give another:

  • :max-length, how many characters of text the content keeps at most, the breaks between its paragraphs not counted. It's cut back to the end of a word, with an ellipsis, e.g. for an excerpt of a reply.
  • :any-name?, true for the name of any entry, which for a note is its text, rather than for the title of an article alone
  • :page-title?, true for the :title of the report as the name, that of the title element of the page, when the entry has none
The mention in the `report` of a verification, as a map of what a page
shows of it, by `opts`:

- :source and :target, as in the report
- :kind, as kind gives it
- :url, the URL of the mention, which can differ from the source, e.g.
  for a post that a bridge sent on, and else the URL of the source
- :author, the :name, :url and :photo of the author's h-card, or the
  :url of the author's page alone, for which author! finds the rest
- :name, the title of an article
- :published, as the page has it
- :content, the :text and the sanitized :hiccup of the content, or else
  of the summary
- :in-reply-to, the URLs that it replies to
- :rsvp, the answer of an RSVP

Each key is left out when the page has nothing for it. The `opts` are
these, and those of html-pieces for the Hiccup of the content, with
content-element as the :element-fn unless they give another:

- :max-length, how many characters of text the content keeps at most,
  the breaks between its paragraphs not counted. It's cut back to the
  end of a word, with an ellipsis, e.g. for an excerpt of a reply.
- :any-name?, true for the name of any entry, which for a note is its
  text, rather than for the title of an article alone
- :page-title?, true for the :title of the report as the name, that of
  the title element of the page, when the entry has none
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