Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#3979 closed defect (wontfix)

can not include external html

Reported by: jholg Owned by: Noah Kantrowitz
Priority: normal Component: IncludeMacro
Severity: normal Keywords: xhtml, xhtml-strict
Cc: Trac Release: 0.11


Whilst logged in with INCLUDE_URL permission I am not able to include valid html. I'm currently looking into adding intertrac capabilities to includemacro and started out with simply trying to include stuff from other trac projects via a fully qualified URL. However, these are always empty. By accident, I used NewsFlashMacro on one of these pages, and suddenly this page could be successfully included.

I found out that using NewsFlashMacro with the

and [NewsFlashEnd]] directives subtly breaks invalid xhtml-1.0-strict (should add another bug report over there...):

Validation Output: 49 Errors

  1. Error Line 87, Column 22: document type does not allow element "div" here; missing one of "object", "ins", "del", "map", "button" start-tag.

<div class="newsflash">

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

  1. Error Line 88, Column 3: end tag for "div" omitted, but OMITTAG NO was specified.


You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

  1. Info Line 87, Column 0: start tag was here.

<div class="newsflash">

  1. Error Line 90, Column 5: end tag for "p" omitted, but OMITTAG NO was specified.


You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

However, as a side effect, this suddenly makes the included content (well, parts of it) visible in the including wiki page.

I think this is due to the genshi HTMLSanitizer running on the included page: If the included page is valid xhtml, then nothing will ever be included because the <html> tag is not an allowed tag in the HTMLSanitizer default configuration. Otherwise, by producing invalid xhtml, the genshi parser suddenly throws the parsed token in a different order. In effect, this produces START and END yields after </html> has been given to the sanitizer.

So I suspect using the HTMLSanitizer the way it is used here will always filter out the whole content of any xhtml-strict page.

??? Have to look into this further... Any hints appreciated.


Attachments (0)

Change History (3)

comment:1 Changed 10 years ago by Noah Kantrowitz

Resolution: wontfix
Status: newclosed

Working as designed. The remote include isn't designed for loading an entire HTML page as that isn't valid. You can load HTML fragments or remote text files though.

comment:2 Changed 10 years ago by jholg

Thanks for the quick answer.

May I suggest clarifying this in the documentation? The source http: led me to believe I can include (well, stripped-down) external html pages (which I indeed could, iff the included page was "garbled" in a xhtml-strict sense).

This is a very helpful macro, btw. The only thing I really miss is (local) intertrac support to include pages from other trac instances. As these might again include other pages, I reckon its way easier to retrieve the final html results of the included resource than to somehow resolve the dependencies to other trac envs. So I'll probably have to look into loading the html and then cutting out a fragment.

Keep up the good work. Holger

comment:3 Changed 7 years ago by jholg

See ticket:4743 for a patch that adds the possibility to include (xhtml-strict) external html pages.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Noah Kantrowitz.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.