Commit 6a72e7c6 authored by Lysander Trischler's avatar Lysander Trischler

Make subjects & mentions presentation configurable

parent 8ebfed3b
......@@ -318,7 +318,7 @@ the old path in your config.
Flag indicating whether to show or hide read conversation trees. When enabled,
all conversations are always shown. When disabled, conversation trees are
hidden if all twts in the conversation tree are read. Defaults to ``False``.
hidden if all twts in the conversation tree are read. Defaults to ``no``.
See also ``show_unread_missing_conversation_roots`` for more control.
......@@ -334,11 +334,77 @@ them later on, when they become available.
So this flag controls whether to show or hide conversation trees which are
started by such an unread missing root twt, but all other twts in this
conversation tree are read. If enabled, affected conversation trees are shown,
otherwise they're hidden. It defaults to ``False``.
otherwise they're hidden. It defaults to ``no``.
This setting is related to ``show_read_conversations`` but only affects missing
unread conversation roots.
Flag controlling whether `machine-parsable twt subjects
will be shown or hidden. Since they usually don't add a lot of value, they
are hidden by default (``yes``). This setting only affects machine-parsable
subjects, but not human-readable ones. Human readable subjects will always be
.. image:: human-readable-subjects.png
:alt: Human-readable subjects will always be shown.
.. figure:: machine-parsable-subjects-hidden.png
``show_subjects = no`` makes the most use of the available space.
.. figure:: machine-parsable-subjects-folded.png
``show_subjects = yes`` shows the subjects in red by default. It can be
changed with the ``subject-normal`` and ``subject-focus`` settings in the
``[colors]`` section below. See also the ``fold_subjects`` setting to
further customize the appearance..
This flag controls whether machine-readable subjects are folded together to
only present the twt subject hash or shown in full length. It does not effect
human-readable subjects and only makes sense if subjects are shown
(``show_subjects = yes``). It defaults to ``yes`` to waste less precious
.. figure:: machine-parsable-subjects-folded.png
By default, machine-parsable subjects are folded to only show the hash.
.. figure:: machine-parsable-subjects-unfolded.png
When disabled, the complete `twt hash tag
is shown instead.
This flag controls the presentation of mentions inside of twts. When enabled,
only the nick will be shown. Otherwise the complete nick and URL will be
presented. Mentions might be further customized with the ``[nick-colors]``
section down below. This setting defaults to ``yes`` in order to save space.
**Security implication:** At the moment, the downside of enabling this feature
however is, that malicious feeds might trick you into believing that somebody
else was mentioned, since the URL is hidden. This is also the case in lots of
other clients, including the reference implementation I believe.
.. figure:: mentions-folded.png
By default, only the nick is shown. This example shows some custom
configured nick colors.
.. figure:: mentions-unfolded.png
When folding of mentions is disabled, both the nick and URL will be
......@@ -51,9 +51,9 @@ class TwtFormatter:
markup = []
for token in twt.tokens:
if isinstance(token, twtxtparser.SubjectHash):
if show_subjects:
if manager.config.show_subjects:
if fold_subjects:
if manager.config.fold_subjects:
subject = "#%s" % token.hash or token.url
subject = "#<%s %s>" % (token.hash, token.url)
......@@ -75,7 +75,7 @@ class TwtFormatter:
url = None
following = False
if fold_mentions:
if manager.config.fold_mentions:
if nick:
mention = "@%s" % nick
elif url:
......@@ -598,11 +598,6 @@ def debug(s):
show_subjects = False
fold_subjects = True
fold_mentions = True
def generate_header_text():
return "Conversations: %d Missing conversation roots: %d Tweets: %d Read: %d Unread: %d" % (
len(manager.conversation_tree), manager.missing_conversation_root_count,
......@@ -277,6 +277,18 @@ class Config:
def show_unread_missing_conversation_roots(self):
return self._cfg.getboolean("twtxt", "show_unread_missing_conversation_roots", fallback=False)
def show_subjects(self):
return self._cfg.getboolean("twtxt", "show_subjects", fallback=False)
def fold_subjects(self):
return self._cfg.getboolean("twtxt", "fold_subjects", fallback=True)
def fold_mentions(self):
return self._cfg.getboolean("twtxt", "fold_mentions", fallback=True)
def colors(self, name):
return self._cfg.get("colors", name, fallback=None)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment