Filling multiple ${ask editor variables with one question prompt

<oXygen/> general issues.
Cmarine
Posts: 4

Filling multiple ${ask editor variables with one question prompt

Wed Jan 25, 2017 12:09 am

Greetings,

I am wondering if there is a way to use one ${ask} editor variable to fill multiple values in a template. Allow me to clarify:

I have a DITA based topic template that I am creating, and I use some ${ask} editor variables to fill certain attributes.

For example:

Code: Select all

<ph id = ${ask('What ID should this ph have?', generic, 'default')}/>


The functionality I would like is to be able to use a single ${ask} editor variable and have the user's response fill multiple areas. So let's say that I had this same question about what to name the ph tag in 5 different spots. Right now, the editor would ask me five times for the same information. I would like it to ask once and have it fill the code needed for all the ph tags that need it.

Can anyone think of an approach for this?

Thanks,

C
Radu
Posts: 5752

Re: Filling multiple ${ask editor variables with one question prompt

Wed Jan 25, 2017 9:07 am

Hi,

We've had previous requests and we have an internal issue on which we gathered similar use cases but right now we do not have such mechanisms in place.
There are two main use-cases and you seem to want both of them:

1) Let's say in the new file template I use different editor variables in two places:

Code: Select all

<ph id = ${ask('What ID should this ph have?', generic, 'default')}/>

Code: Select all

<code id = ${ask('What ID should this code have?', generic, 'default')}/>


Maybe Oxygen should present a single dialog in which it asks for values for both these questions, instead of presenting two dialogs.

2) You want to ask for the value of one parameter in one place and use it in multiple places. Maybe in a future version we could also add some improvements related to this, allow you to define IDs on each $ask, something like:

Code: Select all

<${ask('What ID should this ph have?', generic, 'default', id="abc")}/>

Code: Select all

<${ask('What ID should this ph have?', generic, 'default', id="abc")}/>


In this way Oxygen would ask for the value of the first ask, then seeing that the second one has the same ID, reuse the returned value for the second instance.

Until then, we have Java and Javascript-based API which allows you to resolve custom editor variables using a plugin.
For example this repository of Javascript-based plugins:

https://github.com/oxygenxml/wsaccess-javascript-sample-plugins

has a sample plugin called customEditorVariables which resolves a custom editor variable called ${clipboard}.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
gchale3rd
Posts: 9

Re: Filling multiple ${ask editor variables with one question prompt

Fri Feb 17, 2017 6:57 pm

Hello Radu,

I was looking for the same functionality whereby the prompt value I enter for the ${ask} variable is populated in multiple places. Are you suggesting the ${clipboard} variable could be used in conjunction with the ${ask} variable to populate the prompt value in multiple places? For example, the ${ask} variable would populate the first instance of the prompt value, and the ${clipboard} variable would be used to populate subsequent instances of the prompt value.

Thanks,

George
Radu
Posts: 5752

Re: Filling multiple ${ask editor variables with one question prompt

Mon Feb 20, 2017 9:45 am

Hi George,

We will consider for a future version allowing you to somehow use the value of an $ask in multiple places in an XML fragment (in a new file template or in a new code template for example).
What I meant to say with the sample plugin which expands ${clipboard} is that you can define your own custom editor variables like for example ${myVariable} and then you have the API so that from an Oxygen plugin you can expand your own editor variables exactly as you want. So the clipboard editor variable plugin was just an example that you can expand your own custom editor variables.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
gchale3rd
Posts: 9

Re: Filling multiple ${ask editor variables with one question prompt

Wed Mar 01, 2017 12:16 am

Are there any alternative methods for inserting the same value in multiple places in a topic (other than doing a search and replace)?

I have to create conkeyref files for multiple payers (health care plans)--one file per payer. I would like to have a template that uses a placeholder called payer_name. When I create a file using the template, I would like to be able to enter the payer name once and have that value populated in all instances of the payer_name placeholder. As I am new to oXygen, I wasn't sure if there might me another solution other than using multiple instances of the ${ask editor variable.

Thank you.

George
Radu
Posts: 5752

Re: Filling multiple ${ask editor variables with one question prompt

Wed Mar 01, 2017 11:33 am

Hi George,

I do not have anything new to add to my last reply on the thread. A future Oxygen version will allow using the value provided from an ask editor variable in multiple places. Until then you can try to build an Oxygen plugin and use our API to expand a custom editor variable. So there is no other built-in solution.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
gchale3rd
Posts: 9

Re: Filling multiple ${ask editor variables with one question prompt

Wed Mar 01, 2017 10:29 pm

Thank you for your help Radu.

George
Cmarine
Posts: 4

Re: Filling multiple ${ask editor variables with one question prompt

Fri Mar 31, 2017 1:03 am

Radu,

Do you have a sense of what version this change will be available in? In the meantime I am stuck filling out 12 asks with the same content each time I expand a template :lol: .

I have tried to look at the plugin creation system, but I am pretty new to java and there aren't very many walkthroughs available. Do you have any content that shows the development of a plugin start to finish?

Thanks,

Carlos
Radu
Posts: 5752

Re: Filling multiple ${ask editor variables with one question prompt

Fri Mar 31, 2017 8:18 am

Hi Carlos,

Right now the internal issue is scheduled to be resolved for Oxygen 19.1 (Autumn this year).

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

Re: Filling multiple ${ask editor variables with one question prompt

Tue Jun 19, 2018 7:40 am

Hi,

As an update we released Oxygen 20.1 which has a new editor variable called ${answer}, you can see an usage example here:

https://www.oxygenxml.com/doc/versions/20.1/ug-editor/topics/editor-variables.html

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

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 3 guests