开发者

Recommended way to concatenate several HTML files

开发者 https://www.devze.com 2023-01-05 03:35 出处:网络
I\'m looking to generate a single HTML file from the content of multiple HTML and text documents (emails).

I'm looking to generate a single HTML file from the content of multiple HTML and text documents (emails).

I'd like some recommendations about the best way to handle this.

For instance, at the most naive level you could extract everything within the tags of the HTML and put it inside a <div>. Plain text would go inside a <pre>. Of course this will mean that anything important in the html <head> section, such as embedded CSS, is lost...

(Dev Environment: Delphi 20开发者_如何转开发07)

TIA


With exported email you can almost certainly grab everything up to the closing "body" tag in the first one, drop the body and html end tags, add your separator code, then loop through the remaining files stripping everything up to the body tag, include up to the closing body tag, then at the end drop in the end body, end html tags. The HTML header content in each is likely to be the same or very similar. It doesn't have to be, but it probably will be.

Trying to do the same for generic HTML documents is going to require the frame solutions above - wrap each document in an inline frame so that each one gets the full set to header includes and inline declarations. Even then you might run ito issues with code designed the break frames (and anything that happens to use frame-incompatible code).

0

精彩评论

暂无评论...
验证码 换一张
取 消