porton Posted August 13, 2018 Share Posted August 13, 2018 (edited) I want to extend XHTML with tags like <pre syntax:format="python"> # Some Python code def f(): pass </pre> The text in <pre> tag should be "enriched" with <span> HTML tags with classes, to highlight the syntax of the text inside <pre>. What my code should do if the processed <pre> tag already contains some XML tags? Example: <pre syntax:format="python"> # Some Python code def f(): <em>pass</em> </pre> The variants I thought of: first remove the tags (like <em> in the above example) leave the content of the <pre> tag as is (just remove syntax:format argument) terminate my pipeline processing with an error Edited August 13, 2018 by porton Link to comment Share on other sites More sharing options...
justsomeguy Posted August 13, 2018 Share Posted August 13, 2018 A pre tag means the contents are pre-formatted, so the correct behavior is to print out any tags that appear in the pre block instead of rendering them. Link to comment Share on other sites More sharing options...
porton Posted August 13, 2018 Author Share Posted August 13, 2018 @justsomeguy You confuse between pre-formatted and plain text. <pre> in HTML can contain any formatting tags (<em>, <strong>, etc.) I decide to raise an exception in this case, because other ways do not work for me. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 13, 2018 Share Posted August 13, 2018 It looks like that's correct, several tags are allowed in a pre block. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now