Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: BUG: code blocks don't retain literal formatting -- could they?

by $h4X4_|=73}{ (Monk)
on Sep 17, 2016 at 12:05 UTC ( [id://1171996]=note: print w/replies, xml ) Need Help??


in reply to Re: BUG: code blocks don't retain literal formatting -- could they?
in thread BUG: code blocks don't retain literal formatting -- could they?

The reason why things are the way they are, is to allow code like this:

sub amp { ... } my $coderef = \&
Unfortunately, your request would render that as:
sub amp { ... } my $coderef = \&


This bug is caused by not encoding the semicolon and ampersand of the HTML entity. The encoding of the ampersand and semicolon must be done in the same code to not confuse from a past converted HTML entity and must be the first HTML filter.
Any filter for HTML code that does not encode ampersand and semicolon will have this problem.

This problem was addressed in a past version of my module AUBBC v4.01 - 11/08/2010
New version located at AUBBC2

The fix I use now looks like this.
s[(&|;)][$1 eq '&' ? '&' : '&#59;']gex;

Update: spelling

Update: My bad! Because PerlMonks mixes the HTML entity's with HTML names, will always cause a problem somewhere and no one filter will work in every case. You have to type the HTML name or your S.O.L..
Hay, welcome to PerlMonks. The place where you need to learn HTML before you can post your Perl question. ッ

Replies are listed 'Best First'.
Re^3: BUG: code blocks don't retain literal formatting -- could they?
by choroba (Cardinal) on Sep 17, 2016 at 19:55 UTC
    > The place where you need to learn HTML before you can post your Perl question

    Yeah, because knowing HTML is something absolutely pointless, while the knowledge of Markdown, or at least one of its dialects used at StackOveflow, is something most employers need badly.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
      If PM were going to implement an alternate "mark up", I would think the natural choice would be POD (since PM is about Perl).
Re^3: BUG: code blocks don't retain literal formatting -- could they?
by Your Mother (Archbishop) on Sep 17, 2016 at 16:54 UTC

    Why would mixing HTML named entities, hex, numeric, and whatever is a legal char in the document’s charset cause any problems?

Re^3: BUG: code blocks don't retain literal formatting -- could they?
by RonW (Parson) on Sep 20, 2016 at 19:28 UTC
    Hay, welcome to PerlMonks. The place where you need to learn HTML before you can post your Perl question.

    PM is not the only (still existing) website that uses HTML for posting. See http://slashdot.org for example.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1171996]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-28 22:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found