-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug/enhancement: replace "s with 's in texts #8
Comments
Ahh right, they need to be escaped with |
You're welcome! Yes, I arrived at escaping in my template in the end as well. Unfortunately, the nested For instance, in the Common attributes for all shortcodes, So while fixing the Shortcode Builder by escaping |
Hmm. This is more complicated. There are two major problems with the The first problem is in the use of html in the shortcode. The WordPress Shortcode API page says:
and, while support was extended slightly at one point, the position is (same page):
The point being that getting action in WordPress core to fix the next problem will not be possible, as this usage isn't supported in the first place. So on to the next problem: That the Gutenberg editor isn't handling these quotes properly either. This is more serious for the plugin syntax, not just the builder. To give some examples: Define some shortcodes in Gutenberg as follows: test1: test2: test3: test4: Press Preview and you get: test1 and test3 ignore the h4 tag (and show the default h3 tag) and test2 and test4 show the h4 tag. So double quotes don't work at all, even if you escape them. However, now things get worse. Now press update to save the page. No change is apparent. Now refresh the page. The saved shortcodes are now retrieved and you can see that they have been modified by Gutenberg as follows: test1: test2: test3: test4: So now you press Preview and all four fail. It looks like a bug in Gutenberg to me, but given that HTML is not supported in shortcodes, there will probably be no appetite for fixing it. A pragmatic solution would be to modify the shortcode syntax so that In this scenario, anyone who is currently using the Those using the widget (rather than the shortcode) will not have seen this problem, because it only allows you to change the class, not the tag. Phew! Sorry that was so long. Hope it helps! Ha! Last minute edit: |
Thanks for all the research you did! The reason these attributes are in there is mainly because these are standard attributes of widgets (so the widget title looks same in every widget in a specific template). Behind the scenes every widget actually renders a shortcode which is why it's required to support it. I just looked and the widget rendering circumvents the shortcode as a string and directly calls In v3 of the plugin I'm looking into how to make custom templating more convenient for users of the Plugin. Maybe I can then offer tools that make these shortcode attributes obsolete |
@ElectricFeet have you tried replacing
Then we wouldn't have to change it for everything in the shortcode. I would actually prefer to keep double quotes in the shortcode attributes and use single quotes as a special case for HTML in attributes |
Maybe some sort of Gutenberg block rather than a template? I'm new to Gutenberg, so that might be a stupid question! |
Re your question: yes, that's the test2 scenario above. Gutenberg changes them(!) to double quotes so that it fails. |
(N.B. all my tests were with |
@janizde p.s. There's also a an empty
produces
I'm not sure where they come from. Maybe wpautop is getting to it somehow. It's not a major problem as I simply removed the margins on the (Sorry to be the bringer of bad tidings all the time!) |
If you enter text in the text fields of the Opening Hours Shortcode Builder that contains
"
characters, these get fed into the shortcode, causing unpredictable results.For example, by entering
Location1: open <a href="tel:1234567">1234567</a>
in theOpen text
, I created a shortcode of :[op-is-open set_id="1234" open_text="Location1: open <a href="tel:1234567"> 1234567</a>"]
.The result in this case is that the
Open text
is ignored and the default text is output.It took me a while to figure out what was going on, as the builder is not fully idiot-proof :-))) Of course the
"
s were conflicting with the shortcode syntax and the whole thing was therefore being ignored somewhere along the line.I would suggest that the Opening Hours Shortcode Builder should swap any
"
s for'
s when building.The text was updated successfully, but these errors were encountered: