Page 1 of 1

Complex wrap (Cmd+E) or Find/Replace

Posted: Mon Nov 02, 2020 3:54 am
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.

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

Posted: Mon Nov 02, 2020 7:52 am
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

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

Posted: Mon Nov 02, 2020 3:20 pm
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.

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

Posted: Mon Nov 02, 2020 3:47 pm
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

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

Posted: Fri Nov 13, 2020 1:55 am
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.