Complex wrap (Cmd+E) or Find/Replace

Oxygen general issues.
fangluohang
Posts: 3
Joined: Mon Nov 02, 2020 2:05 am

Complex wrap (Cmd+E) or Find/Replace

Post by fangluohang »

Hello everyone,

In the context of an XML/TEI-based diplomatic edition of a Chinese Buddhist text, I have to markup several hundred Chinese characters that I have previously identified as non-standard. The markup (following TEIP4 for this particular element) in the <text> should be as follows:

Code: Select all

<orig reg="卷"><g ref="#REF_001-01.01.01"/></orig>
I used to do this manually, but I wonder if there might not be an easier way to markup these non-standard characters. I have tried using the "Surround with" option (Cmd+E), but unfortunately the closest I can get to is with an <orig>text</orig> markup, which I can then edit through the Find/Replace function (replace all <orig> with <orig ref=""> and replace all </orig> with <g ref="#"/></orig>. Still, in the end the result would look like this:

Code: Select all

<orig reg="">卷<g ref="#"/></orig>
where I have to cut/paste all characters inside the value location of their @reg and then copy/paste the value for the @ref according to an external list.

My question is rather simple: would there be a manipulation that I am not aware of, perhaps by combining both approaches mentioned above, to make the text value (i.e. the characters) appear right away in the markup as: <orig reg="卷">?

Thank you for your attention!
Kind regards,

Fang Luohang.
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: Complex wrap (Cmd+E) or Find/Replace

Post by Radu »

Dear Fang Luohang,

In the Oxygen Preferences->"Editor / Content Completion / Code Templates" page you can define a code template.
You give a name to the code template, maybe a keyboard shortcut and you can set its content like this:

Code: Select all

<orig reg="${selection}"><g ref="#"/></orig>
that ${selection} editor variable will expand to the current selected text.
Then in the Text editing mode you can select the character, press Ctrl-Space and choose to apply your code template.
More about code templates:

https://www.oxygenxml.com/doc/versions/ ... ting2.html
and about Oxygen editor variables:

https://www.oxygenxml.com/doc/versions/ ... ables.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
fangluohang
Posts: 3
Joined: Mon Nov 02, 2020 2:05 am

Re: Complex wrap (Cmd+E) or Find/Replace

Post by fangluohang »

Dear Radu Coravu,

Thank you very much for your detailed and clear answer!
Everything is working perfectly and it is wonderful to know that I could create other similar Code Templates if needed in the future. Combined with shortcuts, these really allow to speed up the workflow.

Thank you again for your help and kindness,
I wish you an excellent week.

Kind regards,
Fang Luohang.
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: Complex wrap (Cmd+E) or Find/Replace

Post by Radu »

Dear Fang Luohang,

I'm glad this works for you. Good luck with your work.
I'm adding below a link to some Oxygen editing tips and tricks:

https://blog.oxygenxml.com/topics/gener ... ricks.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
fangluohang
Posts: 3
Joined: Mon Nov 02, 2020 2:05 am

Re: Complex wrap (Cmd+E) or Find/Replace

Post by fangluohang »

Dear Radu Coravu,

Sorry for the late reply!
Many thanks for the link. Your article looks very interesting and I will read it carefully.

Thank you again for your help and kindness.
Kind regards,

Fang Luohang.
Post Reply