forked from mirrors/bookwyrm
Format html on book descriptions
This commit is contained in:
parent
646df03d81
commit
7f1ac33859
2 changed files with 6 additions and 8 deletions
|
@ -221,8 +221,6 @@ def handle_status(user, form):
|
|||
matches = []
|
||||
for match in re.finditer(regex.username, status.content):
|
||||
username = match.group().strip().split('@')[1:]
|
||||
print(match.group())
|
||||
print(len(username))
|
||||
if len(username) == 1:
|
||||
# this looks like a local user (@user), fill in the domain
|
||||
username.append(DOMAIN)
|
||||
|
@ -251,9 +249,9 @@ def handle_status(user, form):
|
|||
r'<a href="%s">%s</a>\g<1>' % (url, username),
|
||||
content)
|
||||
if not isinstance(status, models.GeneratedNote):
|
||||
status.content = to_markown(content)
|
||||
status.content = to_markdown(content)
|
||||
if hasattr(status, 'quote'):
|
||||
status.quote = to_markown(status.quote)
|
||||
status.quote = to_markdown(status.quote)
|
||||
status.save()
|
||||
|
||||
# notify reply parent or tagged users
|
||||
|
@ -272,7 +270,7 @@ def handle_status(user, form):
|
|||
broadcast(user, remote_activity, software='other')
|
||||
|
||||
|
||||
def to_markown(content):
|
||||
def to_markdown(content):
|
||||
''' catch links and convert to markdown '''
|
||||
content = re.sub(
|
||||
r'([^(href=")])(https?:\/\/([A-Za-z\.\-_\/]+' \
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
{% if trimmed != full %}
|
||||
<div>
|
||||
<input type="radio" name="show-hide-{{ uuid }}" id="show-{{ uuid }}" class="toggle-control" checked>
|
||||
<blockquote class="content toggle-content hidden">{{ trimmed }}
|
||||
<blockquote class="content toggle-content hidden">{{ trimmed | safe }}
|
||||
<label class="button is-small" for="hide-{{ uuid }}"><div role="button" tabindex="0">show more</div></label>
|
||||
</blockquote>
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" name="show-hide-{{ uuid }}" id="hide-{{ uuid }}" class="toggle-control">
|
||||
<blockquote class="content toggle-content hidden">{{ full }}
|
||||
<blockquote class="content toggle-content hidden">{{ full | safe }}
|
||||
<label class="button is-small" for="show-{{ uuid }}"><div role="button" tabindex="0">show less</div></label>
|
||||
</blockquote>
|
||||
</div>
|
||||
{% else %}
|
||||
<blockquote class="content">{{ full }}</blockquote>
|
||||
<blockquote class="content">{{ full | safe }}</blockquote>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
|
|
Loading…
Reference in a new issue