File: Compose_Tag.bsh

package info (click to toggle)
jedit 5.1.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,632 kB
  • ctags: 10,965
  • sloc: java: 96,611; xml: 92,194; makefile: 55; sh: 30; cpp: 6; python: 6
file content (40 lines) | stat: -rw-r--r-- 1,003 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Localization
final static String NotEditableMessage = jEdit.getProperty("macro.rs.general.ErrorNotEditableDialog.message", "Buffer is not editable");

void composeTag()
{
	caret = textArea.getCaretPosition();

	text = textArea.getSelectedText();
	if(text == null || text.length()==0 )
    {
        textArea.selectWord();
        text = textArea.getSelectedText();
        if(text == null || text.length()==0 )
            return;
    }

	sb = new StringBuffer();
	sb.append("<").append(text).append(">");
	sb.append("</").append(text).append(">");
	textArea.setSelectedText(sb.toString());
    textArea.setCaretPosition(caret + text.length() + 2);
}

if(buffer.isReadOnly())
	Macros.error(view, NotEditableMessage);
else
	composeTag();

/*
	Macro index data (in DocBook format)

<listitem>
    <para><filename>Compose_Tag.bsh</filename></para>
    <abstract><para>
		Creates an HTML tag from the selected text or select current word and then creates the tag.
    </para></abstract>
</listitem>

*/