Problem to input custom HTML with schema and JavaScript to individual page modx - modx-revolution

I'm new on ModX. I've created a template variable to input custom HTML into my page. I choose Rich Text as input type for this template variable.
On the other hand, my HTML contains some meta tag like <meta itemprop="name" content="myname"> tag with schema ( some custom attributes like <div class="review" itemprop="review" itemscope="" itemtype="http://schema.org/Review"> )
So when I submit this data into page through template variable, I don't see that meta tag and custom attributes like itemprop, itemscope or script tag. They are removed or ignored by the editor.
Can someone tell me that how can I get rid from these issue? I will be great full for the help. Thanks.

There are two possible ways at least:
1) use textarea TV type instead rich text
2) it depends on your WYSIWYG editor, they allow you to exclude (not cut) the specified tags from processing

Related

Thymleaf: Adding attribute in div tag

I need to add an attribute in with in div tag in thymleaf as follows
<div class="mp_snippet_address" itemscope itemtype="http://schema.org/LocalBusiness">
the problem is i could not define the itemscope in div tag
The standard HTML parser in Thymeleaf is a very strict XML parser. You can switch to the less-strict LEGACYHTML5 template mode (then include the nekoHTML 1.9.15+ as a dependency), which allows for 'boolean attributes', but the output may be slightly different than the input templates as I think it performs some kind of tag balancing to massage HTML5 into being well-formed XML.
Support for HTML as per the HTML spec is on the cards for Thymeleaf 3.0, but that version is still a very very very long way away.

render html in a rich text box in active reports software

I have a string with basic html markup which I want to put into a rich textbox
string ab = #"<b> a b </b>"
I want it to render as it would appear in a browser ie:
a b
how can I do this in active reports 7? According to http://www.datadynamics.com/forums/77664/ShowPost.aspx, a richtextbox supports these tags. Do I have to specify a property to allow it to render html? How should I approach this?
Thanks,
Sam
More information (Update 8/11):
I'm binding the data from a database field - an oracle nclob. The field repeats within the detail section (with different information each time).
If I bind the field directly to a textbox or label it renders the string, but doesnt encode the html
<b> a b </b>
but it encode the string.
Solution Summary
Solution (as suggested by #activescott)
Bind rtx directly to the datafield
'Reformat' the text into html in
the script
public void detail_Format()
{
rtxBox.Html = rtxBox.Text;
}
result: renders the html field with some degree of html formatting
notes:
binding directly in the script doesnt work,
ie. rtxBox.Html = pt.Fields["CONT_ID"].ToString(); yields some wierd meta data string
the Datafield only binding approach doesn't work
(it will yield it as text)
there are some extra spacing that occurs with p tags. It may be worth regexing them out or somehow providing some formatting control.
The actual property you are looking for is the Html Property. You can also load a file into that control using the step-by-step walkthrough here.
I am assuming you are using Section Reports and not Page Reports.
To use HTML from the database in a bound report, you should be able to use the DataField property of the RichTextBox control (set it to the name of the corresponding Data field at design time). However, I noticed this "Render HTML tags in DB in ActiveReport pdf or HTML" article which kind of implies that doesn't work since it loads the HTML from a database programatically. One of the two should work.

Rendering html using Struts2

Using Struts2, my goal is to present a simple blog to a user using Struts2 iterators, such as:
Most Recent Topic
response 1
response 2
...
Previous Topic
response 1
response 2
...
Users generate and submit each Topic/Response using a separate form, but, once submitted, I don't want them to edit the blog.
To generate either a Topic or a Response, I provide an editor (like the stackoverflow editor I'm using now) that produces html-formatted text, including whatever styling (bold, underlines, lists, etc.) that the user chooses. The text of the Topic/Response created by the user, including the html tags, is stored in a database.
However, I cannot find a way to render the Topic/Response as html in the blog. For example, text bolded in the editor shows up as <strong>text</strong> in a struts2 s:textarea tag.
I know that the s:property tag has an 'escapeHtml' attribute that will prevent this, but the s:property tag can't layout the text properly, and it seems that only the s:property tag has this attribute.
I've tried using <input value="%{#topic.content}" /> within the iterator instead of s:textarea, but it doesn't seem to recognize the #topic iteration reference.
Is there a way to do this?
use text instated of tax area .Let me know if you still facing this issue.
Use escapeHtml="false". I just tried it myself and it works as intended.
For example, with:
<s:set var="var1"><p>some stuff</p><p>other stuff</p></s:set>
<s:property value="var1" escapeHtml="false" />
renders the paragraph tags as you would expect.
How about using <pre> with <s:property>.
About html <pre> tag:
http://www.w3schools.com/tags/tag_pre.asp

Using wildcard for custom HTML tags in Rubymine

I'm developing a lot of RadiantCMS applications, and this CMS uses custom radiant tags which are translated to content and html at runtime. So, my HTML templates have a markup like this:
<body>
<div class="content">
<r:content />
</div>
...
</body>
This is all fine, but Rubymine complains about all the <r:content /> tags being invalid html. The effect is that my html-templates are loaded with error-notifications.
I know that you can customize the Rubymine Inspections, and allow Custom HTML Tags, but there are almost unlimited <r:... /> tags available. To add all possibilities in the customtags field would be hours of work and not very flexible, because new tags come and go by the month.
What I want to do is pass in a wildcard for the r: so that all those tags are allowed as valid html tags. I tried some REGEX options but gave me no results.
Does anyone have experience with Rubymine Inspections and how to overcome this issue?
There is a feature to define inspections per Scope. You can add a new Scope for all your project files except these template files (they can be excluded either by directory or name pattern). Then in the Inspection settings you can add this scope and configure the inspection reporting invalid HTML tags to trigger only in the custom scope, not for all the files. As your templates with <r:... /> are excluded from this scope, inspection will not report such files.
It's not ideal, as it will not report other possibly invalid tags in the template files, but right now there is no way to ignore tags by pattern, but you can submit a feature request.

Textareas and unsafe content

I've got wiki style content which is sanitized and stored in another field of the db for output as html. The original body field I'm not sure how to deal with as when I santize it characters are escaped and don't display well in the textarea.
What are the dangers of unsafe content in textareas? I'm sure I read previously that downloading such textarea content with ajax is preferable but I'd rather not go down that route if not necessary.
all HTML tag are no safe. by example if you close the textarea, you can add all nez HTML tag or what you want like JS. So it's exactly like inside a non textarea tag.

Resources