snippets in Author?

Are you missing a feature? Request its implementation here.
dcdenison
Posts: 31
Joined: Sun Jun 14, 2009 4:25 pm

snippets in Author?

Post by dcdenison »

I would like to store snippets of markup in the text view of Author. I can't seem to find a way to do that. Is that possible?

thanks, love the program.

DC
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: snippets in Author?

Post by sorin_ristache »

Hello,

I am not sure I understand: do you mean you cannot insert XML markup in Text mode? Make sure the Text button is pressed at the bottom of the editing area (that is you edit your XML document in Text mode) and paste some text including XML markup that you copied to clipboard previously. Or type your XML tags directly in the editor.

Do you want a kind of separate buffer view where you can keep temporary snippets while editing an XML document? You can use the Scratch Buffer view available from menu Perspective -> Show View -> Scratch Buffer.


Regards,
Sorin
dcdenison
Posts: 31
Joined: Sun Jun 14, 2009 4:25 pm

Re: snippets in Author?

Post by dcdenison »

That's close (and thanks for the quick reply!) I like to work in text mode, just because it's cleaner (I may get more comfortable with the Author view eventually, which looks really cool), but I was hoping that I could set up a little collection of tags -- even simple ones like <para></para> -- that I could insert with a keystroke.

A list item for example --
<listitem>
<para></para>
</listitem>

It would be cool to be able to hit a key, or a button and get that.

But maybe I'm looking for Author features in the Text view : )

Anyway, I'm a big fan of Oxygen; it has so many cool features, I feel like I'm quibbling.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: snippets in Author?

Post by sorin_ristache »

You should check out the code templates feature. The name of the code template is displayed in the content completion popup when a prefix of the name is already typed at the current position of the cursor. Look at the predefined code templates for the XSD Editor and the XSL Editor.


Regards,
Sorin
dcdenison
Posts: 31
Joined: Sun Jun 14, 2009 4:25 pm

Re: snippets in Author?

Post by dcdenison »

That looks really promising. Thanks!
kwringe
Posts: 10
Joined: Thu Jun 18, 2009 9:30 pm

Re: snippets in Author?

Post by kwringe »

We create Actions in our framework files that insert the text snippets and then we add the Actions to our toolbars. This method limits our ability to create a large number of text snippets; however, as we are just starting to use text snippets this solution has worked well for us.

To create Actions to insert text snippets:
  • 1. Choose Options>Preferences>Document Type Declaration and then select your document type (e.g., docbook 5)and then click Edit.
    2. Click Author.
    3. Click Actions.
    4. Click + to create a new action.
    5. In the ID field type a name (e.g., snippet.runcommand).
    6. In the Name field type a descriptive name to use on the toolbar (e.g., Run command).
    7. In the Invoke The Operation field, choose ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation or ro.sync.ecss.extensions.commons.operations.SurroundWithFragmentOperation (if you want to include element tags).
    8. Double-click to edit the With The Arguments Table. In the Value box, type the snippet text.
    For example: Run the following command
    For example:
    <guilabel>Start</guilabel>&rarr;<guilabel>Programs</guilabel>&rarr;<guilabel>SQL Anywhere 12</guilabel>
    9. Click OK.
    10. Click OK.
    11. Click Toolbar and add the new action to the toolbar ...
Post Reply