-
AuthorPosts
-
February 8, 2017 at 4:20 pm #744402
My site contains software documentation. It is important that I can display code correctly. I am unable to insert this code into most elements
<doc>
<p>
<s>some text </s>
<s> some text </s>
</p>
<p>
<s>some text </s>
<s>some text </s>
</p>
</doc>What I have tried and did not work:
formatting the code as preformatted
wrapping the code between,
or <tt> tags escaping the whole code With some of the methods above, the code displays correctly the first time I publish the page but if I need to edit the page later, upon clicking edit, the code gets interpreted instead of just displayed. The only thing that works is using the Code Element with 'pre' wrapping and with 'Escape HTML Code' ticked. The Code Element cannot be inserted into other elements, though. How can I insert the code into a table for example?
- This topic was modified 7 years, 9 months ago by mjakubicek.
February 13, 2017 at 8:17 am #746191Hey mjakubicek,
Yes that is correct the code shows up only if you tick Escape HTML. To insert the code where you cannot insert the codeblock element please use the shortcode below.
[av_codeblock wrapper_element='' wrapper_element_attributes='' escape_html='aviaTBescape_html' custom_class=''] /* YOUR CODE HERE */ /* END YOUR CODE HERE */ [/av_codeblock]
You can easily view the shortcode for page elements by activating debug mode http://kriesi.at/documentation/enfold/enable-advanced-layout-builder-debug/
Best regards,
VinayFebruary 20, 2017 at 11:15 pm #749655hi Vinay,
I am sorry, but we have had still problem with it. We use code tags and when we save it, it is OK. However, after next saving (making some changes and save), the shortcode tags are interpreted and are not preserved.
Could please insert following code to our website and try a few times to modify including saving the page. Here is the testing webpage: https://www.sketchengine.co.uk/shortcode/Shorcode:
<doc> <p> <s>some text </s> <s> some text </s> </p> <p> <s>some text </s> <s>some text </s> </p> </doc>
(temporary login credentials are attached in private content)
I suppose this way can be faster. If your way works, we will use it on other pages.
Thank you in advance
February 25, 2017 at 7:56 am #751720Hi,
We have edited your test page and added a code inside the shortcode provided. The code shows fine in the front end. You cannot add code in text editor directly as it is processed by default.
Please review the test page :)
Best regards,
Vinay- This reply was modified 7 years, 9 months ago by Vinay.
February 27, 2017 at 11:25 pm #752614I added my code above and saved. It was OK until I wanted to edit the page again. See the screen of the current code (it was interpreted by the editor in spite of the “avia block” tags around): https://www.sketchengine.co.uk/wp-content/uploads/code-interpreted.png
(the screen shows that I cannot edit this page now and then save it because I would lose the original code.)
March 3, 2017 at 5:27 pm #755226Hi,
Sorry for the late reply!
From your screenshot it seems like you are adding your content in visual tab instead of Text tab. Please try using Text tabBest regards,
YigitMarch 7, 2017 at 12:27 pm #756930I inserted in in Text tab. The code is interpreted in admin interface (see the screenshot above), but it is OK on the web page.
The problem lies in the fact that it is differently displayed in admin interface and commonly on the web page.
So, the shortcode works, but it is confusing because I see something else than on the web page.March 17, 2017 at 10:18 am #762401Hi,
Sorry for the late reply.
Please use the codeblock element to insert html or other code.
Code Block can do 2 things.
1. Display the code as is.
2. Run the code and display the result.I have once again checked for any issue with the code block on your site and confirm that code block element is working fine both in frontend and backend as intended.
Best regards,
VinayPlease note you are using < s > i’m not sure if that’s supported. please use proper html syntax.
- This reply was modified 7 years, 8 months ago by Vinay.
March 20, 2017 at 11:39 am #763572OK, but how to combine a code block with an accordion content (in the Avia Layout Builder)?
See the following page
shortcode
<doc pub="1977">
is OK…Now please edit this page. When you open the accordion with the shortcode, it was interpreted and the code disappeared.
I cannot find any sustainable solution.
March 24, 2017 at 9:05 pm #766389Hi,
Sorry for the delay, to display the code block element in a accordion element please enable the debug mode http://kriesi.at/documentation/enfold/enable-advanced-layout-builder-debug/
1. Create a new page and copy the shortcode of the code block element.
2. Paste the shortcode in the accordion tab in text mode.Please view the test page in private :)
Feel free to let us know if you have any question.
Best regards,
VinayMarch 27, 2017 at 9:17 am #767266Hi,
when you look at the same page now (in private) and open the “Display as code” accordion, you will see
<doc> <s>some text </s> <s> some text </s> <s>some text </s> <s>some text </s> </doc>
The problem starts when you edit the page, open this accordion and will see only interpreted code (in visual mode). OK, you click on text mode, but the
<doc>
tags have disappeared.I would need a solution which works also with repeating editing page (e.g. I would add some code or text on the page)
Try to create a page with the code (above) and then twice edit that page, the code will be interpreted during second and following editing.
March 31, 2017 at 7:55 am #769754Hi,
Please try the following solution. This is originally intended for xml codes but it should work in your situation.
// https://kriesi.at/support/topic/need-a-raw-codeblock-visual-element/#post-739681
Best regards,
IsmaelApril 3, 2017 at 9:25 am #770973Hi,
I have tried, but it doesn’t help me. How can I use that solution?
I should insert the following code just into an article (in the Text mode) or to the function.php? :function xml_shortcode( $atts, $content ) { $filter = array('<br>','<br />'); $content = str_replace($filter, '', $content); return "<code><pre>" . esc_html($content) . "</pre></code>"; } add_shortcode( 'avaxml', 'xml_shortcode' );
thanks.
April 4, 2017 at 3:39 am #771464Hi!
Add it in the functions.php file then use the [avaxml] shortcode in a code block. Ex:
[avaxml] code here [/avaxml]
Regards,
IsmaelApril 4, 2017 at 11:58 am #771674Hi,
I have added that code in the functions.php but the problem is remaining. Look at https://www.sketchengine.co.uk/_test-2/#toggle-id-1 – there
<code>
tags around my xml tags. Then try editing the page, the code gets interpreted if you re-edit the page.April 5, 2017 at 5:15 am #772165 -
AuthorPosts
- You must be logged in to reply to this topic.