Initialisation du dépôt

This commit is contained in:
Olivier DOSSMANN 2021-05-01 17:05:38 +02:00
commit c94a04381d
15 changed files with 893 additions and 0 deletions

41
README.md Normal file
View File

@ -0,0 +1,41 @@
# Introduction
Ceci est le service de "veille" de Papa Ogre.
C'est un système simple utilisant [Rawdog](https://offog.org/code/rawdog/) pour extraire les flux RSS et en faire une page web statique.
Il se lance toutes les heures pour générer - si besoin - une page.
# Installation
## Dépendances
* [rawdog](https://archlinux.org/packages/community/any/rawdog/) pour ArchLinux
## Dossiers à créér/installer
* copier le **contenu du dossier `rawdog`** dans **/home/od/.rawdog/**
* copier le **contenu du dossier `public`** dans **/srv/http/ogre/veille/**
* copier les fichiers `rawdog.service` et `rawdog.timer` dans **/etc/systemd/system/**
* configurer le fichier **/home/od/.rawdog/config** pour adapter la ligne suivante :
```python
outputfile /srv/http/ogre/veille/index.html
```
avec l'adresse exacte où vous avez posé les fichiers du dossier *public*.
# En bref
```bash
rsync -avP ./rawdog/* /home/od/.rawdog
mkdir /srv/http/ogre/veille -p
rsync -avP ./public/* /srv/http/ogre/veille/
sudo cp rawdog.service /etc/systemd/system/
sudo cp rawdog.timer /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable rawdog.timer
sudo systemctl start rawdog.service
```

1
public/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
index.html

2
public/bulma.min.css vendored Normal file

File diff suppressed because one or more lines are too long

142
public/style-dec23.css Normal file
View File

@ -0,0 +1,142 @@
/* Default stylesheet for rawdog. Customise this as you like.
Adam Sampson <azz@us-lot.org> */
.xmlbutton {
/* From Dylan Greene's suggestion:
http://www.dylangreene.com/blog.asp?blogID=91 */
border: 1px solid;
border-color: #FC9 #630 #330 #F96;
padding: 0 3px;
font: bold 10px sans-serif;
color: #FFF;
background: #F60;
text-decoration: none;
margin: 0;
}
html {
margin: 0;
padding: 0;
}
body {
color: black;
background-color: #999;
margin: 0;
padding: 10px;
font-size: medium;
}
a:link {
color: #337;
}
a:visited {
color: #733;
}
h1, h2, h3 {
font-weight: bold;
margin: 4px 0;
padding: 0 4px;
}
h1 {
font-size: 120%;
text-align: left;
}
h2 {
font-size: 170%;
text-align: left;
}
h3 {
font-size: 150%;
text-align: left;
}
#page {
margin-left: auto;
margin-right: auto;
max-width: 60em;
}
.day {
background-color: #bbb;
border: 1px solid #777;
margin: 10px 0;
padding: 0 4px;
clear: both;
}
.time {
background-color: #ddd;
border: 1px solid #999;
margin: 10px 0;
padding: 0 4px;
clear: both;
}
.item {
background-color: white;
border: 1px solid #bbb;
/*
border-radius-bottomleft: 15px;
border-radius-bottomright: 15px;
-moz-border-radius-bottomleft: 15px;
-moz-border-radius-bottomright: 15px;
*/
margin: 10px 0;
clear: both;
/* Try to restore as much as possible to "normal" settings, so that
invalid HTML doesn't affect later items too much. */
font-size: medium;
text-decoration: none;
font-style: normal;
font-variant: normal;
font-weight: normal;
font-stretch: normal;
text-align: left;
white-space: normal;
text-transform: none;
color: black;
background-color: white;
}
.itemheader {
padding: 4px;
padding-left: 10px;
margin: 0;
background-color: #eee;
}
h4 {
font-weight: bold;
font-size: 110%;
padding: 0;
margin: 2px 0;
}
.itembyline {
padding: 0;
margin: 0 0 2px 0;
}
.itemfrom {
font-style: italic;
}
.itemdescription {
margin-left: 30px;
}
#feedstatsheader {
}
#feedstats {
}
#feeds {
margin: 10px 0;
border: 1px solid gray;
border-spacing: 0;
}
#feedsheader TH {
background-color: #eee;
border-bottom: 1px solid gray;
padding: 5px;
margin: 0;
}
.feedsrow TD {
padding: 5px 10px;
margin: 0;
}
#footer {
background-color: #ffe;
border: 1px solid gray;
margin-top: 20px;
padding: 10px;
}
#aboutrawdog {
}

