Forum OpenACS Development: Beta Emacs OACS module available

Collapse
Posted by Bart Teeuwisse on
OpenACS lacked a good Integrated Development Environment and as I use Emacs for almost everything it was only natural to fill the void. The Emacs OACS module is an extension to GNU Emacs, the extensible, customizable, self-documenting real-time display editor.

Emacs OACS is available to early adopters and OpenACS developers using Emacs. The latest version of Emacs OACS is always available from:

    http://www.thecodemill.biz/services/oacs/

Collapse
Posted by Andrei Popov on
Would it require much work to get rid of psgml-mode and move it on to nxml-mode http://www.xmlhack.com/read.php?item=2061?
Collapse
Posted by Bart Teeuwisse on
Andrei,

the Emacs OACS module uses DTDs to assist the creation of HTML , ADP and XQL files. While nXML has support of XHTML and DOCBOOK, the XQL DTD certainly has to be rewritten and I'm not sure about Relax NG definitions for the various HTML flavors.

I don't know how much work would be involved to replace PSGML with nXML as I've never used nXML. Maybe you can explain the benefits?

Feel free to submit patches too. While it is possible to replace PSGML with nXML it is currently not on my To Do list.

/Bart

Collapse
Posted by Joel Aufrecht on
nxml does real-time syntax and error highlighting.  Compared to psgml, it's like writing xml in broad daylight vs using a candle.  Maybe you can get psgml to do much of the same but I got more functionality out of nxml in 2 days than out of psgml in 2 years.
Collapse
Posted by Mark Aufflick on
Joel, do you have any nxml with oacs tips to share?
Collapse
Posted by Joel Aufrecht on
No, I haven't tried to get that working yet.  Actually I haven't really gotten very far with oacs.el - I got it installed and not causing errors, and sometimes it surprises me by pre-populating new files, but I don't really know what it can do.  I suppose I'll have to walk through Bart's notes and turn them into documentation.
Collapse
Posted by Bart Teeuwisse on
Emacs OACS is now also available as a GNU Arch (http://wiki.gnuarch.org/) archive. For details and archive location see http://www.thecodemill.biz/services/oacs/.

/Bart

Collapse
Posted by Andrei Popov on
Bart,

It's a bit tough to give much in terms of pros and contras od nXML vs. PSGML -- when editing large documents I do prefer the former, but largely due to periffery, e.g. Norman Walsh's unichars/xmlunicode that allows to just type EM dash, instead of putting in —.  I don't suppose on-the-fly parsing and validation is very critical for XQLs.

On the flip side, named entities are not supported in nXML the same way as you may be used to with PSGML, i.e. if you declare ENTITY OACS somewhere in the topmost file of your DocBook project (cross referenced in PSGML way via parent-doc), nXML won't understand it, and hence will claim your doc to be invalid.

It will probably be a bit tough, and may in fact require some rework in Templating and possibly other core parts of OpenACS to make ADPs into a valid XML.  In particular, I am not sure how to make @vars@ accpetible as attributes in <if> tags -- I don't think XML allows '@' in the name of an attribute.

The reason for my question was more related to a (selfish) fact that I've ripped PSGML out from my .emacs 3-4 months ago, and am not very much inclined putting it back...  I'll have a look at xhtml.rnc of nXML to see if it can be hammered into validating ADPs.

Lastly, I think that James Clark has a tool that does DTD->RNG transform, hence having valid ADP and XQL DTD, it may be fairly trivial to create a basic RNG schema...  Yeah, here: http://www.thaiopensource.com/relaxng/trang.html

Collapse
Posted by Talli Somekh on
Andrei said: "It will probably be a bit tough, and may in fact require some rework in Templating and possibly other core parts of OpenACS to make ADPs into a valid XML. In particular, I am not sure how to make @vars@ accpetible as attributes in if tags -- I don't think XML allows '@' in the name of an attribute."

I wonder if it wouldn't be worthwhile, though? The reason I ask is not to achieve buzzword compliance but in order to plug the OATS into something like Dreamweaver as an extension. (In my very perfuctory glance, it seems that Dreamweaver extensions are XML files of some sort.)

Are there any other potential gains in fulfilling Andrei's idea that would outweigh the pain of reworking the system?

talli

Collapse
Posted by Andrei Popov on
I don't think it would require a rework as such -- what I am saying is that ADPs are not valid XML files, that is all.  There might be a way (or there may be none) to shut off nXML's validation of @@'s.  If there is no way -- well, so be it.

The only benefit I see, is that if your template validates, then there is a greater chance that generated page would validate as well.  Otherwise -- see my old post (https://openacs.org/forums/message-view?message_id=118033) about how compliant OACS is (was? will check) with even basic requirements (like quoting of attribute values and absence of open-ended tags).

Collapse
Posted by Andrei Popov on

As included in openacs-5.0.0 tarball:

  • Total number of ADPs: 323
  • Unquotes attribute values: 127 files, 452 lines
  • <[BH]R> instead of <[bh]r />: 62 files, 134 lines
  • FONT tag use: 35 files, 63 lines
  • Capitalised tags: 2 files; yay! let's list them hereinbelow:
    • ./acs-admin/www/users/index.adp
    • ./acs-subsite/www/shared/iso-codes-no-exist.adp

Note, that this is only in core packages.

Collapse
Posted by Jeff Davis on
One really big advantage to moving to .adp's that validate as xml is that there are a number of bugs that are not diagnosed very well when the adp is malformed (eg an unclosed multiple tag produces a not very intuitive error). Having the adp's validate would make automated testing for that sort of error straightforward.

On the other hand, dreamweaver will work just fine even if they are not well formed xml (although maybe this has changed since version 4 which was the last time I worked with designers who used it).

I think it would be pretty straightforward to fix the most common things (singleton tags, attribute quoting, and case would be most of it), but <if> tags and the nesting of adp tags inside html tags (like on the body tag in the master template) would be problematic.

quoting everything and fixing case can be done w/o discussion, but we would have to have a TIP for the other required changes and while I would vote yes for such a change I am not sure other people would.

Collapse
Posted by Andrei Popov on

I have done xql.dtd -> xql.rnc transform, since it is relatively small, I am listing it below. This was done using James Clark's Trang.

# =============================================================

# XQL query file definition

# =============================================================

# Query Set

# SQL query set

queryset =
  element queryset {
    attlist.queryset, rdbms?, (fullquery | partialquery)*
  }
attlist.queryset &= empty
# RDBMS

# Relational Database Management System
rdbms = element rdbms { attlist.rdbms, type, version }
attlist.rdbms &= empty
# Database Type

# RDBMS type e.g. oracle or postgresql
type = element type { attlist.type, text }
attlist.type &= empty
# Database Version

# RDBMS version e.g. 7.1
version = element version { attlist.version, text }
attlist.version &= empty
# Fullquery

# Full SQL query
fullquery = element fullquery { attlist.fullquery, querytext }
# name       Query name
attlist.fullquery &= attribute name { text }
# Partialquery

# Partial SQL query
partialquery = element partialquery { attlist.partialquery, querytext }
# name       Query name
attlist.partialquery &= attribute name { text }
# Querytext

# SQL query text
querytext = element querytext { attlist.querytext, text }
attlist.querytext &= empty
Collapse
Posted by Andrei Popov on
oops, too fast. :))

