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