How to stop Diazo from stripping whitespace in Plone? - plone

Plone 4.1.7
plone.app.theming 1.0
I found this question which is similar to my question except this person wants to do the opposite: remove spaces and carriage returns from Plone content with Diazo(minimizing html code)
I want Diazo to stop stripping out whitespace, as it's stripping out a lot of it that is needed for formatting. This seems to be the case even if my rules.xml is empty - just enabling a theme seems to do it, rather than it being an aspect of a particular theme.
Turning the theme on/off also causes a bug on only one particular page (a view named '##upload') where all of the classes in the <body> tag are stripped out. Unsure if that is at all related, although I do know it's Diazo causing it.
Edit: Some further info: I don't have the non-themed side blocked by host name in the control panel, but rather by use of the <notheme> tag in rules.xml. I have to do this because the non-themed side is on the same domain as the themed side.

Related

Absolute external links bug, url of the current page added at the beginning of the url

I have a very strange external links behavior on this page:
https://dev.switchonpaper.site/en/daniel-g-andujar-the-artist-as-a-thinker-and-augur-of-what-happens/
There is a list of external links visible by clicking on "Go Deeper".
On some links, the address of the current page is added at the beginning of the external link.
E.g.: iSAM™ (1997)
E.g.: TTTP Photo Collection - 1997
All external links are absolute links.
When you look at the source code, the links are correct.
This site runs under Wordpress, the links are contained in a Gutenberg block built with the ACF plugin.
I tested the following things:
Disable all plugins.
The browser or something else continues to add the current page address on some links only.
I emptied the server cache, removed all the .htaccess rules except the wordpress part.
I made sure that the PHP file that writes these links is in UTF-8.
By recreating the links, it is always the same ones who are affected.
Does anyone have any idea what could cause this?
Thank you for your time and help!
You have the so called "hidden characters" before your link start. I suggest you to check it by yourself with some online tool like this: https://www.soscisurvey.de/tools/view-chars.php. If you try to paste there the link copied by your source code you will see you have hidden stuff before "https:..."
The solution to this issue is that you delete all the characters and you write them all over again by yourself, w/o copy/pasting them from another source or in alternative paste them inside some non-HTML text editor before pasting them to your website

2sxc: Configure Tinymce to prevent removes empty span tags

It seems that tinymce removes empty span tags like already discussed here one solution could be to insert in tinymce.init function the following option extended_valid_elements: 'span'.
Is there a way to configure it in 2sxc?
If not, where can i find the js files of tinymce to manually configure it?
Thanks
At the moment there is no central configuration for this. The config itself is currently done in https://github.com/2sic/2sxc-ui/blob/master/src/sxc-edit/fields/string/string-wysiwyg-tinymce.controller.js and is then minified/compiled into the dist-folder.
You can change it, but would have to keep an eye on keeping your changes "alive" when upgrading.

Django CMS Deleting HTML5 Tags and Attributes

I am having a big time issue with solving a problem. I have a placeholder called main for the content region of the page. I was building that region in the cms. Everything was going great until I attempted to add an embedded video contained in an iframe. When I save django cms completely removed the iframe and left an empty div. So I attempted to use prettyphoto light box to open the video by clicking on an image. The code I added to the page through the cms is:
<a rel='prettyPhoto[youtube]' href="https://www.youtube.com/embed/mqVZF_yb8C0?autoplay=1&start=1765&iframe=true" data-rel="prettyPhoto">Click Image</a>
When I saved, django cms completely removed the data-rel attribute from the link which is obviously needed for the js. So I went a step further and adapted the code of the data attribute to:
rel="prettyPhoto"
and the cms also removed that attribute! Also anytime I add an html5 tag like article of section it hates that too! What gives here? Am I doing something wrong? Any advice would be appreciated. 
Aaron,
Thanks.
Please see the discussion at https://github.com/divio/django-cms/issues/1529. We use html5lib to clean the contents of the text plugin (this cannot be turned off for security reasons).
What you'll want to do is write a custom plugin (possibly one that can be embedded inside text plugins).

ASP.NET - Check if a WebControl contains server blocks?

Is there a way in code to determine if a Web control contains server blocks (other than, for example, parsing out the file, grabbing the contents of the tag, and scanning for <% ... %>)?
My reason for wanting this is because I have a lot of old Web forms that were designed without any regard whatsoever to HTML conformance. The header control (which is included on every page but is inside the body tag) contains the link tag referencing the site's main stylesheet. As long as the page's head tag does not contain server blocks, I can programmatically insert the link tag into Page.Controls.OfType(Of HtmlHead).First(), then set the visibility of the "bad" link tag to false.
Again, this is all legacy stuff (it's in 3.5 now, but most was written in the .NET 1.1 days), so changing everything over to use a master page is something for which I simply do not have the time and budget. Regardless, it would be nice to see the pages come up with the stylesheet pre-loaded, rather than having the browser begin rendering with no styling, then applying the stylesheet once it reaches the reference to it in the body.
Seems like a silly work around but could you change the name of your CSS file so that when the legacy code goes to load, it can't find it?
Although Mufasa entered his response as a comment, this question has been sitting unresolved too long. Therefore, I will surmise that the only solution is his -- to wrap it in a try/catch black.

How to strip out character references inserted by Diazo into text nodes

I'm using plone.app.theming 1.0b5 and Plone 4.1 rc3. Our Diazo rules contain an number of external content includes and we're using one such include to insert Google Analytics script into the result:
<append theme="/html/head" content="/html/head/script"
href="##standard-page-elements" />
Unfortunately the script tag from the view is being mangled during the transform such that any carriage returns are converted to character references (
)
This is due to the way lxml serializes and deserializes (see this Plone bug report).
I'd like a work around in the meantime but can't figure out a Diazo rule that would strip these references out.
As noted above:
The bug has been fixed in the trunk of Diazo (thanks Laurence) so I no longer need to do this. I didn't manage to figure it out: it doesn't seem to me you can alter external content through Diazo, only the main content.

Resources