Wrapping selected text by snippets

Are you missing a feature? Request its implementation here.
Ellena Cruz
Posts: 1
Joined: Thu Jun 13, 2024 1:42 pm

Wrapping selected text by snippets

Post by Ellena Cruz »

I was looking for a feature in the Oxygen XML Editor that is similar to the "Edit" browser add-on or Surround by Mehmet Yatkı (much more difficult to configure) — the ability to add one snippet before the selected code fragment, and another snippet immediately after the selected fragment (or two halves of one snippet, if you like). For example, after selecting text

Code: Select all

Webinar: Web Author Customizations - Getting Started
and applying a previously saved snippet, we will receive

Code: Select all

<div class="video-container">
    <iframe src="//www.youtube.com/embed/=cHRBc2SpW2s" frameborder="0" allowfullscreen=""></iframe>
    <div class="video-container__title">Webinar: Web Author Customizations - Getting Started</div>
</div>
As I understand from articles "CSS-like Editing (Emmet)", "Oxygen Emmet Plugin", and "Oxygen Emmet Plugin", as well as topic "Wrap/unwrap selected text in an element", the fundamental possibility of such functionality is present in the application. Is this possible in the current version of the application, or should this be a development request?
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Wrapping selected text by snippets

Post by Radu »

Hi,
Oxygen has this feature named "Code templates":
https://www.oxygenxml.com/doc/versions/ ... ting2.html
For example you could create a code template named "test" which has an insertion string something like:

Code: Select all

CONTENT_BEFORE${selection}CONTENT_AFTER
then in the editor area use Ctrl-Space to show all code templates and insert it.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply