Page 1 of 1

How to load images

Posted: Thu Oct 29, 2020 12:20 am
by manojdcoder
Let's say I have the document below

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept props="something.." base="title.." id="a4">
<title id="v461357">Operating Guidelines</title>
<conbody>
<p>
<image href="Arm_Cuff_250X178_cae7dfb8-462a-40ae-bf41-0bde1b99160f.jpg" id="image_jyb_llz_lnb" />
</p>
</conbody>
</concept>


When the document is loaded in Editor, it tries to load image from "http://localhost:8080/web-author-compon ... 99160f.jpg" - where https//localhost:25608/ is the base path of document url.

I would like to customize the image path - may be point it to a different server / host, pass some additional parameter. Is there a way to intercept the request?

Re: How to load images

Posted: Thu Oct 29, 2020 12:38 am
by cristi_talau
Hello,

The default DITA CSS uses the value of the href attribute as the relative URL of the image, to be resolved against the URL of the topic. You can write your own CSS as part of a framework [1] to compute the URL in a different way. You can use some Oxygen-specific CSS extensions like oxy_concat(), oxy_substring() or even oxy_xpath() [2] based on the href value.

An example of such a CSS rule is the following:

Code: Select all

*[class~="topic/image"] {
  content: url(oxy_concat('https://oxygenxml.com/images/', attr(href)));
}
Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... works.html
[2] https://www.oxygenxml.com/doc/versions/ ... tions.html

Re: How to load images

Posted: Fri Oct 30, 2020 1:39 pm
by manojdcoder
Thank you for your reply. I followed custom framework sample, tried implementing a DITA extension, added the following CSS file to framework description

Code: Select all

<field name="authorExtensionDescriptor">
						<authorExtension>
							<field name="cssDescriptors">
								<cssFile-array>
									<cssFile>
										<field name="href">
											<String>${framework}/css/dita.css</String>
										</field>
										<field name="title">
											<String></String>
										</field>
										<field name="alternate">
											<Boolean>false</Boolean>
										</field>
									</cssFile>
								</cssFile-array>
							</field>
							<field name="mergeCSSsFromDocument">
								<Boolean>true</Boolean>
							</field>
						</authorExtension>
	</field>
Looks like it loads only my CSS file instead of merging it with existing DITA framework. Any thoughts what I'm missing?

Re: How to load images

Posted: Fri Oct 30, 2020 4:08 pm
by mihaela
Hello,

It seems that there is no CSS file from the base DITA framework specified in the list of your framework CSS files. Did you delete the "${baseFramework}/..." entries from the CSS list when creating the extension? You should try again to create the extension framework, leave the default CSS entries unmodified and just add your CSS file there.

Best Regards,
Mihaela

Re: How to load images

Posted: Fri Oct 30, 2020 9:01 pm
by manojdcoder
I manually created the framework, copied appropriate scripts from the sample project [here][https://github.com/oxygenxml/legalDocML]

I'm not sure how I can keep existing dita framework working and just merge my CSS files on top of it. Is there a documentation you could point me to?

Re: How to load images

Posted: Fri Oct 30, 2020 9:50 pm
by cristi_talau
Hello,

Here we describe how to create a framework extension [1]. This assumes you have Oxygen XML Editor installed.

Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... zzf_pns_vz

Re: How to load images

Posted: Fri Oct 30, 2020 10:57 pm
by manojdcoder
Thanks for the link.

But I'm using the Web Author Integration Project - https://github.com/oxygenxml/web-author ... ntegration , any pointers for this type of project?

Re: How to load images

Posted: Sat Oct 31, 2020 12:57 am
by manojdcoder
Is it possible for you to give an example of custom .framework XML file that extends dita. In all my attempts it either loads my custom css file or only the bundled dita framework css files, not both.

Re: How to load images

Posted: Sat Oct 31, 2020 9:32 pm
by cristi_talau
Hello,

For Web Author Component Integration starter project, only the framework packaging is different [1]. However, frameworks can be uploaded from the Admin page as well after the resulting web application is installed.

Regarding the example framework, you can take a look at the LightWeight DITA framework included in the default Web Author installation.

What you should do after extending the framework is to leave all the inherited CSS files there and add your, and give it no title and mark it as non-alternate.

Best,
Cristian

[1] https://github.com/oxygenxml/web-author ... frameworks

Re: How to load images

Posted: Tue Nov 03, 2020 7:10 pm
by manojdcoder
Thank you for the directions.

I already had a plugin, I noticed that I can add CSS to by plugin itself which was easier than extending a framework.

Once again, thank you very much for your support.