Page 1 of 1

CSS import with editor variables: possible bug under Linux

Posted: Tue Oct 12, 2021 8:28 pm
by fsteimke
Oxygen User Manual says in the section about Handling CSS Import: "You can use various editor variables in CSS imports. When editing an XML document with an associated CSS in Author mode, the editor variables will be expanded and resolved."

However, when i try this feature with the example given in the manual

Code: Select all

@import "${framework(DITA)}/custom.css";
i get an error like about No such File or Directory for this Path:
/home/frank/kosit/dsmeld/DocBook-DSMeld/css/${framework(DITA)}/custom.css

As you can see, it does not recognize and expand the editor Variable. Instead, the expression is treated like a regular file path relative to the location of the importing CSS file.

It's Oxygen XML Editor 23.1 on Linux Mint 20.2 Cinnamon.

Sincerely, Frank

Re: CSS import with editor variables: possible bug under Linux

Posted: Wed Oct 13, 2021 8:02 am
by Radu
Hi Frank,

The validation of the CSS is done with the W3C CSS validator which cannot interpret such Oxygen-specific editor variables. So indeed validation shows errors.
But when the CSS is interpreted by Oxygen when computing styles for the Author visual editing mode, Oxygen should properly expand the editor variables in imports.

Regards,
Radu

Re: CSS import with editor variables: possible bug under Linux

Posted: Wed Oct 13, 2021 9:43 am
by fsteimke
Hi Radu,

i am not convinced. It's not a CSS Error (validating against CSS Spec).

It's a "File not found" Error. Oxygen tries to import a file with a wrong URL.
  1. The wrong URL contains the Editor variable literally (not expanded);
  2. It starts with the Directory-Path of the importing CSS File (the URL seems to be relative to the importing CSS file)
Thanks,
Frank

Re: CSS import with editor variables: possible bug under Linux

Posted: Wed Oct 13, 2021 12:51 pm
by Radu
Hi Frank,

Do you obtain this error when you validate the CSS (manual or automatic validation) or when the CSS is actually used in the Author visual editing mode to render the XML content?

Regards,
Radu

Re: CSS import with editor variables: possible bug under Linux

Posted: Wed Oct 13, 2021 3:41 pm
by fsteimke
I obtain the error when the CSS is actually used in the Author visual editing mode to render the XML content.

F. Steimke

Re: CSS import with editor variables: possible bug under Linux

Posted: Wed Oct 13, 2021 4:57 pm
by fsteimke
To be precise: i edit the css file and write down the @import statement. I get immediatly the error Message "File not found". You can find the exact error message in my first post. I do not active validate the CSS file.

I am not sure what really happens, sorry - maybe it is "validating CSS in the background"?

Since i am not at my linux system right now, i can't answer what happens without the @import statement.

Frank

Re: CSS import with editor variables: possible bug under Linux

Posted: Thu Oct 14, 2021 9:13 am
by Radu
HI Frank,

The "${framework(DITA)}" gets translated to a location path like "OXYGEN_INSTALL_DIR/frameworks/dita", do you actually have a "custom.css" saved there?
Can you give me step by step details to reproduce the problem? Did you create for example an extension of the DITA framework? How are you using your custom CSS stylesheet?

Here's what I did on my side to quickly test things:

1) Created a "custom.css" somewhere on disk with the content:

Code: Select all

@import "${framework(DITA)}/css/core/-dita.css";

* {
    color:red;
}
2) Opened a DITA topic and added before the root element a reference to the custom.css like for example:

Code: Select all

<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<?xml-stylesheet type="text/css" href="../../../../../../Desktop/custom/custom.css"?>
<topic id="introduction">

....
3) Switched the topic to the Author visual editing mode, I received no error and the text has red foreground.

Regards,
Radu

Re: CSS import with editor variables: possible bug under Linux

Posted: Sun Oct 17, 2021 2:20 pm
by fsteimke
Hi Radu,

i am back at my Linux system and can confirm, that there is no bug. Sorry for false alarm.

I have checked with a fresh file, which is not part of the framework i have created.
  • with import statement, i still get the error message "File not found", but CSS rendering shows that import happens (looks fine);
  • without import statement, rendering looks ugly
So it is only the error message that is misleading, but the action is as expected.

Thanks,
Frank

Re: CSS import with editor variables: possible bug under Linux

Posted: Mon Oct 18, 2021 7:12 am
by Radu
Hi Frank,

Thanks for testing this, we have some plans for enhancing the validation to also expand editor variables, once we'll do this there will be consistency. I'll update this forum thread when we do.

Regards,
Radu