overriding display of certain elements in Author View

Oxygen general issues.
ttasovac
Posts: 82
Joined: Fri Dec 19, 2003 6:02 pm

overriding display of certain elements in Author View

Post by ttasovac »

hi.

TEI uses <egXML> for marking up examples of TEI itself when writing documentation etc. I'm wondering whether it would be possible, while using the Author View, to somehow override all the children of <egXML> to display as a block element but not using the Author View's tags, but rather using clean XML a là Editor View?

In other words, I am not interested in controlling the -oxy-tags-color and -oxy-tags-background-color, but rather displaying "proper" xml in the Author View for the children of <egXML>.

Any tips would be greatly appreciated.

All best,
Toma
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: overriding display of certain elements in Author View

Post by Patrik »

Hi Toma,

I once did something similar for DITA (didn't discard the approach - just postponed it):

xml sample code

Code: Select all

<xml-codeblock>
<Root>
<Element>Text</Element>
<Element>More Text</Element>
<Element/>
</Root>
</xml-codeblock>
css

Code: Select all

xml-codeblock {
display: block;
font-family: "Courier New", monospace;
}

xml-codeblock * * {
display: block;
padding-left: 2em;
}

xml-codeblock *:before {
content: '<' oxy_xpath('name()') '>';
background-color: #EFEFEF;
}

xml-codeblock *:after {
content: '</' oxy_xpath('name()') '>';
background-color: #EFEFEF;
}

xml-codeblock *:empty:before {
content: '<' oxy_xpath('name()');
}

xml-codeblock *:empty:after {
content: "/>";
}
Attributes are not supported yet...

Regards,

Patrik
ttasovac
Posts: 82
Joined: Fri Dec 19, 2003 6:02 pm

Re: overriding display of certain elements in Author View

Post by ttasovac »

many, many thanks, patrik for this hint. i added oxy_attributes() so now attributes display as well.

since all this is done through the css content property, i don't see how i could style element names, attributes and values differently — they all seem to have to be the same color. but having xml examples in the author view display as monochromatic xml will already be a big improvement for us.

all best,
toma
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: overriding display of certain elements in Author View

Post by Patrik »

To use different styles for the content you can use either different pseudo elements:

Code: Select all

xml-codeblock *:before(3) {
content: '<' oxy_name();
background-color: #EFEFEF;
color: blue;
}

xml-codeblock *:before(2) {
content: oxy_attributes();
background-color: #EFEFEF;
color: red;
}

xml-codeblock *:before(1) {
content: '>';
background-color: #EFEFEF;
color: blue;
}
or use oxy_label():

Code: Select all

xml-codeblock *:before {
content: '<' oxy_name() oxy_label(text, oxy_attributes(), styles, "color: red;") '>';
background-color: #EFEFEF;
color: blue;
}
But I don't see a reasonable way to assign different colors for attribut names and values with css only. You could do with it with a java plugin, though.

Regards,

Patrik
ttasovac
Posts: 82
Joined: Fri Dec 19, 2003 6:02 pm

Re: overriding display of certain elements in Author View

Post by ttasovac »

this is great. many thanks, once again, patrik!
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: overriding display of certain elements in Author View

Post by alex_jitianu »

Hi Toma,

I think that I should also mention the text area form control, which right now can only edit the text content of an element. Starting with version 17.1 (the next version) this form control will also be able to edit the entire XML content of an element (so also structure). So it will look like a small text mode editor inside the author view. You will get syntax highlight as in the text page as well as content completion.

Although it can't help you right now, I felt the need to mention it for future users reading this post. Other than that, I think Patrik described perfectly what can be done right now.

Best regards,
Alex
ttasovac
Posts: 82
Joined: Fri Dec 19, 2003 6:02 pm

Re: overriding display of certain elements in Author View

Post by ttasovac »

Thanks, Alex — that's great news. 17.1 will be my favorite update ever :)

All best,
Toma
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: overriding display of certain elements in Author View

Post by Patrik »

Hi Alex,

will the editor be as comfortable as the text mode of oXygen? I.e. supporting content completion, automatically add closing tag, automatic indention...?

Patrik
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: overriding display of certain elements in Author View

Post by alex_jitianu »

Hi Patrik,

I hope so... It will have the features you've mentioned. But I can't guarantee that it will be completely the same experience because we also want to keep the component as lightweight as possible.

Best regards,
Alex
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: overriding display of certain elements in Author View

Post by Patrik »

Sounds great! :D
Post Reply