113
public/style.css.old Normal file
View File

@ -0,0 +1,113 @@
/* Default stylesheet for rawdog. Customise this as you like.
Adam Sampson <ats@offog.org> */
.xmlbutton {
/* From Dylan Greene's suggestion:
http://www.dylangreene.com/blog.asp?blogID=91 */
border: 1px solid;
border-color: #FC9 #630 #330 #F96;
padding: 0 3px;
font: bold 10px sans-serif;
color: #FFF;
background: #F60;
text-decoration: none;
margin: 0;
}
/* Scale down large images in feeds */
img {
max-width: 100%;
height: auto;
}
html {
margin: 0;
padding: 0;
}
body {
color: black;
background-color: white;
margin: 0;
padding: 10px;
font-size: medium;
}
#header {
background-color: #ffe;
border: 1px solid gray;
padding: 10px;
margin-bottom: 20px;
}
h1 {
font-weight: bold;
font-size: xx-large;
text-align: left;
margin: 0;
padding: 0;
}
#items {
}
.day {
clear: both;
}
h2 {
font-weight: bold;
font-size: x-large;
text-align: left;
margin: 10px 0;
padding: 0;
}
.time {
clear: both;
}
h3 {
font-weight: bold;
font-size: large;
text-align: left;
margin: 10px 0;
padding: 0;
}
.item {
margin: 20px 30px;
border: 1px solid gray;
clear: both;
}
.itemheader {
padding: 6px;
margin: 0;
background-color: #eee;
}
.itemtitle {
font-weight: bold;
}
.itemfrom {
font-style: italic;
}
.itemdescription {
border-top: 1px solid gray;
margin: 0;
padding: 6px;
}
#feedstatsheader {
}
#feedstats {
}
#feeds {
margin: 10px 0;
border: 1px solid gray;
border-spacing: 0;
}
#feedsheader TH {
background-color: #eee;
border-bottom: 1px solid gray;
padding: 5px;
margin: 0;
}
.feedsrow TD {
padding: 5px 10px;
margin: 0;
}
#footer {
background-color: #ffe;
border: 1px solid gray;
margin-top: 20px;
padding: 10px;
}
#aboutrawdog {
}

127
public/style.css.yeupou Normal file
View File