Missed one more para: I have checked the above .rnc and it works perfectly, inclusing completions (not that there are many, but still...).

Collapse
Posted by Bart Teeuwisse on
Andrei,

I've factored out the various components to Emacs OACS into separate files. It shouldn't be too hard to add support for nXML in addition to PSGML. Users could then select which XML mode they would like to install and use.

Emacs OACS relies on PSGML only for the XML editing capabilties. There are no direct calls to PSGML functions from Emacs OACS.

/Bart

Collapse
Posted by Andrei Popov on
Bart,

This is cool, thanks.  I guess, since ADP has never been (and could probably never be) a subset of XML -- it's ok if it stays unvalidatable (gee, I just love new Konqueror's on-the-fly spell checking -- as expected there's no such word as the one immediately before the bracket 😊 )...

Collapse
Posted by Bart Teeuwisse on
An update of Emacs OACS is available from http://www.thecodemill.biz/services/oacs/.

GNU Arch users can use:

  tla grab http://www.thecodemill.biz/repository/grabs/oacs

Tarball is available from:

  http://www.thecodemill.biz/repository/oacs.tgz

For changes see:
          http://www.thecodemill.biz/services/oacs/changelog/index?revision_id=10006

/Bart

Collapse
Posted by Andrei Popov on
Bart,

tla get returns 404 error:

% tla get -A mailto:bart-arch@thecodemill.biz--2004 oacs--devo--1.0 oacs
webdav error: 404 Not Found

