Commit Graph

97 Commits

Author SHA1 Message Date
evazion
b551e3634f Fix misc rubocop warnings. 2020-06-16 21:36:15 -05:00
evazion
206ac7dd9a dtext#from_html: convert basic links to <url> syntax.
Convert

    <a href="https://www.example.com">https://www.example.com</a>

to

    <https://www.example.com>

instead of

    "https://www.example.com":[https://www.example.com]
2020-05-29 15:36:21 -05:00
evazion
e3187e0bd0 tags: add general?, character?, copyright?, artist?, meta?, empty? helper methods. 2020-05-10 23:56:50 -05:00
evazion
49383d393a BURs: rename AliasAndImplicationImporter to BulkUpdateRequestProcessor.
The name AliasAndImplicationImporter is a holdover from the time before
bulk update requests existed. This was a bad name because it doesn't do
any actual importing, instead it's used for parsing and executing bulk
update requests.
2020-05-10 22:18:47 -05:00
evazion
c1f7b76bdb dtext: refactor parsing of embedded BUR pseudo tags. 2020-02-22 01:37:12 -06:00
evazion
815703a922 views: adjust more <meta> descriptions.
* Add <meta> descriptions to more pages.
* Adjust wiki/pool/forum pages to use an excerpt of the first paragraph.
2020-01-26 19:16:38 -06:00
evazion
e72c10bc23 dtext: don't link non-artist tags to artist entries.
* Don't link non-artist tags to artist pages, even when the tag has an
  artist entry. These artist entries are usually old deleted entries
  that happen to have the same name as a gentag, or leftover entries
  that need to be deleted.

* URL escape the artist name in /artists/show_or_new?name={name}
2020-01-08 12:33:55 -06:00
BrokenEagle
642e121ad9 Have artist wiki links go to artist page 2020-01-07 05:21:29 +00:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
evazion
06d0ceb016 dmails: fix bug with parsing wiki links in email notifications.
Bug: sending a dmail containing a wiki link (ex: [[tagme]]) failed when
the recipient had email notifications turned on.

Cause: wiki links inside email notifications use absolute urls, which
the dtext postprocessor didn't parse correctly.
2019-11-05 19:10:41 -06:00
evazion
953de62d70 Update dtext gem. 2019-10-31 22:23:50 -05:00
evazion
4bb1bdbe10 dtext: handle [bur:<id>] tags in main parser.
Move the parsing for the [bur:<id>], [ta:<id>], [ti:<id>] pseudo tags to
the main parser in `DText.format_text`. This fixes a bug where wiki
links inside bulk update requests on the forum weren't properly
colorized because the text of the BUR was embedded after we scanned for
wiki links, not before.

This also ensures that tags inside bulk update requests will be recorded
in the dtext_links table, meaning that forum posts can be properly
searched by tags.

This incidentally means that these request pseudo tags can now be used
outside the forum.
2019-10-28 16:40:38 -05:00
evazion
9f0ecf7247 dtext links: add table for tracking links between wikis.
Add a dtext_links table for tracking links between wiki pages. This is
to allow for broken link detection and "what links here" searches, among
other uses.
2019-10-23 21:36:48 -05:00
evazion
33f2725ae7 Fix #4112: Colorize tags in DText.
DText is processed in three phases: a preprocessing phase, the regular
parsing phases, and a postprocessing phase.

In the preprocessing phase we extract all the wiki links from all the
dtext messages on the page (more precisely, we do this in forum threads
and on comment pages, because these are the main places with lots of
dtext). This is so we can lookup all the tags and wiki pages in one
query, which is necessary because in the worst case (in certain forum
threads and in certain list_of_* wiki pages) there can be hundreds of
tags per page.

In the postprocessing phase we fixup the html generated by the ragel
parser to add CSS classes to wiki links. We do this in a postprocessing
step because it's easier than doing it in the ragel parser itself.
2019-10-11 18:45:55 -05:00
evazion
3d9c6fef1d related tags: fix wiki page tag extraction.
* Parse the wiki page with the actual dtext parser instead of by hand.
  This is so that wiki links inside things like [nodtext] or [code]
  blocks are handled properly.

* Only include tags that exist and are nonempty. Don't include links to
  dead pages or blank tags.
2019-10-11 16:53:37 -05:00
evazion
08b1c76533 dtext: refactor stripping markup from dtext.
There are a handful of places where we need to strip markup from a piece
of dtext, primarily in <meta> description tags in the wiki. Currently
the dtext parser handles this by having a special mode where it parses
the text but doesn't output html tags. Here we refactor to instead parse
the text normally then strip out the html tags after the fact.

This is more flexible and allows us to simplify a lot of things in the
dtext parser. This also produces more readable output than before in
certain cases.
2019-10-09 16:36:01 -05:00
evazion
04ecca6a06 Fix #3591: DeviantArt commentaries: strip embedded image/text thumbs. 2018-03-31 11:27:14 -05:00
evazion
80219a0ccf commentaries: replace <img> tags with dtext links (#3586)
Replace <img> tags with dtext links, unless the <img> tag is already
inside an <a> tag.

Also strip Unicode spaces from DeviantArt commentaries.
2018-03-30 21:42:51 -05:00
evazion
4c54e18c6d mentions: factor out mention parsing to DText.parse_mentions. 2017-08-04 23:48:31 -05:00
evazion
7cb7c2fbab Remove ruby DText implementation (#3206). 2017-07-19 16:48:42 -05:00
evazion
71f84b10af tumblr: convert commentary to dtext.
* Convert Tumblr commentary to DText.
* Strip extraneous whitespace in links and blockquotes.
* Add newlines after block elements to ensure they're separated from
  subsequent blocks.
2017-07-01 11:15:48 -05:00
evazion
b880b07387 sources: factor out html-to-dtext code to DText.from_html. 2017-07-01 11:15:48 -05:00
evazion
990f173b3d notes: move sanitization from d_text.rb to note_sanitizer.rb. 2017-06-15 22:58:13 -05:00
evazion
c586a66e1f dtext: recognize [QUOTE] tags when quoting comments, forum_posts.
Fixes a bug with capitalized [QUOTE] tags not being handled properly
when quoting comments or forum posts.
2017-04-24 21:15:47 -05:00
evazion
869f1610fc comments: use server-side quote-stripping instead of reimplementing in js. 2017-04-24 21:15:47 -05:00
evazion
18424531fa Merge mentions quote-stripping code into DText quote-stripping code. 2017-04-24 21:15:42 -05:00
evazion
f1552539f7 notes: allow <ruby> tags for marking up furigana. 2017-04-21 14:31:05 -05:00
evazion
46280f2227 mentions: include mentioner in subject line.
The template looks like this:

Subject:

    #{creator_name} mentioned you in a comment on post ##{post_id}

Body:

    @#{creator_name} mentioned you in a \"comment\":/posts/#{post_id}#comment-#{id} on post ##{post_id}:

    [quote]
    #{DText.excerpt(body, "@"+user_name)}
    [/quote]
2017-02-25 23:05:44 -06:00
r888888888
a21640429c add dtext prefix to header id in ruby dtext parser 2016-09-09 16:41:03 -07:00
Type-kun
756881966a Fix dtext.parse_strip failing for nil (closes #2662) 2016-09-08 22:47:42 +05:00
r888888888
d47059d246 fixes #2654: @mentions shouldn't link to Danbooru users in artist commentaries 2016-09-07 16:08:55 -07:00
Type-kun
8c04a9d390 Fix #2598 for old parser 2016-09-06 01:06:29 +05:00
r888888888
5fe163b29f fix parse_strip call 2016-04-27 17:14:06 -07:00
r888888888
7f9261b0cb strip syntax for meta description tag 2016-02-04 14:10:43 -08:00
r888888888
504674b288 add rel=nofollow in more places 2016-02-03 23:47:17 -08:00
r888888888
286c71b342 smarter mention parsing #2466 2015-11-02 12:30:37 -08:00
r888888888
821c7bc2a5 add dmail notices for mentions in forum posts 2015-10-14 15:32:48 -07:00
r888888888
5b04cd632d additional @mention autocomplete fixes 2015-10-01 12:13:28 -07:00
r888888888
cad671c533 add support for at mentions in dtext 2015-09-29 17:43:36 -07:00
Toks
3a66e521fc #1932 disallow css urls 2015-04-21 15:10:14 -04:00
Toks
8ee5902da8 fix #2362
Rather than removing all css now it will remove only css not listed in
the "relaxed" sanitize config.
2015-03-27 21:35:30 -04:00
Toks
e6e6b2fe1c fixes #2095 2014-11-18 15:13:43 -05:00
Toks
fd290076fe fixes #2241 2014-09-24 13:28:56 -04:00
Toks
b22a77d4c5 improve #1678
Remove blank &page= parameter when page isn't specified, and indicate
page in the link's text when it is.
2014-08-01 17:59:59 -04:00
r888888888
2aa9288d52 fixes #1678 2014-06-20 17:36:19 -07:00
r888888888
331377a32b implements #982 2014-06-03 15:23:16 -07:00
r888888888
165e3a4efa fixes #530 2014-02-27 13:41:36 -08:00
Toks
52fd58087d Restyle expandable blocks 2013-12-23 13:22:25 -05:00
r888888888
b618322ac1 Fixes #2042, fix specs 2013-12-03 17:20:03 -08:00
r888888888
327b52c2d3 add performance test for dtext, fixes #2051 2013-12-03 15:50:58 -08:00