Shopware 6: custom plugin snippets with dynamic multilines - json

Shopware only accept snippets files in .json format.
How to handle multiline text with different number of lines for different translations?

If you want to have the different number of lines in each language(For example 10 lines in English and 2 in Spanish), you have to create only one snippet but with different text inside, using line break as #tinect wrote in this thread https://stackoverflow.com/a/75177091/21048350.
The English version will look like this: "text\ntext\n...\ntext"
and Spanish: "text\ntext"

Related

Can Word automatically find the titles and apply the corresponding style to them?

I'm desperately trying to convert an html to word or pdf with updated table of contents with page numbers (initially an R-markdown doc -> html).
When opening my HTML to word, the 650 page (!) document does not display page numbers or table of contents, although the titles are saved as titles.
One suggested solution was that the document may have become corrupted during conversion. It was therefore necessary to copy / paste all the text on another document and save it.
Indeed, when I copy and paste the text leaving all styles, pagination is possible.
But I need to have my titles and create an automatic table of contents!
I have the list of titles at the beginning of the document, but they are not identified as titles by Word.
Could there be a way that Word automatically applies the Heading 1 style to all sentences starting with 1, 2, 3 etc; Heading 2 style to all sentences starting with 1.1, 1.2, 2.1, 2.3 etc. And so on?
Maybe a Macro ? (I don't know anything about VBA :( )
Thanks in advance!
You can easily do this without using any VBA code just by using Find and Replace, e.g.
If you don't know how to use wildcards see: https://wordmvp.com/FAQs/General/UsingWildcards.htm

Trouble with printing <bbb>-constructs in perl

I have a small CGI perl script that I would like to print a file containing plain text to be output as html. So far, so god, however, the file contains some text enclosed with < and >, ie. <bbb>. The problem is that the <bbb> are removed. The same happens when I do a simple print statement like this:
print "aaa <bbb> ccc";
displays
aaa ccc
I have searched around, but not been able to find the solution. Amongst others, I have found this Printing string in Perl, but can't really see how the answer applies?
Are you displaying the output in a web browser? Then try
print "aaa <bbb> ccc";
and see the HTML::Entities module if you'll need to make conversions like this on other lines of text.

multiple selection every N lines Sublime Text

I have a very large file (~100k lines) and I want to insert a comment every 100 lines, I can write a script to do it, but I wonder if something like this is possible in Sublime (In emacs is pretty straightforward).
How about this regex to find 100 lines at a time
((.*\n){1,100})
and then replace with
\1
// this is a comment
Is that close enough for whatever it is you are trying to achieve?
Edit: This version of the replacement text suggested as better by #Maluchi
\1\n
// this is a comment\n

How to display plain text in webpage?

I have inserted my code in mysql database using text area.
What I have save appears is like this in mysql
This is Line 1
test
This lis Line 3
Now, my problem is to display the saved "file" to my browser which I am expecting to appear like this.
This is Line 1
test
This lis Line 3
Has anyone have some situation like this?
Use htmlentities on your output display. You can save html or any code as is in mysql with no special attention. You will need to escape it though so user based input isn't malicious.
http://www.php.net/manual/en/function.htmlentities.php
htmlentities("URL", ENT_QUOTES, 'UTF-8');
If you run this in php you will display the whole html tag. Likewise, you can spew out results from a mysql query, wrapping the relevant content in htmlentities to achieve what you're looking to do.

How to preserve the layout of textarea in the database?

I have a text area in html and a form to store the information in the database. When I click on submit, it supposed to take this text and save it in the database. For example:
"This is a text and this is a list:
1. number 1
2. number 2"
However, when I load the information from the database it looks like:
"This is a text and this is a list: 1. number 1 2. number 2"
How do I keep the layout of the textarea not changed (keep the spaces, lists, etc) without the need for the user to enter any tags.
It's being stored just fine in the database. You're outputting what was entered as plain text as HTML, and HTML ignores line breaks. You need to convert your \n characters to <br /> tags. PHP has a nl2br() function for this.
You could have them enter the data in a WSYWIG and do the work on your side to make sure it's always formatted properly - client-side users still won't have to see any tags, especially if you limit their editing options...
tinyMCE, nicEdit are two good editors