Embed attachments marked up as microformats2 (I think rather properly)
This commit is contained in:
parent
327b8c863e
commit
97f7e6632d
@ -243,24 +243,24 @@ class OembedPlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out->elementStart('article', ['class'=>'oembed-item']);
|
$out->elementStart('article', ['class'=>'h-entry oembed']);
|
||||||
$out->elementStart('header');
|
$out->elementStart('header');
|
||||||
try {
|
try {
|
||||||
$thumb = $file->getThumbnail(128, 128);
|
$thumb = $file->getThumbnail(128, 128);
|
||||||
$out->element('img', $thumb->getHtmlAttrs(['class'=>'oembed-thumb']));
|
$out->element('img', $thumb->getHtmlAttrs(['class'=>'u-photo oembed']));
|
||||||
unset($thumb);
|
unset($thumb);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$out->element('div', ['class'=>'error'], $e->getMessage());
|
$out->element('div', ['class'=>'error'], $e->getMessage());
|
||||||
}
|
}
|
||||||
$out->elementStart('h5', ['class'=>'oembed-title']);
|
$out->elementStart('h5', ['class'=>'p-name oembed']);
|
||||||
$out->element('a', ['href'=>$file->getUrl()], common_strip_html($oembed->title));
|
$out->element('a', ['class'=>'u-url', 'href'=>$file->getUrl()], common_strip_html($oembed->title));
|
||||||
$out->elementEnd('h5');
|
$out->elementEnd('h5');
|
||||||
$out->elementStart('div', ['class'=>'oembed-source']);
|
$out->elementStart('div', ['class'=>'p-author oembed']);
|
||||||
if (!empty($oembed->author_name)) {
|
if (!empty($oembed->author_name)) {
|
||||||
// TRANS: text before the author name of oEmbed attachment representation
|
// TRANS: text before the author name of oEmbed attachment representation
|
||||||
// FIXME: The whole "By x from y" should be i18n because of different language constructions.
|
// FIXME: The whole "By x from y" should be i18n because of different language constructions.
|
||||||
$out->text(_('By '));
|
$out->text(_('By '));
|
||||||
$attrs = ['class'=>'h-card'];
|
$attrs = ['class'=>'h-card p-author'];
|
||||||
if (!empty($oembed->author_url)) {
|
if (!empty($oembed->author_url)) {
|
||||||
$attrs['href'] = $oembed->author_url;
|
$attrs['href'] = $oembed->author_url;
|
||||||
$tag = 'a';
|
$tag = 'a';
|
||||||
@ -284,7 +284,7 @@ class OembedPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
$out->elementEnd('div');
|
$out->elementEnd('div');
|
||||||
$out->elementEnd('header');
|
$out->elementEnd('header');
|
||||||
$out->elementStart('div', ['class'=>'oembed-html']);
|
$out->elementStart('div', ['class'=>'p-summary oembed']);
|
||||||
$out->raw(common_purify($oembed->html));
|
$out->raw(common_purify($oembed->html));
|
||||||
$out->elementEnd('div');
|
$out->elementEnd('div');
|
||||||
$out->elementStart('footer');
|
$out->elementStart('footer');
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
.oembed-thumb {
|
.u-photo.oembed {
|
||||||
float: left;
|
float: left;
|
||||||
margin-bottom: 1ex;
|
margin-bottom: 1ex;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
padding-bottom: 1ex;
|
padding-bottom: 1ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.oembed-source {
|
.p-author.oembed {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
.oembed-html {
|
.p-summary.oembed {
|
||||||
max-height: 100px;
|
line-height: 1.25em;
|
||||||
|
max-height: 5em;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user