Paulis software ->Vedit resources -> Wiki Tools 31. 07. 2009  
-----------

Wiki Tools

Collection of Vedit macros and other resources for editing Wiki pseudo HTML.

This is a collection of Wiki editing tools I have made for Vedit text editor. The package is designed for editing Wiki pages that use MediaWiki pseudo HTML syntax (for example Wikipedia and Rosetta code).

From a special WikiTags and W-User menus, you can easily run the macros included. In addition, the package contains keyboard configuration and syntax highlighting files for MediaWiki pseudo HTML. Installation instructions and a macro for quick setup are included. See below for the descriptions of each file.

For easy download, all the macros and other files are packed in the file wikitools11.zip. Click on the link below to download the package.

Download WikiTools11.zip   -   V1.1   -   31.07.2009   -   17 K - Vedit 6.1

Descriptions of the files in wikitool.zip:


Tools Menu (WikiTags)

Wiki_tools.mnu is a Tools menu for Wiki editing. It is named WikiTags in the menu bar.
You can use this menu to insert some of the most common MediaWiki pseudo-HTML tags and to do some edit operations. Some commonly used HTML tags can be inserted, too. In addition, it allows you to easily call the macros listed below.

Some of the menu items are inline commands in the menu, others call the macros included in this package, and some items call macros from other pages on my site. Click on the links below, or on an item in the menu to see the description. ->

Matching HTML tag - see (HTML Tools)
Delete HTML tag - Inline command, as in (HTML Tools)
Delete text - Inline command, as in (HTML Tools)
Format character... - Calls the macro Wiki_fmt.vdm
List... - Create list. Calls the macro Wiki_lst.vdm
Indent - Indent text in Wiki page. See Wiki_lst.vdm
line Break - Inline command: insert <br> tag.
noWiki - Inline command: insert <nowiki> tag.
Table... - Create a table. Calls the macro Wiki_tbl.vdm
table Row - Inline command: insert table row.
table Cell - Inline command: insert table cell.
table Header - Inline command: insert table header cell.
Edit columns... - Copy/cut/paste/add columns. Calls the macro Wiki_tbl.vdm: EDIT_COLUMNS
Link (internal) - Add internal link. Calls the macro Wiki_fmt.vdm: int_link
External link - Add external link. Calls the macro Wiki_fmt.vdm: ext_link
Image - Add image. Calls the macro Wiki_fmt.vdm: image_tag
Sign - Inline command: insert your sign (~~~~).

User Menu (W-User)

Wiki_User.mnu is a User menu for Wiki editing. It is named W-User in the menu bar.
This has been modified from my USER2 Menu (see Misc Macros). It contains some general functions and some functions specific to Wiki editing. The Wiki specific functions are:

Headings (Outline) - Calls the macro Wiki_outline.vdm
Check spelling - Calls the macro aspell.vdm, see Aspell integration

Matching tag (from HTML Tools) Delete tag (from HTML Tools) Format character... List... Indent Table Edit columns Link (internal) External link IMG WikiTags menu (wiki_tools.mnu)
Headings (Outline) W-User menu (Wiki_User.mnu)

Keyboard configuration

Wiki.key is keyboard configuration file for Wiki editing. It is somewhat similar to my html2.key configurations, but enters Wiki pseudo HTML instead of HTML tags. (However, some keys insert HTML tags that are accedpted by Wiki.)

The Wiki specific keys are:

F12Tools → Matching tag
Alt-DelTools → Delete HTML tag - Deletes tag at cursor and its pair (if any)
Ctrl-DelTools → Delete text inside tag - Deletes text between tags or double quotes
Shft-F6Tools → table Row
Shft-F7Tools → table Cell
Shft-F8Tools → table Header
Shft-F10Tools → List...
Alt-2Level 2 header
Alt-3Level 3 header
Alt-4Level 4 header
Alt-9Go to matching brace
Alt-\Tools → Table...
Alt-.Tools → Line break
Ctrl-HHTML <hr> tag
Alt-'HTML Comment (from cursor to end of line)

Syntax file

Wiki.syn is a color syntax highlighting file for Wiki pseudo HTML. Highlights headers, links, bold/italics text, characters for lists and indents and some other symbols, comments and HTML tags.

Macros

Format Character

Wiki_fmt.vdm macro opens a dialog box, from where you can select one of the following character format options:
Bold, Italics, Bold Italics, Strike, Code, Pre, Super, Sub, Small, Font, Span.
If you select "Font", another dialog box opens for selecting font family, size and color.
If you select "Span", the parameter "class" is included for formatting with CSS.
The selected format option is then inserted in the file, using Wiki marking if available, or HTML marking if not. If a block is highlighted, the the tags are inserted around the block.
This macro is run when you select "Format character" from the WikiTags menu.

