Insert GUID?

Oxygen general issues.
kruncher
Posts: 26
Joined: Tue Mar 31, 2009 5:47 pm

Insert GUID?

Post by kruncher »

Hi guys

Is it possible to insert a unique GUID into XML documents when editing? I would like to add unique GUID's in my DITA documentation for the topic id attribute.

In NotePad++ there there is a simple plugin that generates and inserts a GUID at the caret position. I was able to map this to a keyboard shortcut which is very useful.

I am still using Oxygen 10.3, is this possible?

Many thanks
kruncher
Posts: 26
Joined: Tue Mar 31, 2009 5:47 pm

Re: Insert GUID?

Post by kruncher »

No worries, I have created a simple application that generates and pastes GUIDs automatically using a hotkey.

I have uploaded the application to GitHub for anybody interested:
https://github.com/kruncher/guid-generator-hotkey
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Insert GUID?

Post by Radu »

Hi Lea,
I am still using Oxygen 10.3, is this possible?
If you had a newer Oxygen version (I think 13.0 or newer) you would just have to open the new file template used to create DITA topics:

OXYGEN_INSTALL_DIR/frameworks/dita/templates/topic/Topic.dita

and its content contains an editor variable like:

Code: Select all


.....
<topic id="topic_${id}">
.....
and change it to use the ${uuid} editor variable like:

Code: Select all


.....
<topic id="topic_${uuid}">
.....
Then when creating new topics the editor variable would get expanded to an UUID.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
kruncher
Posts: 26
Joined: Tue Mar 31, 2009 5:47 pm

Re: Insert GUID?

Post by kruncher »

Okay fair enough, I will consider upgrading sometime in the future.
rdelong
Posts: 72
Joined: Tue Oct 21, 2014 10:01 pm

Re: Insert GUID?

Post by rdelong »

I know that I'm responding to a very old post, but the subject matter is relevant today. We are using Oxygen 17.1 and have a need for our writers to insert GUID as target IDs for our conrefs. Our developer suggested that we access an external site to generate unique GUID values, copy the value, and then paste the value into our conref targets. I find this method to be awkward.

Is there a way to get Oxygen to generate these values on the fly? I'm thinking of a keyboard shortcut or XML snippet. I really have no clue how this can be done.

Thanks for the feedback.
kruncher
Posts: 26
Joined: Tue Mar 31, 2009 5:47 pm

Re: Insert GUID?

Post by kruncher »

I stopped using <oxygen/> a long time ago in favour of the likes of Sublime and VSCode (which have GUID generator plugins); however, back when I was experiencing this limitation in <oxygen/> I did make a little tool to ease this process.

Essentially you run the tool; and then you use Ctrl+Shift+V in any other program on Windows and it will insert a fresh GUID:
https://github.com/kruncher/guid-generator-hotkey

I hope that this helps with your needs!
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Insert GUID?

Post by Radu »

About the question asked by Rick:

So a DITA @conref attribute has the following syntax:

conref="path/to/topic.dita#topicID/elementID"

The topicID is the ID attribute set on the <topic> element and the elementID is the ID attribute set on the target element.
So what you would actually want would be to generate ID attributes according to the UUID pattern on XML elements, right?
In the DITA main menu there is an ID Options dialog in which you can set the ID pattern to be:

${localName}_${uuid}

then if you right click inside any DITA element and choose Generate IDs an ID with that specific pattern will be generated for the element.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jopakent
Posts: 2
Joined: Sat Mar 03, 2018 12:41 am

Re: Insert GUID?

Post by jopakent »

Hello,
I am facing the exact opposite issue. I'm not sure how but when our authors create conrefs, sometimes, O2 uses a GUID for the ID.

I want that NOT to happen. We often run into merge issues that require me to fix a mess of broken conrefs. Without some clue from the conref ID, it's sometimes very, very difficult to figure out what the conref is.

So the human readable ID is what we need. Is there a way to disable the GUID insertion in O2?

I believe most our writers are using a recent version.

Thanks,
JPK
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Insert GUID?

Post by Radu »

Hi,

So looking at a conref value:

Code: Select all

conref="path/to/topic.dita#topicID/elementID"
do you want to disable the random ID generation for the topic ID or for the element ID?
If you want it disabled for the element ID, if you open a DITA topic in the Author visual editing mode, in the "DITA" main menu there should be an "ID Options..." action allowing you to disable auto generation of IDs on elements.

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