Microformats2 parsed from HTML, or from the Hiccup of html-pieces, by the microformats2 parsing specification: https://microformats.org/wiki/microformats2-parsing
Microformats2 parsed from HTML, or from the Hiccup of html-pieces, by the microformats2 parsing specification: https://microformats.org/wiki/microformats2-parsing
(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 {}}cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |