Code snippets

Are you missing a feature? Request its implementation here.
BB_[A]
Posts: 14
Joined: Tue Jun 02, 2020 1:50 am

Code snippets

Post by BB_[A] »

Does Web Author support sharing of code snippets like the desktop version does?
Bill Burns
bb@simplea.com
512-646-2100
--
We are [A]
simplea.com
mihai_coanda
Posts: 78
Joined: Wed Jul 20, 2016 8:22 am

Re: Code snippets

Post by mihai_coanda »

Hello Bill,

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

Best Regards,
Michael
Michael

https://www.oxygenxml.com
BB_[A]
Posts: 14
Joined: Tue Jun 02, 2020 1:50 am

Re: Code snippets

Post 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,
Bill Burns
bb@simplea.com
512-646-2100
--
We are [A]
simplea.com
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Code snippets

Post 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
Mihaela Calotescu
http://www.oxygenxml.com
BB_[A]
Posts: 14
Joined: Tue Jun 02, 2020 1:50 am

Re: Code snippets

Post 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,
Bill Burns
bb@simplea.com
512-646-2100
--
We are [A]
simplea.com
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Code snippets

Post 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 276 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
Mihaela Calotescu
http://www.oxygenxml.com
BB_[A]
Posts: 14
Joined: Tue Jun 02, 2020 1:50 am

Re: Code snippets

Post by BB_[A] »

Thank you!
Bill Burns
bb@simplea.com
512-646-2100
--
We are [A]
simplea.com
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Code snippets

Post by mihaela »

Hi,

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

Best regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
Post Reply