Page 1 of 1

Code snippets

Posted: Thu Mar 11, 2021 6:17 pm
by BB_[A]
Does Web Author support sharing of code snippets like the desktop version does?

Re: Code snippets

Posted: Fri Mar 12, 2021 12:47 pm
by mihai_coanda
Hello Bill,

Could you please elaborate on your question?
Are you referring to the copy-paste mechanism?

Best Regards,
Michael

Re: Code snippets

Posted: Fri Mar 12, 2021 7:56 pm
by BB_[A]
Sorry, I should have used the correct terminology. I mean code templates as described here:https://www.oxygenxml.com/doc/versions/ ... ml?hl=code.

We want to add a library of objects that will include outputclasses for bootstrap. The users are nontechnical, and we'd like to avoid forcing them to modify the outputclass values. A library of code templates seems to be an easy way to accomplish this, but I'm not certain if Web Author supports them.

Thanks,

Re: Code snippets

Posted: Mon Mar 15, 2021 5:34 pm
by mihaela
Hi,

We need more details in order to better understand your use case. Can you please give us a sample of a code template that you want to use?

If you need for example to include in the content completion list some actions that insert specific elements with predefined outputclass attribute values, you could customize your framework to create some actions [1] that use InsertFragmentOperation [2] operation (that insert your code templates). Then, you should add the actions in the content completion [3]. Do you think that this solution is suitable for your use case? Please let us know if you need more details.

[1] https://www.oxygenxml.com/doc/versions/ ... tions.html
[2] https://www.oxygenxml.com/doc/versions/ ... ments.html
[3] https://www.oxygenxml.com/doc/versions/ ... n-tab.html

Best Regards,
Mihaela

Re: Code snippets

Posted: Mon Mar 15, 2021 8:34 pm
by BB_[A]
We have a series of bootstrap elements to support, so we'll need to have a list of templates for the following:

<ph outputclass="glyphBlueCheck"/>
<ph outputclass="glyphOrangeCheck"/>
<ph outputclass="glyphGreenCheck"/>
<ph outputclass="glyphPlus"/>
<ph outputclass="glyphMinus"/>

Can I assume, then, that it is possible to configure code templates that can be inserted from a list?

Thanks,

Re: Code snippets

Posted: Tue Mar 16, 2021 6:17 pm
by mihaela
Hi,

We prepared for you a framework (an extension of the default DITA framework) that includes 5 new entries in the content completion, one for each template you mentioned: glyphBlueCheck, glyphOrangeCheck, glyphGreenCheck, glyphPlus and glyphMinus.
Here is the zip containing the framework: .
dita_extension.zip
(18.43 KiB) Downloaded 275 times

So, all you have to do is to:
1. Add the framework (the zip) in Web Author [1]
2. Restart the server
3. Go to any topic and press enter
You should see the new entries in the proposals list and you should be able to insert the specific phrases.

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

Best Regards,
Mihaela

Re: Code snippets

Posted: Wed Mar 17, 2021 10:17 pm
by BB_[A]
Thank you!

Re: Code snippets

Posted: Thu Mar 18, 2021 10:31 am
by mihaela
Hi,

You’re welcome! Please let us know if you need further assistance.

Best regards,
Mihaela