Link, Image

Wiki_fmt.vdm macro file contains additional functions that are executed by calling a label.

Link (internal)
Label  int_link is called when you select "Link (internal)" from WikiTags menu. Adds an internal link at current cursor location. A dialog box opens for entering the link target (page name) and optional link text. If a block was highlighted when this function was called, the highlighted text will be filled as default link text. If the cursor is inside existing link tag, the link target and link text are filled in the dialog. If link text is not entered, the page name is used as link text.

External link
Label  ext_link is called when you select "External link" from WikiTags menu. Adds an external link (link to outside the wiki) at current cursor location. A dialog box opens for entering the URL and optional link text. If a block was highlighted when this function was called, the highlighted text will be filled as default link text or, if the text is detected as an URL, as default URL. If the cursor is inside existing link tag, the link target and link text are filled in the dialog.

Image

Note: if you select "Link (internal)" when the cursor is inside existing external link tag, or vice versa, the dialog for that link type is opened instead of the link type you selected.

Image
Label  image_tag is called when you select "Image" from WikiTags menu. Inserts an image at cursor location. A dialog box open for entering image parameters. If the cursor is inside an existing image tag, the dialog is filled with the parameters of that tag, and the macro only updates the existing tag.

The following parameters can be entered:


List, Indent

Wiki_lst.vdm macro is used to insert a list or to convert existing text into list using wiki pseudo HTML marking. In addition, this file implements other wiki operations by calling labels, see below.

List...
This macro is called when you select "List..." from WikiTags menu. If no block is highlighted, adds level 1 list tag (character '*') at the beginning of current line. If a block is highlighted, a dialog box opens for selecting the list nesting level to be added on each line.

Indent
Label  indent is called when you select "Indent" from WikiTags menu. Adds indenting on wiki page by adding ':' character(s) at the beginning of the line. (This is typically used on talk pages) If no block is highlighted, adds one more level of indenting on current line. If a block is highlighted, a dialog box opens for selecting the amount of indenting to add on each line (in addition to any existing indent).

Tables

Insert table dialog box

Wiki_tbl.vdm contains functions for adding new table, for converting text into table and for adding/removing/copying columns in an existing table.

Table...
When the macro is called without label, it creates a new wiki table (or HTML table) element. This function is performed when you select "Table..." from WikiTags menu.
If there is no block highlighted, a new table is inserted. A dialog box opens where you can choose table type, number of rows and columns, and options for headings and borders.
If a block is highlighted, each line in the block will be converted into one table row. In this case, the dialog box allows you to choose the table column separator. The macro tries to automatically detect some of the most common separators (comma, semicolon or TAB) and set that as default in the dialog.

table Row, table Cell
After a table has been inserted, you can add more rows and columns by selecting "table Row" or "table Cell" from the WikiTools menu.

Edit columns...
Label  EDIT_COLUMNS is called when you select "Edit columns..." from WikiTags menu.
Before calling this function, you must place the cursor on the column you want to edit (on any row of the table). A dialog box opens for selecting the operation. You can select Copy, Cut, Paste or Add. In addition, you can select the number of lines processed, default = 1.

You can paste the copied column(s) as a new table by using the normal "Paste clipboard" command (Ctrl-V). The new table will have the same properties as the one where the columns were copied from.

Headings (Outline)

Wiki_outline.vdm macro is called when you select "Headings (Outline)" from W-User menu.

This is similar to the C Function Select macro. It opens a window to display list of Wiki headings in your source file. You can then use cursor keys to choose a heading, and then press Enter to go to the heading location in the source file, or press Esc to cancel. You can use cursor left/right to display the heading location in the file but stay in the list. If you press esc, you will return to the original location.

Setup

Wiki_tools_setup.vdm macro can be used to quickly setup Vedit for wiki editing.
It loads the User and Tools menus and keyboard configuration and sets some settings. In addition, it loads wiki.syn file for current file.

Installing Wiki Tools

Installing Wiki Tools is simple. Just unzip the files in your user-mac directory and then run the macro wiki_tools_setup.vdm. Additionally, you may want to save file type specific configuration for wiki files, and create a project for your wiki editing.

Wiki_tools.txt file included with the package contains more detailed instructions for installing the tools. In addition, it contains information for setting up It's All Text! Firefox plugin to work with Vedit.