Moving Images subfolders and need hrefs to update

Questions about XML that are not covered by the other forums should go here.
zechony
Posts: 1
Joined: Mon Jun 05, 2017 4:56 pm

Moving Images subfolders and need hrefs to update

Post by zechony »

Hello,

Our project consists of multiple images subfolders underneath Main Folders. We want to move all image subfolders into one master image folder at the root of the project - however we don't know if there is an easy way to do this without breaking all the hrefs?
Note: We are using relative paths so I assume ../images/name.png is relative to each of our submaps right? IF we move the maps up ABOVE the root will that work or will that break the structure.

Thanks!
Kristen
sorin_carbunaru
Posts: 397
Joined: Mon May 09, 2016 9:37 am

Re: Moving Images subfolders and need hrefs to update

Post by sorin_carbunaru »

Hello Kristen and welcome to our forum!

The DITA Master Files support [1] seems to be most suitable for your use-case. You just have to add your main DITA map as a master file, then you can move or rename resources in the Project view, and oXygen will display a window from which you can choose to update all the references.

In case you are working with a huge project (thousands of resources such as topics, images, media files and so on), you may need to increase the amount of memory that oXygen uses [2].

Let us know if you need further assistance.

[1] https://www.oxygenxml.com/doc/versions/ ... files.html
[2] https://www.oxygenxml.com/doc/versions/ ... chers.html

All the best wishes,
Sorin Carbunaru
oXygen XML
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Moving Images subfolders and need hrefs to update

Post by chrispitude »

I've added all my *.ditamap files as Master Files.

When I rename a *.dita file, or rename a directory containing *.dita files, I get the dialog asking if I want to update all hrefs to those resources - hooray!

But when I rename a graphics/ directory containing image files to graphics2/, I get no such dialog, and the hrefs to the images in the *.dita files become broken.

Does the umbrella of "rename-detection" apply only to the hrefs directly to the files in the Master Files list? If so, does that mean I need to add *all* the *.dita files as Master Files to detect image renamings too? And how would that work when writers are constantly adding and removing topic files across a set of 50+ books?

Thanks!
sorin_carbunaru
Posts: 397
Joined: Mon May 09, 2016 9:37 am

Re: Moving Images subfolders and need hrefs to update

Post by sorin_carbunaru »

Hello Chris,

The automatic updating of the references should work for all resources (DITA resources, media resources, etc.) that can be accessed starting from the master maps. Actually, you wouldn't even need to add all the ditamaps as master maps if you had "one map to rule them all", a "root" or "master" map, i.e. a map that defines a hierarchical structure of submaps, topics and other resources, this map being the starting point of the structure. You can read some more information about DITA Master Files at https://www.oxygenxml.com/doc/versions/ ... files.html.

If for some reason the feature doesn't seem to work, try disabling and re-enabling the Master Files support or perhaps restarting oXygen. Please let me know how it goes.

All the best wishes,
Sorin Carbunaru
oXygen XML
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Moving Images subfolders and need hrefs to update

Post by chrispitude »

Hi Sorin,

Thanks for the confirmation! This helped me find the source of the problem.

In the Project view, I had my display filter settings set to show only "*.dita,*.ditamap". Unfortunately removing files from display also seems to remove them from consideration of resource renaming detection.

I will file an enhancement request for filtered items to still be considered when renaming directories.
sorin_carbunaru
Posts: 397
Joined: Mon May 09, 2016 9:37 am

Re: Moving Images subfolders and need hrefs to update

Post by sorin_carbunaru »

Hi Chris,

I confirm the behavior you reported. I created an improvement request for the Master Files support (EXM-45023). Thank you for reporting this!

All the best,
Sorin C.
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Moving Images subfolders and need hrefs to update

Post by chrispitude »

Is there a way to store the Master files configuration in the *.xpr project file?

Our project is stored in a Git repo, and each writer gets warned that Master files support is disabled when they open the project for the first time. Then we need to walk them through which files to add.
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Moving Images subfolders and need hrefs to update

Post by chrispitude »

Actually, this seems to be an issue with a particular user's freshly pulled Git repo. When I deleted my own repo and recreated it from Git, the master files were configured as expected. Sorry!
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Moving Images subfolders and need hrefs to update

Post by chrispitude »

chrispitude wrote: Mon Mar 16, 2020 5:14 pm Actually, this seems to be an issue with a particular user's freshly pulled Git repo. When I deleted my own repo and recreated it from Git, the master files were configured as expected. Sorry!
Okay, so we figured out when this happens. If you use the Git plugin to clone a repo from the server, the Project view shows the Master files as disabled even if the freshly cloned *.xpr file has it enabled. If you quit and restart Oxygen, then the Master files setting is enabled per the *.xpr file.

I'll reproduce this on a public Github test repo, then report a low-priority issue for it.
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: Moving Images subfolders and need hrefs to update

Post by Radu »

Hi Chris,

Sure, if you find some steps to reproduce the problem just let us know. The master files enabled state is saved inside the XPR so things should work.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply