问题
I like to improve readability and managing some HTML source code like this
<iframe src= "https://www.google.com/recaptcha/api2/anchor?k=6LeaOiITAAAAAF_A-e9qjM6TCgdt4-rqixnkkatL &co=aHR0cDovL3BsYXkuc3BvdGlmeS5jb20 &hl=de&v=r20160802154045&theme=dark&size=normal&cb=ap65yyq41qhy" title="reCAPTCHA-Widget" ...
I mean line breaking attribut names is the first step:
<iframe src= "https://www.google.com/recaptcha/api2/anchor?k=6LeaOiITAAAAAF_A-e9qjM6TCgdt4-rqixnkkatL &co=aHR0cDovL3BsYXkuc3BvdGlmeS5jb20 &hl=de&v=r20160802154045&theme=dark&size=normal&cb=ap65yyq41qhy"
title="reCAPTCHA-Widget"
However is there a way of breaking down that long URL that i'll look somehow like this:
"https://www.google.com/recaptcha/api2/anchor" +
"?k=6LeaOiITAAAAAF_A-e9qjM6TCgdt4-rqixnkkatL" +
"&co=aHR0cDovL3BsYXkuc3BvdGlmeS5jb20" +
...
"&size=normal" +
"&cb=ap65yyq41qhy"
回答1:
That's it:
<iframe
src = "
https://www.google.com/recaptcha/api2/anchor
? k = 6LeaOiITAAAAAF_A-e9qjM6TCgdt4-rqixnkkatL
& co = aHR0cDovL3BsYXkuc3BvdGlmeS5jb20
& hl = de
& v = r20160802154045
& theme = dark
& size = normal
& cb = ap65yyq41qhy
"
></iframe>
Well the secret ingredient here is to use solidly tab's instead of space when you are inside some string! The parser will filter them out and you get some working url.
来源:https://stackoverflow.com/questions/38874711/adding-a-linebreak-in-some-attribute-stringlike-src-or-href-in-html-xml-sou