Problems pasting HTML5 into template editor
Hi there,
I'm having troubles with the template editor in Cascade Server v7.10
When I paste valid HTML5 into a template file, some of the tags are removed ( such as < main > ).
Here is some HTML I pasted into a new template file :
<!doctype html>
<!--[if lt IE 7 ]> <html class="ie6 non-responsive" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7 non-responsive" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8 non-responsive" lang="en"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9" lang="en"> <![endif]-->
<!--[if (gte IE 10)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<!--[if lt IE 9]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script src="js/shiv.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="css/style.css" />
<title>Langara</title>
</head>
<body>
<main>
<section class="content-section">
<div class="content-section-inner">
<div class="section-inner">
Yes
</div>
</div>
</section>
</main>
<div class="content-section-inner22">
<div class="section-inner">
Yes!
</div>
</div>
</body>
</html>
If I paste into the template editor ( with "Advanced editor" checked or unchecked ) the main tag appears in the editor ( see screenshot 1.
Then I press submit, and the main tag disappears. See screenshot 2.
Also the indentation disappears.
Are there some settings under the gear that I see to change to make it work ?
Thanks
- html5-prob1.jpg 156 KB
- html5-prob2.jpg 146 KB
- html5-prob3.jpg 87.1 KB
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on 09 Apr, 2014 12:37 PM
Hi,
I believe the issue is due to the conditional
<html>
tags at the top, because in Cascade's eyes there is no root element. Because of this, Cascade's XML validator will attempt to fix the code in order to make it valid XML.In order to accomplish the conditional tags, you will need to use code sections. There is an example of this under the protect-top code section description on our Knowledge Base. I believe you may need to tweak things slightly to match your code, but this should be able to get you started.
Please let me know if you have any questions.
Thanks!
2 Posted by jperreault on 09 Apr, 2014 04:58 PM
HI Ryan,
So, I removed the conditional tags at the top, and stripped down to an even simpler example :
Still the < main > tag is removed.
Our process involves a designer who is creating the HTML and developers who are building the formats and blocks to create the pages.
If the developers get a new version of the template, they will have to upload or paste the new HTML into Cascade Server.
Even if I choose "text" in the settings under the gear icon, the tag is stripped away.
Is the Cascade Server editor HTML5 compliant ?
Is there any way to turn off the automatic HTML cleanup ? Is there some passthrough flag I can add to just ignore the whole HTML element ?
Thanks for your help,
Jeff
3 Posted by Ryan Griffith on 09 Apr, 2014 06:10 PM
Hi Jeff,
Thank you for the additional information and sample HTML. From what I have read, it seems as though the
<main>
element is a recent addition to HTML5, so I think this may explain why it is being stripped out. Let me speak with the developers to gather some more information on this for you.In the meantime, you can use code sections to tell Cascade Server to skip the tag all-together, specifically
#protect
. When you have a moment, try the following and let me know how it works out for you:Please let me know if you have any questions.
Thanks!
4 Posted by Ryan Griffith on 09 Apr, 2014 06:32 PM
Hi Jeff,
After some additional testing, it looks as though the problem isn't with the
<main>
tag, it is with the DOCTYPE declaration. Cascade Server currently only supports DOCTYPE in all uppercase, so if you replace<!doctype html>
with<!DOCTYPE html>
it should submit just fine.Please let me know if you have any questions.
Thanks!
5 Posted by jperreault on 09 Apr, 2014 11:50 PM
Hi Ryan,
Thanks for your suggestion. The example I gave was a simplified case. The actual file has conditional HTML tags at the top. Changing the doctype to DOCTYPE alone didn't solve the problem.
It looks like it works if DOCTYPE is uppercased and the conditionals are wrapped in protect code sections, but our developers are worried that they might miss something if the Cascade Server editor silently removes tags again.
They have also come across some problems with DIV tags inside A tags. And are having to add !--#protect tags around those
The real problem is, the designers are delivering new versions HTML pages periodically. We'll have to re-apply the "protect-code" tags each time.
Is there any way to turn off the HTML cleanup ? Or a way to allow an exact upload of the file ?
Thanks,
Jeff
6 Posted by Ryan Griffith on 10 Apr, 2014 12:25 PM
Hi Jeff,
Thank you for following up, I am glad to hear uppercasing the DOCTYPE helped out.
You are correct in that the conditional
<html>
tags need to be surrounded by code sections. This is because there is technically no root element, so the code is not valid XML.Is this occurring within a WYSIWYG by chance? If so, this is due to the way the current version of the WYSIWYG (TinyMCE) is processing the HTML. This version is a bit more strict with regard to what it considers as valid XHTML. Since the code is not valid XHTML, the editor is basically trying to make corrections which in this case leaves you with just a
<div> </div>
.There is no way to disable the XML validation because Cascade Server relies on valid XML during the Page rendering process. The new code sections were introduced in Cascade Server 7.2 to help provide users with more flexibility when it comes to generating invalid XML content.
One problem with HTML5 specifically is that it is so relaxed with how tags can be written (ie not requiring closing tags) that validating HTML5 can be very tricky. Because of this we still required XHTML, which is based more on XML standards.
If you are concerned with your code being rewritten, especially for Templates, a good rule of thumb is if you see all of the tabbing and line breaks removed from the code after submitting the page the XML validation process encountered invalid XML somewhere and attempted to clean things up.
If you would like to propose adding additional functionality to Cascade Server to be less strict with its validation, I recommend posting something to our Idea Exchange for others to vote up and/or comment on. Let me know if you need access and I will send over an invitation.
Please let me know if you have any questions.
Thanks!
Ryan Griffith closed this discussion on 16 Apr, 2014 12:12 PM.