Personal tools

Editing LZX

From OpenLaszlo

Contents

Eclipse

Use IDE4Laszlo, of course! Add your notes and feedback IDE4Laszlo.

If you don't want to install IDE4Laszlo you can use PlainEclipse for editing.

Emacs

nxml-mode

nxml-mode is an xml-aware editor mode for GNUEmacs that uses a RELAX NG schemas file to add keyword completion and incremental validation.

Add the schema locator file in Laszlo Presentation Server/Server/lps-*/tools/nxml-schemas.xml. For example, put this in your emacs .init file:

 (setq auto-mode-alist
     (cons '("\\.\\(lzx\\|dbk\\|xml\\|xsl\\|xslt\\|rng\\)\\'" . nxml-mode)
           auto-mode-alist))
 
 (setq rng-schema-locating-files
     (append
      (list (substitute-env-vars "/path/to/lps/Server/lps-2.2/tools/nxml-schemas.xml"))
      rng-schema-locating-files))

psgml-mode and mmm-mode=

See the Developer's Guide.

IntelliJ

Configuring with a DTD

See the instructions on laszlosystems.com. Those instructions may supplant everything here.

In IDE Settings > Resources Add to the top pane (External Resources):

 URI: http://www.laszlosystems.com/lzx.dtd
 Path: c:\lzx.dtd.xml

(note: local path *must* end in .xml)

Begin your file with:

 <!DOCTYPE canvas PUBLIC "LZX" "http://www.laszlosystems.com/lzx.dtd" >

Notice that code hinting is provided for schema types. Notice that code hinting is no longer provider for user defined types that have previously been used in the file :(

VIM

Adam Wolff maintains a syntax file for lzx. Ask for //depot/adam/sandbox/lzx.vim.

Installing VIM Syntax Highlighting

Not a VIM/Linux ninja? No problem, these instructions successfully install VIM highlighting for Ubuntu Linux Hardy Heron (8.04) and VIM 7.1 .

Installation for other OSes (and other versions of VIM) should be very similar.

Note: this installs OpenLaszlo syntax highlighting globally


Get a copy of lzx.vim and place it in the appropriate directory (do not put this in $VIM/vimcurrent or $VIM/vim[version_number], these directories may be overwritten by your package manager)

cd /etc/vim/
sudo mkdir syntax
cd syntax
sudo wget http://www.openlaszlo.org/lps/tools/lzx.vim

edit global VIM settings so VIM correctly identifies .lzx files

cd ..
sudo vim vimrc

add the line

au BufRead,BufNewFile *.lzx set filetype=lzx

Optional: Highlight syntax for all files by default

If not changed, you will need to issue the command

:syntax enable

in VIM each time you open a file you desire to be highlighted.

Make highlighting the default: add or uncomment (VIM uses double quotes " as the comment symbol) the following line

syntax on

Marks and cursor position

`[[mark]

will jump you to the appropriate column where the mark was set

'[[mark]

will only jump you to the beginning of the correct line.

Also, the mark "[" is set to the point where you last entered insert mode. I often have the problem that I want to leave insert mode where editing began. I can now do this with the following remapping

   imap � <ESC>`[

Now, if I hit control-D in insert mode, I leave where I entered the insert mode.

Even more useful is the ability to repeat a previous command without changing the cursor position. Since this is pretty much always the behavior I want, I remapped ".", but you could use some other combination.

   noremap . .`[

XML Spy

Professional Edition

  1. Launch XmlSpy
  2. Go to Tools -> Options
  3. On the "File" tab, uncheck "Validate upon opening file" and uncheck "Validate upon saving file" in the Validation group box.
  4. On the "File Types" tab, add the .LZX file extension. In the XML Conformance group box, select DTD.
  5. This step is optional, In the "View" tab uncheck Word Wrap.
  6. Click OK.
  7. Go to Project -> New Project
  8. In the Project panel, right click on the New Project and select "Properties..."
  9. In the "Validation" group box, browse to the Laszlo DTD. Typically, it might be in: "C:\Program Files\Laszlo Presentation Server 2.2.1\Server\lps-2.2.1\tools\lzx.dtd" - either way, the name of the file is "lzx.dtd"
  10. Click OK.

Home Edition

Complete steps 1 through 3. For step 4 select XML instead of DTD. Now complete steps 5 and six. The Home edition doesn’t have a Project menu so steps 7 through 10 don’t apply. The Home edition will now ask you for a DTD whenever you open a new file. It is somewhat cumbersome, but it’s also free.