How to make Netbeans use single quotes in HTML tag attribute autocomplete? - netbeans

When I type attribute in tag Netbeans automatically add two quotes:
<form method="|">
I want to make it use single quotes:
<form method='|'>

From my answer to a very similar question:
Type something like <div class= now your cursor should be in between two quote or double quote characters. You can now type the other type of quote character and it will change your preference.

I'm afraid, but it's pretty sure that double quotes are hard-coded into NetBeans.

Related

How to escape single quote in EJS template

my variable contains a string with an apostrophe or a single quote '
i'd like to display it with EJS.
I use
<img class="card-img-top" src='<%= data[i][0].omdb.Poster %>' alt='<%= data[i][0].omdb.Title; %>'>
When data[i][0].omdb.Title; contains an apostrophe, HTML is broken.
<%= is known to escape html. But not single quote!
How to do it? Any idea please?
I can't find anything on ejs doc.
<%= is known to escape html. But not single quote! How to do it?
Use double quotes around your attributes. Then single quotes won't matter.
(If you really want to use ' then you can do ...Poster.replace(/'/g, "&apos;")).

HTML entities in attributes with tinymce

When I have doble marks encoded in my HTML attributes, tinymce breaks that attributes.
For example:
data-value="ab&quote;----&quote;"> will be seen in source code: <div data-type="more-posts" data-value="ab">Hello</div>
http://codepen.io/anon/pen/MKYrbJ
How can I fix this?
If you would have real double quotes here your HTML would not be valid anymore because attributes use them.
It will be best do handle those when you save that content to your database.
You could replace them with single quotes - those wouldn't break the markup.

HTML form autofill: is there a regex match against name attribute or should it be literal?

I couldn't find out from specs that should the name attribute's value be literal or is it evaluated by regex or similar?
e.g. does it have to be name="fname" or can it be name="userdetails[fname]"?
Same goes for HTML5 related autocomplete attribute?
And is there differences between browsers?
You can use any text there.
What you mention about array (userdetails[fname]) - from point of view html it's usual string, but PHP interprets this string into an array.
Seems like that there's no any intelligence / regex on these fields.
fname, lname do not work and only first_name and last_name worked on Chrome and Firefox.
So best is to have literal naming. Some sources suggested that there could be some kind of regex evaluation but at least I couldn't find anything reliable. But at least I found this https://html.spec.whatwg.org/multipage/forms.html#autofilling-form-controls:-the-autocomplete-attribute

Silverstripe CMS wysiwyg incorrectly decoding/encoding quotes

I've encountered an issue that I've never come across before with Silverstripe when saving content in the CMS.
When saving in the Content wysiwyg (or any other fields I've added), it is escaping the quotes and apostrophies ie. When applying a style to a piece of content through the style dropdown to make the underlying HTML:
<p class="my-style">lorem ipsum</p>
When I press save, the page reloads and the style is not shown. When inspecting the HTML put back into the wysiwyg, I am getting:
<p class="\"my-style\"">lorem ipsum</p>
Initially, my thoughts were that the content field was maybe set to Text rather than HTMLText but I've checked and found this not to be the case.
Anyone have any ideas? I've built numerous sites in Silverstripe previously and this is the first time I've encountered this behaviour.
I'm using 3.1.0
Cheers
As I've mentioned I think this is a PHP issue and an issue of escaping double/single quotes. It's a symptom of magic quotes.
Magic Quotes was a "(annoying) security feature" enabled by default in PHP < 5.3.0 and deprecated in > 5.4.0
In a jist here's what magic quotes does (taken from php website)
When on, all ' (single-quote), " (double quote), \ (backslash) and NULL characters are escaped with a backslash automatically. This is identical to what addslashes() does.
This may be what you are experiencing.
Disabling Magic Quotes
On to the solution.
If you have access to your main php.ini, just turn it off like so:
; Magic quotes
;
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off
; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off
; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off
If you don't have have access to the main php.ini:
add this line to the root .htaccess file (if you're using apache mod_php)
php_flag magic_quotes_gpc Off
or if you're running PHP as a CGI, create a php.ini file on your document root and put the previously mentioned snippet for php.ini.
Hope this helps!
Very peculiar...
I read the symtpoms as a double double quote, if you parse
<p class="\"my-style\"">lorem ipsum</p>
it's going to appear as
<p class=""my-style"">lorem ipsum</p>
I usually define my styles in the typography.css file and it automatically appears in the "Styles" drop-down in the WYSIWYG editor.
Can you try this out and let me know if it helps?
Thanks!

Struts2 property tag. Force to escape single quote

I have rather silly problem.
Struts2 property tag doesn't escape single quote ('). Such behavior breaks my JavaScript code.
It does do escape double quote (") using html entities, but not single quote (').
Is there any possibility to force property tag to replace single quote with appropriate html entity?
Example, string replaced with html entities.
Отредактированное событие с кавычкой "
The same with single qoute:
Отредактированное событие с кавычкой '
Is there any possibility to overcome such difficulty using standard approach? I wouldn't like to write some custom code.
You're in luck! By default, the tag only escapes HTML, but you can have it escape JavaScript too:
<s:property value="yourValue" escapeJavaScript="true"/>