Collapse
Posted by Bart Teeuwisse on
Andrei,

that you must have made a mistake registering the location of the mailto:bart-arch@thecodemill.biz--2004 archive. (I just verified the webdav public archive.)

See http://www.thecodemill.biz/services/oacs/ for instructions how to register. Please note that each step should be entered as a single line.

/Bart

Collapse
Posted by Andrei Popov on

Bart,

Step-by-step:

% tla register-archive bart-arch@thecodemill.biz--2004 http://www.thecodemill.biz/repository/{archives}/2004/
% tla get -A bart-arch@thecodemill.biz--2004 oacs--devo--1.0 oacs
webdav error: 404 Not Found

The same happens on 2 machines: a FreeBSD and a Mac OS X.

Collapse
Posted by Bart Teeuwisse on
Andrei,

I don't know what to say. I do know that -besides myself- others are accessing the webdav archive succesfully. Also tla isn't very good w/ error messages, it could be any number of things. Maybe you can verify that another webdav client -like cadaver- can access http://www.thecodemill.biz/repository/{archives}/2004/ ?

Anyone on either FreeBSD or Mac OS X who can access http://www.thecodemill.biz/repository/{archives}/2004/ ?

/Bart

Collapse
Posted by Andrei Popov on
  • lynx:
                                                                                          Not Found 
                                                                                                                                          
    Not Found                                                                                                                                                                                                                          
       The requested URL was not found on this server.                                                                                    
                                                                                                                                          
                                 AOLserver/4.1.0 on http://www.thecodemill.biz       
    
  • Mac OS X Finder (that can mount WebDAV shares): server cannot be found on the network
  • Safari: shows empty dir
  • cadaver:
    > cadaver http://www.thecodemill.biz/repository/{archives}/2004/
    Could not contact server:
    404 Not Found
    dav:!>
    
Collapse
Posted by Andrei Popov on

I think there might be something wicked going on, because of curly braces...

Collapse
Posted by Jeff Davis on
I just tried with cadaver and it worked fine for me...
cadaver http://www.thecodemill.biz/repository/{archives}/2004/
dav:/repository/{archives}/2004/> ls
Listing collection `/repository/{archives}/2004/': succeeded.
Coll:   =meta-info                           128  Feb 10 04:17
Coll:   bin                                   80  Mar  3 19:48
Coll:   cache-control                         88  Mar  9 01:55
Coll:   oacs                                  80  Feb 10 04:18
Coll:   pound                                144  Feb 13 18:54
dav:/repository/{archives}/2004/>
Connection to `www.thecodemill.biz' closed.
Collapse
Posted by Bart Teeuwisse on
Andrei,

wicked indeed. If I'm not mistaken you are on 212.20.105.205. Requests from this IP address leave the curly brackets out. While all requests from other IP addresses do include them.

/Bart

Collapse
Posted by Andrei Popov on
I've edited .arch-params/=locations/bart-arch@thecodemil.biz--2004 to add braces and all was well.  For some reason braces got stripped.  Will see whether this is tcsh's fault or else...
Collapse
Posted by Bart Teeuwisse on
Andrei,

like nXML PSGML has problems with @vars@ too. Another structural problem with ADPs is that the use of 'if tags' leads to invalid XML. Often 'if tags' are used to conditionally open or close a (X)HTML tag.

This renders any attempt to get ADPs to qualify as valid impossible I would think.

I'll take a look at nXML when I find the time.

/Bart

Collapse
Posted by Andrei Popov on
Just thinking out loud a little further -- XSL is a valid XML and they do include conditionals...

But this is probably too much of a deviation from the topic of this thread.

Collapse
Posted by Andrei Popov on

It is a wicked curly brace! And there's been a lengthy discussion on gnu-arch-users list about the WHYs and the HOWs of ++/=/,,/{ in arch-land. Tcsh does consider it to be a significant character and {arch} becomes plain arch, once expanded (similar to echo pen{,cil} having to produce a list of pen pencil). Quoting or escaping does help, but one needs to remove ~/.arch-params/=locations/bart-arch@thecodemill.biz--2004 first.

Collapse
Posted by Benjamin Bytheway on
The curly braces are a problem, and there's no need for them in archive locations.  The only place curly braces are still mandatory are the in-tree {arch} directories.

The reason they still show up places, is the tutorial uses them in its example of how to set up tla archives.  I believe the tutorial will soon be changed to discourage this unecessary use of {}.