Wrap/unwrap selected text in an element
Are you missing a feature? Request its implementation here.
Wrap/unwrap selected text in an element
Post by iatttmp »
When you're madly re-purposing content from a horrible xml source with an indecipherable schema, it's really handy to be able to mark a bunch of text and just wrap in an arbitrary tag. Structured Framemaker has this feature. The suggestion dialog should pop up to assist while typing the new tag, but there should be no restriction on choices since the document is probably invalid in the first place.
oXygen already has a (sort of) unwrap function. If you delete a tag, the closing tag often disappears as well. The behavior is not perfectly consistent and could be made explicit with an nice "unwrap" command.
oXygen already has a (sort of) unwrap function. If you delete a tag, the closing tag often disappears as well. The behavior is not perfectly consistent and could be made explicit with an nice "unwrap" command.
Re: Wrap/unwrap selected text in an element
Hello,
Oxygen already has these functions/actions in Text mode.
To wrap the selected content, right click on the selection and from the contextual menu choose Refactoring -> Surround with Tags(Ctrl+E). You can choose a tag name from the proposed list or simply type your own.
To unwrap, right click on an element start or end tag and from the contextual menu choose Refactoring -> Delete Element Tags(Alt+Shift+X).
Regards,
Adrian
Oxygen already has these functions/actions in Text mode.
To wrap the selected content, right click on the selection and from the contextual menu choose Refactoring -> Surround with Tags(Ctrl+E). You can choose a tag name from the proposed list or simply type your own.
To unwrap, right click on an element start or end tag and from the contextual menu choose Refactoring -> Delete Element Tags(Alt+Shift+X).
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Re: Wrap/unwrap selected text in an element
Post by iatttmp »
Thanks, Adrian.
This happens a lot to me - wanting features that great products already include.
Tim
This happens a lot to me - wanting features that great products already include.
Tim
Re: Wrap/unwrap selected text in an element
Adrian, that is very helpful (I have been searching the Help system in vain to try to find out how to achieve that) but it will not allow me to wrap a tag with attributes. For example, while Ctrl-E allows me to wrap 'name' around (e.g., 'Charles Thorndyke') to yield <name>Charles Thorndyke</name>, I actually need to wrap 'name indexterm="Thorndyke,~Charles"' to yield <name indexterm="Thorndyke,~Charles">Charles Thorndyke</name>. How (if at all) can that be accomplished, please ? Including the attribute:value pair greys out the 'OK' button.
Philip Taylor
Philip Taylor
Re: Wrap/unwrap selected text in an element
Hello Philip,
The Surround with Tags(Ctrl+E) action is meant only for tagging content (just XML element tags without attributes).
So, why not tag the content with CTRL+E, press the left arrow twice to move the caret inside the inserted tag and continue typing the attribute name and value
e.g.
1. Select the text => Charles Thorndyke| (| = caret, blue = selection)
2. Tag it (Ctrl+E) type "name", press OK=> <name>Charles Thorndyke|</name> (| = caret, blue = selection)
3. Press the left arrow twice to position the caret inside the tag => <name|>Charles Thorndyke</name> (| = caret)
4. Insert a space in the tag and type in the attribute name and value => <name indexterm="Thorndyke,~Charles">Charles Thorndyke</name>
If you want to re-use the tagged content both in text and in the tagged attribute value, Find/Replace with regexp could be the solution.
Regards,
Adrian
The Surround with Tags(Ctrl+E) action is meant only for tagging content (just XML element tags without attributes).
So, why not tag the content with CTRL+E, press the left arrow twice to move the caret inside the inserted tag and continue typing the attribute name and value
e.g.
1. Select the text => Charles Thorndyke| (| = caret, blue = selection)
2. Tag it (Ctrl+E) type "name", press OK=> <name>Charles Thorndyke|</name> (| = caret, blue = selection)
3. Press the left arrow twice to position the caret inside the tag => <name|>Charles Thorndyke</name> (| = caret)
4. Insert a space in the tag and type in the attribute name and value => <name indexterm="Thorndyke,~Charles">Charles Thorndyke</name>
If you want to re-use the tagged content both in text and in the tagged attribute value, Find/Replace with regexp could be the solution.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 88
- Joined: Wed Feb 11, 2015 11:25 pm
- Location: San Francisco, California USA
- Contact:
Re: Wrap/unwrap selected text in an element
Howdy:
The good news is that the CTRL+e shortcut is exactly what I'm looking for.
The less good news is that it took me two days to find it. That's because I searched oXygen XML Editor (19) online help, and tried filtering Options > Preferences > Menu Shortcut Keys -- for the word wrap.
Don't know if there's a way to alias surround and wrap. Perhaps easier in the OLH than in the Preferences. Key point being that oXygen had the feature, I wanted to find it, but couldn't until I finally came over here to the forum.
Cheers & hope this helps,
Riley
SFO
The good news is that the CTRL+e shortcut is exactly what I'm looking for.
The less good news is that it took me two days to find it. That's because I searched oXygen XML Editor (19) online help, and tried filtering Options > Preferences > Menu Shortcut Keys -- for the word wrap.
Don't know if there's a way to alias surround and wrap. Perhaps easier in the OLH than in the Preferences. Key point being that oXygen had the feature, I wanted to find it, but couldn't until I finally came over here to the forum.
Cheers & hope this helps,
Riley
SFO
Re: Wrap/unwrap selected text in an element
Hi Riley,
I understand, sorry for the inconvenience. We'll try to improve the menu shortcuts search to also allow us to define various extra keywords for actions.
Regards,
Radu
I understand, sorry for the inconvenience. We'll try to improve the menu shortcuts search to also allow us to define various extra keywords for actions.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: Wrap/unwrap selected text in an element
Code: Select all
Ctrl-e
Code: Select all
Alt-Shift-x
Code: Select all
Alt-Shift-x
Code: Select all
Ctrl-e
Code: Select all
Ctrl-e
Start with this, which is shown with the
Code: Select all
p
Code: Select all
<p>Some text</p>
Code: Select all
Ctrl-e
Code: Select all
<comment><p>Some text</p></comment>
Code: Select all
comment
Code: Select all
<p>Some text</p>
Code: Select all
Alt-Shift-x
Code: Select all
<p>Some text</p>
Code: Select all
p
Code: Select all
<p>Some text</p>
Code: Select all
comment
We are just now moving from Arbortext to Oxygen, and Oxygen seems better so far, but this problem makes it almost unusable for me. What am I missing? How to correctly wrap and unwrap, without having an XML text() node (i.e., content of an element) such as
Code: Select all
<p>Some text</p>
Code: Select all
<p>Some text</p>
I'm sure that Oxygen must have a way to simply wrap and unwrap correctly (I hope so). I assume I just haven't found it yet. Thanks.
Re: Wrap/unwrap selected text in an element
Hi Drew,
I agree the "Delete Element Tags" should behave better in this situation, it's an action we thought will be used more for XML elements and not for XML comments.
I usually use in this particular case our "Toggle Comment" action (Command-Shift-Comma). It allows you to comment a selected area or if the caret is inside a comment to un-comment it.
Regards,
Radu
I agree the "Delete Element Tags" should behave better in this situation, it's an action we thought will be used more for XML elements and not for XML comments.
I usually use in this particular case our "Toggle Comment" action (Command-Shift-Comma). It allows you to comment a selected area or if the caret is inside a comment to un-comment it.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: Wrap/unwrap selected text in an element
I was told about Backspace and Delete, in this context. That seems to DTRT to unwrap, when the cursor immediately follows the element you want to remove (unwrap). I'm using that now (but it does require positioning the cursor after the element). That shortcut doesn't seem to correspond to a menu item anywhere, but perhaps it should (for discovery).
Re: Wrap/unwrap selected text in an element
Hi Drew,
Not sure what unwrap situation you are referring to.
For example if in a DITA <p> element you have an XML comment like this:
then in the Author mode you try to use delete or backspace on the comment's start and end markers, you will not get the <b> as an XML element. To properly unescape the comment's content you will still need to use the "Toggle Comment" approach I previously suggested.
Regards,
Radu
Not sure what unwrap situation you are referring to.
For example if in a DITA <p> element you have an XML comment like this:
Code: Select all
<!--<b>Gladiolus</b>-->
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: Wrap/unwrap selected text in an element
Right. Backspace/delete doesn't help with XML comments. It does with XML elements. It seems that the only thing that wraps/unwraps a comment is comment-toggling.Radu wrote:Hi Drew,
Not sure what unwrap situation you are referring to.
For example if in a DITA <p> element you have an XML comment like this:
then in the Author mode you try to use delete or backspace on the comment's start and end markers, you will not get the <b> as an XML element. To properly unescape the comment's content you will still need to use the "Toggle Comment" approach I previously suggested.Code: Select all
<!--<b>Gladiolus</b>-->
Regards,
Radu
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service