You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -412,6 +412,57 @@ Use this when pretty-printing doesn't matter and you'd like to save space.
412
412
You can access this same formatting off an AdvancedHTMLParser.AdvancedHTMLParser (or IndexedAdvancedHTMLParser) by calling .getMiniHTML()
413
413
414
414
415
+
**AdvancedHTMLSlimTagFormatter and AdvancedHTMLSlimTagMiniFormatter**
416
+
417
+
In order to support some less-leniant parsers, AdvancedHTMLParser will by default include a space prior to the close-tag '>' character in HTML output.
418
+
419
+
For example:
420
+
421
+
<span id="abc" >Blah</span>
422
+
423
+
<br />
424
+
425
+
<hr class="bigline" />
426
+
427
+
428
+
It is recommended to keep these extra spaces, but if for some reason you feel you need to get rid of them, you can use either *AdvancedHTMLSlimTagFormatter* or *AdvancedHTMLSlimTagMiniFormatter*.
429
+
430
+
431
+
*AdvancedHTMLSlimTagFormatter* will do pretty-printing (like getFormattedHTML / AdvancedHTMLFormatter.getHTML output)
432
+
433
+
*AdvancedHTMLSlimTagMiniFormatter* will do mini-printing (like getMiniHTML / AdvancedHTMLMiniFormatter.getHTML output)
434
+
435
+
436
+
Feeding in your HTML via formatter.parseStr(htmlStr) [where htmlStr can be parser.getHTML()] will cause it to be output without the start-tag padding.
437
+
438
+
For example:
439
+
440
+
<span id="abc">Blah</span>
441
+
442
+
By default, self-closing tags will retain their padding so that an xhtml-compliant parser doesn't treat "/" as either an attribute or part of the attribute-value of the preceding attribute.
443
+
444
+
For example:
445
+
446
+
<hr class="bigline"/>
447
+
448
+
Could be interpreted as a horizontal rule with a class name of "bigline/". Most modern browsers work around this and will not have issue, but some parsers will.
449
+
450
+
You may pass an optional keyword-argument to the formatter constructor, slimSelfClosing=True, in order to force removal of this padding from self-closing tags.
Copy file name to clipboardExpand all lines: README.rst
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -430,6 +430,57 @@ Use this when pretty-printing doesn't matter and you'd like to save space.
430
430
You can access this same formatting off an AdvancedHTMLParser.AdvancedHTMLParser (or IndexedAdvancedHTMLParser) by calling .getMiniHTML()
431
431
432
432
433
+
**AdvancedHTMLSlimTagFormatter and AdvancedHTMLSlimTagMiniFormatter**
434
+
435
+
In order to support some less-leniant parsers, AdvancedHTMLParser will by default include a space prior to the close-tag '>' character in HTML output.
436
+
437
+
For example:
438
+
439
+
<span id="abc" >Blah</span>
440
+
441
+
<br />
442
+
443
+
<hr class="bigline" />
444
+
445
+
446
+
It is recommended to keep these extra spaces, but if for some reason you feel you need to get rid of them, you can use either *AdvancedHTMLSlimTagFormatter* or *AdvancedHTMLSlimTagMiniFormatter*.
447
+
448
+
449
+
*AdvancedHTMLSlimTagFormatter* will do pretty-printing (like getFormattedHTML / AdvancedHTMLFormatter.getHTML output)
450
+
451
+
*AdvancedHTMLSlimTagMiniFormatter* will do mini-printing (like getMiniHTML / AdvancedHTMLMiniFormatter.getHTML output)
452
+
453
+
454
+
Feeding in your HTML via formatter.parseStr(htmlStr) [where htmlStr can be parser.getHTML()] will cause it to be output without the start-tag padding.
455
+
456
+
For example:
457
+
458
+
<span id="abc">Blah</span>
459
+
460
+
By default, self-closing tags will retain their padding so that an xhtml-compliant parser doesn't treat "/" as either an attribute or part of the attribute-value of the preceding attribute.
461
+
462
+
For example:
463
+
464
+
<hr class="bigline"/>
465
+
466
+
Could be interpreted as a horizontal rule with a class name of "bigline/". Most modern browsers work around this and will not have issue, but some parsers will.
467
+
468
+
You may pass an optional keyword-argument to the formatter constructor, slimSelfClosing=True, in order to force removal of this padding from self-closing tags.
0 commit comments