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.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<%= link_to(image_tag(comment.post.preview_file_url), post_path(comment.post)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial => "comments/partials/show/comment", :collection => [comment] %>
|
||||
<%= render partial: "comments/partials/show/comment", collection: [comment], locals: { dtext_data: DText.preprocess(@comments.map(&:body)) } %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user