Jump to content

XML in plaintext, what to do with it?


porton

Recommended Posts

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:

  1. first remove the tags (like <em> in the above example)
  2. leave the content of the <pre> tag as is (just remove syntax:format argument)
  3. terminate my pipeline processing with an error
Edited by porton
Link to comment
Share on other sites

@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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...