Page MenuHomePhabricator
Paste P12092

Diff-blog Telegram Instant View ruleset
ActivePublic

Authored by valerio.bozzolan on Jul 28 2020, 6:57 PM.
Referenced Files
F34961697: Diff-blog Telegram Instant View ruleset
Feb 22 2022, 8:14 AM
F31952053: raw.txt
Jul 28 2020, 6:57 PM
Subscribers
None
# Inherited from blog.linuxdaytorino.org
# Use Instant View version 2.0
~version: "2.0"
# Use this template only blog article pages
?exists: //article[has-class("post")+has-class("page")]
# Get article text in <article>
body: //article
# Get title from the first main document heading
title: //h1[1]
# There are usually NO subtitles, but anyway...
subtitle: $title/next-sibling::h2
# The date has a dedicated <time> HTML5 element
published_date: //time[has-class("entry-date")]
# The Author has its own CSS class
author: //a[has-class("author")]
author_url: //a[has-class("author")]//@href
# Get article cover image
cover: //img[has-class("wp-post-image")]
# Convert all iframe elements to inline element
@inline: //iframe[starts-with(@src, "/media/")]
# Remote header and footer
@remove: //article/header
@remove: //article/footer
# Remove day, author, year
@remove: //div[has-class("entry-meta")]
# Remove social sharing
@remove: //div[has-class("social-sharing")]
# "Related posts" heading (that is hidden by CSS but displayed in Telegram)
@remove: //div[@id="jp-relatedposts"]
# Replace p to figure
@replace_tag(<figure>): //p[.//img]
# Youtube Embedded Fix
@replace_tag(<figure>): //p[.//iframe]