vihanb / PPCG-Design

A redesign of the PPCG website
codegolf.stackexchange.com
35 stars 14 forks source link

Byte-counter breaks on certain answer #103

Closed ETHproductions closed 7 years ago

ETHproductions commented 7 years ago

See http://codegolf.stackexchange.com/a/100934/42545

The userscript doesn't give the code block any byte counter. Is this because the block contains <DATA>?

JJ-Atkinson commented 7 years ago

Nope, the post is formatted weirdly. Normally the html for the site is <pre><code>{your code}</code></pre>, but in this case, the format is just <pre>{your code}</pre> because the writer used html tags:

...bytes

<pre>
undef$/;print&lt;DATA&gt;
__DATA__

</pre>

Trailing newline....

I don't know if this should be handled because this is rarely done in posts.

The code that causes this is here: https://github.com/vihanb/PPCG-Design/blob/master/ppcg.user.js#L616

function showByteCounts() {
      // ...
      $(this).find("pre code").each(function() {
      // ...
}
ETHproductions commented 7 years ago

Yeah, I don't think this is important enough to require fixing.