Replies: 6 comments 3 replies
-
Hey @Vinc26 - I have a plugin for you that will do exactly what you want to do. I will be announcing it in minutes. It is located in my GitHub and it will replace AAA with BBB - what ever you want to replace. I tested your specific use case and it works great. Get it here. |
Beta Was this translation helpful? Give feedback.
-
@Vinc26 - your problem is with lack of usage regexps in |
Beta Was this translation helpful? Give feedback.
-
Hey, thanks both! @bjazmoore, your plugin does almost everything I need!!! Thanks! Do you will publish on the Publii Products page? It stay only my need to paste a variable to the result. Like More generic: Possible? I would have tried to contribute to your plugin by adding this feature myself, but unfortunately I don't know the regexps. I understand that using |
Beta Was this translation helpful? Give feedback.
-
Hi again @bjazmoore , just tried your plugin, and I thing I found a bug: Here is the Publii website: I've tried to understand the bug, but I not enough experiment. |
Beta Was this translation helpful? Give feedback.
-
I will be updating the documentation - the replacer really struggle with double quotes. I was sure it was working before release, but it is not. I have fiddled with it, slowly breaking it without a lot of improvement. I hate regex! Anyway - here is the new rule: DON'T USE DOUBLE QUOTES. Use single quotes. The following rule work fine: If you need to have a double quote between the single quotes then use the code |
Beta Was this translation helpful? Give feedback.
-
Oh thanks for all! And yes, the next time, I'll use backup file, and directly in Github issues pan. I'm really novice with all that... only one week :D |
Beta Was this translation helpful? Give feedback.
-
Hi,
Based on the plugin development documentation (#1359), I'm trying to create a simple text replacement plugin:
In a block based page, if it find
__STARTDIV__
, it replace by<div>
In a block based page, if it find
__ENDDIV__
, it replace by</div>
(Here is why I need that in my website: #1714)
Here's, the code of main.js of the plugin:
It partially works, but I have actually 3 problems:
1 - I only know how to replace one specific text. Not more than one. I need the same plugin replace also
__ENDDIV__
2 - If
__STARTDIV__
appears several times in the same page, it replace only the first occurrence.3 - Probably because of Publii rendering order, it automatically adds
</div>
after<div>
. I would like the plugin to act not on the raw text (the source text), but on the html code after rendering.If you can help me solve the three problems above, I will need help with a fourth problem: I don't know how to use RegExp correctly. How would you replace:
__STARTDIV__id="cadre1"_data-version="10"__
by<div id="id1" data-version="10">
Here is what I'll create in Page Blocks:
Here is the output I want:
Thanks :D
Beta Was this translation helpful? Give feedback.
All reactions