Liking cljdoc? Tell your friends :D

dk.simongray.microformats

Microformats2 parsed from HTML, or from the Hiccup of html-pieces, by the microformats2 parsing specification: https://microformats.org/wiki/microformats2-parsing

The functions after parse read its result: the microformats of a page in document order, the values of their properties, the representative h-card of a page, and the author of an h-entry.

Microformats2 parsed from HTML, or from the Hiccup of html-pieces, by
the microformats2 parsing specification:
https://microformats.org/wiki/microformats2-parsing

The functions after parse read its result: the microformats of a page
in document order, the values of their properties, the representative
h-card of a page, and the author of an h-entry.
raw docstring

authorclj/s

(author mf2 url entry)

The author of the h-entry entry of the page at url whose microformats are mf2, the result of parse, by the authorship algorithm, or nil when the page names none.

The author is a map of either its :card, an h-card, or the URL of the author's :page, which author-card finds the h-card on once you've fetched it. An author named by text alone is a card with the name.

The author of the h-entry `entry` of the page at `url` whose
microformats are `mf2`, the result of parse, by the authorship
algorithm, or nil when the page names none.

The author is a map of either its :card, an h-card, or the URL of the
author's :page, which author-card finds the h-card on once you've
fetched it. An author named by text alone is a card with the name.
sourceraw docstring

author-cardclj/s

(author-card mf2 page page-mf2)

The h-card of the author whose page at page has the microformats page-mf2, by the authorship algorithm, where mf2 are those of the page of the entry. Nil when there's none.

It's the first h-card of the author's page whose url and uid are that page, or else whose url is that of a rel=me link there, or else the first h-card of the entry's page whose url is the author's page. The page-mf2 can be nil, e.g. when the author's page couldn't be fetched.

The h-card of the author whose page at `page` has the microformats
`page-mf2`, by the authorship algorithm, where `mf2` are those of the
page of the entry. Nil when there's none.

It's the first h-card of the author's page whose url and uid are that
page, or else whose url is that of a rel=me link there, or else the
first h-card of the entry's page whose url is the author's page. The
`page-mf2` can be nil, e.g. when the author's page couldn't be fetched.
sourceraw docstring

itemsclj/s

(items mf2)
(items mf2 type)

Every microformat in mf2, the result of parse, at any depth and in document order: those at the top of the page, in the properties of others, and among their children. With type, e.g. h-card, only those of that type.

Every microformat in `mf2`, the result of parse, at any depth and in
document order: those at the top of the page, in the properties of
others, and among their children. With `type`, e.g. h-card, only those
of that type.
sourceraw docstring

parseclj/s

(parse x url)
(parse x url opts)

The microformats of x, the HTML or the Hiccup of the page at url, as a map of :items, :rels and :rel-urls, in the shape of the JSON of the spec, by opts.

The Hiccup is that of html-pieces/parse, so that a page can be parsed once for several uses. Relative URLs are resolved against url and the first base element, and they stay relative when url is nil and there is no base. An e- property has its content as :hiccup too, next to the :html and the :value of the spec. The classes of microformats1, e.g. vcard, are read as the spec's backcompat microformats, e.g. h-card.

A text value is the text content of its element, as the spec has it, but with a line break at each br, and where a block element would otherwise run words together. With :collapse-whitespace? in opts, its whitespace is collapsed instead, as php-mf2 and mf2py do it, by the draft of https://microformats.org/wiki/textcontent-parsing

With :proposed-backcompat? in opts, an hentry without a published date or an author takes them from the first time of the class entry-date and the first rel=author hyperlink in it, as the h-entry page of the microformats wiki proposes for the default themes of WordPress.

(parse "<a class=h-card href=/jane>Jane</a>" "https://example.com/")
;; => {:items    [{:type       ["h-card"]
;;                 :properties {:name ["Jane"]
;;                              :url  ["https://example.com/jane"]}}]
;;     :rels     {}
;;     :rel-urls {}}
The microformats of `x`, the HTML or the Hiccup of the page at `url`, as
a map of :items, :rels and :rel-urls, in the shape of the JSON of the
spec, by `opts`.

The Hiccup is that of html-pieces/parse, so that a page can be parsed
once for several uses. Relative URLs are resolved against `url` and the
first base element, and they stay relative when `url` is nil and there
is no base. An e- property has its content as :hiccup too, next to the
:html and the :value of the spec. The classes of microformats1, e.g.
vcard, are read as the spec's backcompat microformats, e.g. h-card.

A text value is the text content of its element, as the spec has it, but
with a line break at each br, and where a block element would otherwise
run words together. With :collapse-whitespace? in `opts`, its whitespace
is collapsed instead, as php-mf2 and mf2py do it, by the draft of
https://microformats.org/wiki/textcontent-parsing

With :proposed-backcompat? in `opts`, an hentry without a published date
or an author takes them from the first time of the class entry-date and
the first rel=author hyperlink in it, as the h-entry page of the
microformats wiki proposes for the default themes of WordPress.

    (parse "<a class=h-card href=/jane>Jane</a>" "https://example.com/")
    ;; => {:items    [{:type       ["h-card"]
    ;;                 :properties {:name ["Jane"]
    ;;                              :url  ["https://example.com/jane"]}}]
    ;;     :rels     {}
    ;;     :rel-urls {}}
sourceraw docstring

propertyclj/s

(property item k)

The first plain value of the property k of the microformat item that isn't empty, as value gives it, or nil.

The first plain value of the property `k` of the microformat `item`
that isn't empty, as value gives it, or nil.
sourceraw docstring

relsclj/s

(rels x url)
(rels x url opts)

The rels of x, the HTML or the Hiccup of the page at url, as a map of :rels and :rel-urls, by opts, as parse gives them, but without parsing the microformats of the page.

The rels of `x`, the HTML or the Hiccup of the page at `url`, as a map
of :rels and :rel-urls, by `opts`, as parse gives them, but without
parsing the microformats of the page.
sourceraw docstring

representative-cardclj/s

(representative-card mf2 url)

The representative h-card of the page at url whose microformats are mf2, the result of parse, or nil: 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 its only h-card, if its url is the page's.

The representative h-card of the page at `url` whose microformats are
`mf2`, the result of parse, or nil: 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 its only h-card, if its url is the page's.
sourceraw docstring

urlsclj/s

(urls item k)

The URLs that the property k of the microformat item names, made normal by the URL Standard: each value that's an absolute URL, and the value and the urls of an embedded microformat, e.g. of an h-cite.

The URLs that the property `k` of the microformat `item` names, made
normal by the URL Standard: each value that's an absolute URL, and the
value and the urls of an embedded microformat, e.g. of an h-cite.
sourceraw docstring

valueclj/s

(value v)

The plain value of v, a value of a property: the text of a string, or else the :value of an embedded microformat, of an e- property or of an image with alt text.

The plain value of `v`, a value of a property: the text of a string, or
else the :value of an embedded microformat, of an e- property or of an
image with alt text.
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