Duga icon indicating copy to clipboard operation
Duga copied to clipboard

Ignore "possible answer invalidation" on block-quoted code blocks

Open Phrancis opened this issue 8 years ago • 5 comments

Here is an example of where this was posted to chat:

http://chat.stackexchange.com/transcript/message/25582457#25582457

Here is a screenshot of the edit history that triggered this:

screen shot 2015-11-20 at 11 05 53 pm

An improvement to this feature would be to ignore edits to code blocks which begins with the > characters, and then 5 spaces: >

This would reduce the number of false-positives posted for others to review.

Phrancis avatar Nov 21 '15 04:11 Phrancis

It would reduce the number of false-positives. Wouldn't it also reduce the number of correct positives?

ShipsWithCannons avatar Nov 21 '15 09:11 ShipsWithCannons

meh.. usually quoted code-blocks aren't relevant to the question or only considered supplementary context for the code under review. e.g example usage.

I'd say this is a good idea

Vogel612 avatar Nov 21 '15 16:11 Vogel612

It's actually ">" and 5 spaces, not 4 :-)

Sent from my Samsung device

retailcoder avatar Nov 21 '15 17:11 retailcoder

@retailcoder I updated the original request thx for pointing out the 5 vs 4 spaces :+1:

Phrancis avatar Nov 21 '15 17:11 Phrancis

Looks like Duga is actually designed to parse the rendered HTML, rather than the mark-up source, so the number of spaces or > would be irrelevant. See source code.

This means that...

<blockquote><code>
QUOTED CODE HERE
</code></blockquote>

...would need to be stripped by the stripNonCode(String post) method, although SE renders it with a bit more HTML complexity in the edits review, for example from above edit history (select View Source)

<blockquote><span class="diff-delete">
</span><pre><code><span class="diff-delete">java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

Pattern match succeeded
</span></code></pre><span class="diff-delete">
</span></blockquote>

So perhaps instead just making it to where anything between <blockquote></blockquote> tags is stripped, regardless if it has a <code></code> child present or not.

Phrancis avatar Nov 21 '15 18:11 Phrancis