@ -0,0 +1,127 @@
/* PAGE */
html {
margin: 0;
padding: 0.5em;
}
body {
color: black;
background-color: white;
margin: 0;
padding: 10px;
font-size: smaller;
}
a {
color: #315e9c;
}
#footer {
clear: both;
background-color: #faf8cf;
border: 1px solid gray;
text-align: center;
padding-left: 2em;
margin-top: 20px;
}
/* ITEMS */
.item {
counter-increment: item;
margin-left: 0;
margin-right: 1%;
margin-bottom: 1em;
width: 32%;
float: left;
}
.itemhead {
font-weight: bold;
background-color: #dcecff;
padding: 0;
border: thin dashed #C2D4E9;
border-bottom: 0;
border-radius: 1em 1em 0 0;
-moz-border-radius: 1em 1em 0 0;
-khtml-border-radius: 1em 1em 0 0;
-webkit-border-radius: 1em 1em 0 0;
}
.itemhead a {
text-shadow: 1px 1px 1px #949494;
display: block;
padding-left: 0.6em;
padding-right: 0.6em;
border-radius: 1em 1em 0 0;
-moz-border-radius: 1em 1em 0 0;
-khtml-border-radius: 1em 1em 0 0;
-webkit-border-radius: 1em 1em 0 0;
}
.itemhead a:hover {
text-decoration: none;
}
.itemhead a:before {
content: counter(item) ". ";
}
.iteminfo {
font-size: xx-small;
background-color: #cbdef5;
padding-left: 2em;
color: #6A6A6A;
border: thin dashed #C2D4E9;
border-top: 0;
border-radius: 0 0 0 1em;
-moz-border-radius: 0 0 0 1em;
-khtml-border-radius: 0 0 0 1em;
-webkit-border-radius: 0 0 0 1em;
}
/* ITEMS PER GROUP */
/* judiciaire */
.itemjudiciaire a { color: white; }
.itemheadjudiciaire a { text-shadow: 1px 1px 1px #6A6A6A; }
.itemheadjudiciaire { border-color: #a86868; background-color: #dd7979; }
.itemheadjudiciaire a:hover { background-color: #C26264;}
.iteminfojudiciaire { border-color: #a86868; background-color: #efa9a9; }
/* sciences */
.itemsciences { border-color: #68964a; }
.itemsciences a { color: #374a2c; }
.itemheadsciences { border-color: #68964a; background-color: #b7ff8c; }
.itemheadsciences a:hover { background-color: #CDFFAD; }
.iteminfosciences { border-color: #68964a; background-color: #8cbb6e; }
/* civitas */
.itemcivitas { border-color: #65a795; }
.itemcivitas a { color: #056c50; }
.itemheadcivitas { border-color: #65a795; background-color: #b2ffe8; }
.itemheadcivitas a:hover { background-color: #CAFFF0; }
.iteminfocivitas { border-color: #65a795; background-color: #8db6ab; }
/* geek */
.itemgeek { border-color: #e0714a; }
.itemgeek a { color: #e0714a; }
.itemheadgeek a { text-shadow: 1px 1px 1px #6A6A6A; }
.itemheadgeek { border-color: #e0714a; background-color: #363636; }
.itemheadgeek a:hover { background-color: #4D4D4D; }
.iteminfogeek { border-color: #e0714a; background-color: #212121; }
/* audiovisuel */
.itemaudiovisuel { border-color: #7660a8; }
.itemaudiovisuel a { color: #4e3683; }
.itemheadaudiovisuel { border-color: #7660a8; background-color: #a881ff; }
.itemheadaudiovisuel a:hover { background-color: #C1AAFF; }
.iteminfoaudiovisuel { border-color: #7660a8; background-color: #8a7bac; }
/* lecture */
.itemlecture { border-color: #b49880; }
.itemlecture a { color: #403e38; }
.itemheadlecture { border-color: #78868B; background-color: #C1D7DE; }
.itemheadlecture a:hover { background-color: #CFE6EA; }
.iteminfolecture { border-color: #78868B; background-color: #B1C5CC; }
/* absurde */
.itemabsurde a { color: #403e38; }
.itemheadabsurde { border-color: #A8B17B; background-color: #f1ffb1; }
.itemheadabsurde a:hover { background-color: #F7FFCD; }
.iteminfoabsurde { border-color: #A8B17B; background-color: #e3d7a7; }

7
rawdog.service Normal file
View File

@ -0,0 +1,7 @@
[Unit]
Description=Rawdog
[Service]
Type=simple
User=od
ExecStart=/usr/bin/rawdog -d /home/od/.rawdog -uw

10
rawdog.timer Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Runs rawdog every hour
[Timer]
OnCalendar=hourly
Persistent=True
Unit=rawdog.service
[Install]
WantedBy=multi-user.target

3
rawdog/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.pyc
state
state.lock

299
rawdog/config Normal file
View File

@ -0,0 +1,299 @@
# Sample rawdog config file. Copy this into your ~/.rawdog/ directory, and edit
# it to suit your preferences.
# All paths in this file should be either absolute, or relative to your .rawdog
# directory.
# If you want to include another config file, then use "include FILENAME".
# Times in this file are specified as a value and a unit (for instance,
# "4h"). Units available are "s" (seconds), "m" (minutes), "h" (hours),
# "d" (days) and "w" (weeks). If no unit is specified, rawdog will
# assume minutes.
# Boolean (yes/no) values in this file are specified as "true" or "false".
# rawdog can be extended using plugin modules written in Python. This
# option specifies the directories to search for plugins to load. If a
# directory does not exist or cannot be read, it will be ignored. This
# option must appear before any options that are implemented by plugins.
plugindirs plugins
# Whether to split rawdog's state amongst multiple files.
# If this is turned on, rawdog will use significantly less memory, but
# will do more disk IO -- probably a good idea if you read a lot of
# feeds.
splitstate false
# The maximum number of articles to show on the generated page.
# Set this to 0 for no limit.
maxarticles 20
# The maximum age of articles to show on the generated page.
# Set this to 0 for no limit.
maxage 0
# The age after which articles will be discarded if they do not appear
# in a feed. Set this to a larger value if you want your rawdog output
# to cover more than a day's worth of articles.
expireage 1d
# The minimum number of articles from each feed to keep around in the history.
# Set this to 0 to only keep articles that were returned the last time the feed
# was fetched. (If this is set to 0, or "currentonly" below is set to true,
# then rawdog will not send the RFC3229+feed "A-IM: feed" header when making
# HTTP requests, since it can't tell from the response to such a request
# whether any articles have been removed from the feed; this makes rawdog
# slightly less bandwidth-efficient.)
keepmin 20
# Whether to only display articles that are currently included in a feed
# (useful for "planet" pages where you only want to display the current
# articles from several feeds). If this is false, rawdog will keep a
# history of older articles.
currentonly false
# Whether to divide the articles up by day, writing a "dayformat" heading
# before each set.
daysections true
# The format to write day headings in. See "man strftime" for more
# information; for example:
# %A, %d %B Wednesday, 21 January
# %Y-%m-%d 2004-01-21 (ISO 8601 format)
dayformat %A, %d %B
# Whether to divide the articles up by time, writing a "timeformat" heading
# before each set.
timesections true
# The format to write time headings in. For example:
# %H:%M 18:07 (ISO 8601 format)
# %I:%M %p 06:07 PM
timeformat %H:%M
# The format to display feed update and article times in. For example:
# %H:%M, %A, %d %B 18:07, Wednesday, 21 January
# %Y-%m-%d %H:%M 2004-01-21 18:07 (ISO 8601 format)
datetimeformat %H:%M, %A, %d %B
# The page template file to use, or "default" to use the built-in template
# (which is probably sufficient for most users). Use "rawdog -s page" to show
# the template currently in use as a starting-point for customisation.
# The following strings will be replaced in the output:
# __version__ The rawdog version in use
# __refresh__ The HTML 4 <meta http-equiv="refresh" ...> header
# __items__ The aggregated items
# __num_items__ The number of items on the page
# __feeds__ The feed list
# __num_feeds__ The number of feeds listed
# You can define additional strings using "define" in this config file; for
# example, if you say "define myname Adam Sampson", then "__myname__" will be
# replaced by "Adam Sampson" in the output.
pagetemplate template.bl4n
# Similarly, the template used for each item shown. Use "rawdog -s item" to
# show the template currently in use as a starting-point for customisation.
# The following strings will be replaced in the output:
# __title__ The item title (as an HTML link, if possible)
# __title_no_link__ The item title (as text)
# __url__ The item's URL, or the empty string if it doesn't
# have one
# __guid__ The item's GUID, or the empty string if it doesn't
# have one
# __description__ The item's descriptive text, or the empty string
# if it doesn't have a description
# __date__ The item's date as provided by the feed
# __added__ The date the article was received by rawdog
# __hash__ A hash of the article (useful for summary pages)
#
# All of the __feed_X__ strings from feeditemtemplate below will also be
# expanded here, for the feed that the article came from.
#
# You can define additional strings on a per-feed basis by using the
# "define_X" feed option; see the description of "feed" below for more
# details.
#
# Simple conditional expansion is possible by saying something like
# "__if_items__ hello __endif__"; the text between the if and endif will
# only be included if __items__ would expand to something other than
# the empty string. Ifs can be nested, and __else__ is supported.
# (This also works for the other templates, but it's most useful here.)
itemtemplate item.bl4n
# The template used to generate the feed list (__feeds__ above). Use "rawdog
# -s feedlist" to show the current template.
# The following strings will be replaced in the output:
# __feeditems__ The feed items
feedlisttemplate default
# The template used to generate each item in the feed list. Use "rawdog
# -s feeditem" to show the current template.
# The following strings will be replaced in the output:
# __feed_id__ The feed's title with non-alphanumeric characters
# (and HTML markup) removed (useful for per-feed
# styles); you can use the "id" feed option below to
# set a custom ID if you prefer
# __feed_hash__ A hash of the feed URL (useful for per-feed styles)
# __feed_title__ The feed title (as an HTML link, if possible)
# __feed_title_no_link__
# The feed title (as text)
# __feed_url__ The feed URL
# __feed_icon__ An "XML button" linking to the feed URL
# __feed_last_update__
# The time when the feed was last updated
# __feed_next_update__
# The time when the feed will next need updating
feeditemtemplate default
# Where to write the output HTML to. You should place style.css in the same
# directory. Specify this as "-" to write the HTML to stdout.
# (You will probably want to make this an absolute path, else rawdog will write
# to a file in your ~/.rawdog directory.)
outputfile /srv/http/ogre/veille/index.html
#outputfile /home/you/public_html/rawdog.html
# Whether to use a <meta http-equiv="Refresh" ...> tag in the generated
# HTML to indicate that the page should be refreshed automatically. If
# this is turned on, then the page will refresh every N minutes, where N
# is the shortest feed period value specified below.
# (This works by controlling whether the default template includes
# __refresh__; if you use a custom template, __refresh__ is always
# available.)
userefresh true
# Whether to show the list of active feeds in the generated HTML.
# (This works by controlling whether the default template includes
# __feeds__; if you use a custom template, __feeds__ is always
# available.)
showfeeds true
# The number of concurrent threads that rawdog will use when fetching
# feeds -- i.e. the number of feeds that rawdog will attempt to fetch at
# the same time. If you have a lot of feeds, setting this to be 20 or
# so will significantly speed up updates. If this is set to 1 (or
# fewer), rawdog will not start any additional threads at all.
numthreads 1
# The time that rawdog will wait before considering a feed unreachable
# when trying to connect. If you're getting lots of timeout errors and
# are on a slow connection, increase this.
# (Unlike other times in this file, this will be assumed to be in
# seconds if no unit is specified.)
timeout 30s
# Whether to ignore timeouts. If this is false, timeouts will be reported as
# errors; if this is true, rawdog will silently ignore them.
ignoretimeouts false
# Whether to show Python traceback messages. If this is true, rawdog will show
# a traceback message if an exception is thrown while fetching a feed; this is
# mostly useful for debugging rawdog or feedparser.
showtracebacks false
# Whether to display verbose status messages saying what rawdog's doing
# while it runs. Specifying -v or --verbose on the command line is
# equivalent to saying "verbose true" here.
verbose false
# Whether to attempt to fix bits of HTML that should start with a
# block-level element (such as article descriptions) by prepending "<p>"
# if they don't already start with a block-level element.
blocklevelhtml true
# Whether to attempt to turn feed-provided HTML into valid HTML.
# The most common problem that this solves is a non-closed element in an
# article causing formatting problems for the rest of the page.
# For this option to have any effect, you need to have PyTidyLib or mx.Tidy
# installed.
tidyhtml true
# Whether the articles displayed should be sorted first by the date
# provided in the feed (useful for "planet" pages, where you're
# displaying several feeds and want new articles to appear in the right
# chronological place). If this is false, then articles will first be
# sorted by the time that rawdog first saw them.
sortbyfeeddate true
# Whether to consider articles' unique IDs or GUIDs when updating rawdog's
# database. If you turn this off, then rawdog will create a new article in its
# database when it sees an updated version of an existing article in a feed.
# You probably want this turned on.
useids true
# The fields to use when detecting duplicate articles: "id" is the article's
# unique ID or GUID; "link" is the article's link. rawdog will find the first
# one of these that's present in the article, and ignore the article if it's
# seen an article before (in any feed) that had the same value. For example,
# specifying "hideduplicates id link" will first look for id/guid, then for
# link.
# Note that some feeds use the same link for all their articles; if you specify
# "link" here, you will probably want to specify the "allowduplicates" feed
# argument (see below) for those feeds.
hideduplicates id
# The period to use for new feeds added to the config file via the -a|--add
# option.
newfeedperiod 3h
# Whether rawdog should automatically update this config file (and its
# internal state) if feed URLs change (for instance, if a feed URL
# results in a permanent HTTP redirect). If this is false, then rawdog
# will ask you to make the necessary change by hand.
changeconfig true
# The feeds you want to watch, in the format "feed period url [args]".
# The period is the minimum time between updates; if less than period
# minutes have passed, "rawdog update" will skip that feed. Specifying
# a period less than 30 minutes is considered to be bad manners; it is
# suggested that you make the period as long as possible.
# Arguments are optional, and can be given in two ways: either on the end of
# the "feed" line in the form "key=value", separated by spaces, or as extra
# indented lines after the feed line.
# possible arguments are:
# id Value for the __feed_id__ value in the item
# template for items in this feed (defaults to the
# feed title with non-alphanumeric characters and
# HTML markup removed)
# user User for HTTP basic authentication
# password Password for HTTP basic authentication
# format "text" to indicate that the descriptions in this feed
# are unescaped plain text (rather than the usual HTML),
# and should be escaped and wrapped in a <pre> element
# X_proxy Proxy URL for protocol X (for instance, "http_proxy")
# proxyuser User for proxy basic authentication
# proxypassword Password for proxy basic authentication
# allowduplicates "true" to disable duplicate detection for this feed
# maxage Override the global "maxage" value for this feed
# keepmin Override the global "keepmin" value for this feed
# define_X Equivalent to "define X ..." for item templates
# when displaying items from this feed
# You can provide a default set of arguments for all feeds using
# "feeddefaults". You can specify as many feeds as you like.
# (These examples have been commented out; remove the leading "#" on each line
# to use them.)
feeddefaults
killtags true
truncate 120
# http_proxy http://proxy.example.com:3128/
#feed 1h http://example.com/feed.rss
#feed 30m http://example.com/feed2.rss id=newsfront
#feed 3h http://example.com/feed3.rss keepmin=5
#feed 3h http://example.com/secret.rss user=bob password=secret
#feed 3h http://example.com/broken.rss
# format text
# define_myclass broken
#feed 3h http://proxyfeed.example.com/proxied.rss http_proxy=http://localhost:1234/
#feed 3h http://dupsfeed.example.com/duplicated.rss allowduplicates=true
# Wallabag
feed 3h https://github.com/wallabag/wallabag/releases.atom
# Dokuwiki
feed 3h https://github.com/splitbrain/dokuwiki/releases.atom
# ArchLinux
feed 3h https://archlinux.org/feeds/news/
# rawdog
feed 3h http://offog.org/git/rawdog.atom
# SabreDaV
feed 3h https://github.com/sabre-io/dav/releases.atom
# Shaarli
feed 3h https://github.com/shaarli/Shaarli/releases.atom
# Hugo
feed 3h https://github.com/gohugoio/hugo/releases.atom

16
rawdog/item.bl4n Normal file
View File

@ -0,0 +1,16 @@
<article class="message is-primary" id="item__hash__">
<div class="message-header feed-__feed_hash__ feed-__feed_id__">
<p><span class="tag is-dark">__feed_title__</span> __title__</p>
<p>
__if_author__
par __author____endif__
__if_date__
à __date____endif__
</p>
</div>
__if_description__
<div class="message-body">
__description__
</div>__endif__
</article>
<div>&nbsp;</div>

15
rawdog/item.dec23 Normal file
View File

@ -0,0 +1,15 @@
<!-- PAGE-BEGIN-ITEM -->
<div class="item" id="item__hash__">
<div class="itemheader feed-__feed_hash__ feed-__feed_id__">
<h4 class="itemtitle">__title__</h4>
<p class="itembyline">
__if_author__by __author____endif__
in __feed_title__
__if_date__at __date____endif__
</div>
__if_description__<div class="itemdescription">
__description__
</div>__endif__
</div>
<!-- PAGE-END-ITEM -->

View File

@ -0,0 +1,47 @@
# rawdog plugin to truncate article descriptions to N characters.
# Copyright 2006, 2013 Adam Sampson <ats@offog.org>
#
# To use this, give the feed you want to truncate a "truncate" argument:
# feed 30m http://offog.org/books/feed.rss
# truncate 40
#
# To truncate all articles, make that a default option for all feeds:
# feeddefaults
# truncate 40
#
# You can also remove all HTML tags from the descriptions before truncating
# them, which'll make the formatting a bit nicer if you're aiming for very
# short descriptions:
# killtags true
import rawdoglib.plugins, re
def article_seen(rawdog, config, article, ignore):
fargs = rawdog.feeds[article.feed].args
n = int(fargs.get("truncate", "0"))
killtags = fargs.get("killtags", False) == "true"
def process(detail, n):
v = detail["value"]
if killtags:
v = re.sub(r'<[^>]*>', ' ', v)
if n != 0 and len(v) > n:
# Don't break a tag in half.
l = v.rfind("<", 0, n)
r = v.rfind(">", 0, n)
if l != -1 and r < l:
n = l
v = v[:n].rstrip() + "..."
detail["value"] = v.strip()
ei = article.entry_info
if "content" in ei:
for detail in ei["content"]:
process(detail, n)
if "summary_detail" in ei:
process(ei["summary_detail"], n)
return True
rawdoglib.plugins.attach_hook("article_seen", article_seen)

45
rawdog/template.bl4n Normal file
View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta name="generator" content="rawdog __version__" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Papa Ogre veille au grain</title>
<link rel="stylesheet" href="bulma.min.css">
<style>
.items .day h2 {
font-weight: bold;
font-size: 150%;
}
</style>
</head>
<body>
<div class="container">
<section class="hero is-primary">
<div class="hero-body">
<div class="container">
<h1 class="title">
Papa Ogre veille au grain&nbsp
</h1>
<h2 class="subtitle">
__num_items__ items from __num_feeds__ feeds
</h2>
</div>
</div>
</section>
<section class="pagination">
__paged_output_pages__
</section>
<section class="section items">
__items__
</section>
<section class="pagination">
__paged_output_pages__
</section>
</div>
</body>
</html>

25
rawdog/template.dec23 Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="style-dec23.css" type="text/css">
<title>Papa Ogre veille au grain</title>
</head>
<body id="rawdog">
<div id="page">
<div id="header">
<h1>rawdog __version__: __num_items__ items from __num_feeds__ feeds</h1>
</div>
<div class="pages">
__paged_output_pages__
</div>
<div id="items">
__items__
</div>
<div class="pages">
__paged_output_pages__
</div>
</div>
</body>
</html>