Re: [Zope3-Users] emacs with metal and tal namespaces

2006-10-30 Thread Fred Drake

On 10/29/06, Perry Smith [EMAIL PROTECTED] wrote:

But since emacs seems to be happy and not really do any checking, can
you suggest a way to test whatever I come up with?  If not, I'll
browse the net some more to see what I can find.


If you're only concerned about what Emacs does, then you're all set.
I've been testing documents using jing and oXygen recently; oXygen may
be using jing itself.


 -Fred

--
Fred L. Drake, Jr.fdrake at gmail.com
Every sin is the result of a collaboration. --Lucius Annaeus Seneca
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] emacs with metal and tal namespaces

2006-10-29 Thread Perry Smith
On Oct 24, 2006, at 1:51 PM, Fred Drake wrote:On 10/24/06, Perry Smith [EMAIL PROTECTED] wrote: I am using nxml-mode in GNU emacs to edit the zcml files as well as pagetemplate files.  I picked up the schema for zcml.  All that works fine.  Hasanyone done a schema for the metal and tal name spaces? I'm not aware of one being done.  This would be a welcome contribution.I got up today ready to tackle this.  But, I may have succeeded by finding a trivial solution or I may have utterly failed.To quickly get to the gist, if you add the namespace definitions in the first tag, then the nxml-mode in emacs is content.  I have an example of this at the end of this note.I bumped into two problems that stumped me.  First, it is general practice to do:metal:arbitrary_tag define-macro="page"  .../metal:arbitrary_tagSecond, metal and tal constructs are attributes that are placed inside any tag.The schema specifications imply that things are very strict.  Zope and the key to the tag attributes is that these attributes can be put into the xml documents, effectively violate the base schemas, but since no one is checking, they produce the desired results.  (Also, I have not looked but probably by the time the document is sent out, all the tal and metal attributes have been stripped.)So, to really do this properly, each schema that the tal or metal are going to be used in would need to be modified to allow the tal and metal attributes.  The RNC syntax does have a funny include construct that allows overriding constructs that are defined in the included file.  But, that only means that it would be possible to create a maintenance nightmare if someone wanted to do that.Fortunately, the emacs checker is as simple as all the other checkers.  I discovered that I only need to change this:metal:block    define-macro="page"  html      xmlns="http://www.w3.org/1999/xhtml"      xml:lang="en"      lang="en" ...  /html/metal:block(which emacs does not like) To this:metal:block    xmlns:metal="http://xml.zope.org/namespaces/metal"    xmlns:tal="http://xml.zope.org/namespaces/tal"    define-macro="page"  html      xmlns="http://www.w3.org/1999/xhtml"      xml:lang="en"      lang="en" ...  /html/metal:blockWhich is probably a good idea anyhow.  Maybe the first example is frowned upon.  I got it from various tutorials.  But, as we can see, the namespace of metal and tal is never defined in the examples that I've been looking at.I hope this helps.Perry SmithEase Software, Inc.[EMAIL PROTECTED]http://www.easesoftware.comSATA Products for IBMs RS/6000, pSeries, and AIX systems ___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] emacs with metal and tal namespaces

2006-10-29 Thread Fred Drake

On 10/29/06, Perry Smith [EMAIL PROTECTED] wrote:

I bumped into two problems that stumped me.  First, it is general practice
to do:

metal:arbitrary_tag define-macro=page


Constructs for this can be written in RELAX NG, but I've not tried
doing that myself though.  The Atom specification includes an example
for elements in the XHTML namespace.


Second, metal and tal constructs are attributes that are placed inside any
tag.

...

So, to really do this properly, each schema that the tal or metal are going
to be used in would need to be modified to allow the tal and metal
attributes.  The RNC syntax does have a funny include construct that allows
overriding constructs that are defined in the included file.  But, that only
means that it would be possible to create a maintenance nightmare if someone
wanted to do that.


Almost; it really depends on the how the base schemas are written.
They can be written to cooperate with extending or specializing
schemas.  There are examples in the RELAX NG tutorials.  It does
require that the base schemas be written with that expectation, just
like classes need to be written to expect subclassing.


Which is probably a good idea anyhow.  Maybe the first example is frowned
upon.  I got it from various tutorials.  But, as we can see, the namespace
of metal and tal is never defined in the examples that I've been looking at.


That's definately a good idea to do anyway.

The TAL parser has two modes: HTML, and XML.  The HTML mode just
assumes the namespace declarations for tal:, metal:, and i18n:, though
it will honor declarations within the document properly.  The XML mode
makes no assumptions about the namespaces and requires proper
declarations in the templates.  It's unfortunate that triggering the
right mode is still a bit of black magic.  :-(

The fdrake-anguenot_better_xml_support_for_pt branch of Zope 3
includes a couple of different features.  The first is a unification
of the HTML and XML modes, so that input is always process as
XML/XHTML, and output can be generated for HTML, XHTML, or general
XML; that's not complete.  The second is some improved encoding and
mode detection support that Julien wrote after we'd discussed
approaches.  One of our ideas was to introduce a .xpt extension for
templates present on the filesystem that always triggered the
XHTML/XML mode.  Perhaps it would be worth pulling that feature out
and adding it on the trunk.


 -Fred

--
Fred L. Drake, Jr.fdrake at gmail.com
Every sin is the result of a collaboration. --Lucius Annaeus Seneca
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] emacs with metal and tal namespaces

2006-10-29 Thread Perry Smith


On Oct 29, 2006, at 10:43 AM, Fred Drake wrote:


On 10/29/06, Perry Smith [EMAIL PROTECTED] wrote:
I bumped into two problems that stumped me.  First, it is general  
practice

to do:

metal:arbitrary_tag define-macro=page


Constructs for this can be written in RELAX NG, but I've not tried
doing that myself though.  The Atom specification includes an example
for elements in the XHTML namespace.


It is simple to have specify a tag like metal:* where anything can  
follow.  But I did not see the benefit to that.




Second, metal and tal constructs are attributes that are placed  
inside any

tag.

...
So, to really do this properly, each schema that the tal or metal  
are going

to be used in would need to be modified to allow the tal and metal
attributes.  The RNC syntax does have a funny include construct  
that allows
overriding constructs that are defined in the included file.  But,  
that only
means that it would be possible to create a maintenance nightmare  
if someone

wanted to do that.


Almost; it really depends on the how the base schemas are written.
They can be written to cooperate with extending or specializing
schemas.  There are examples in the RELAX NG tutorials.  It does
require that the base schemas be written with that expectation, just
like classes need to be written to expect subclassing.


Yes.  thats true.  The samples I have for xhtml did not seem to have  
that.  For example, in my xhtml, the title element allowed the  
xml:lang attribute and nothing else.  I got my samples from the nxml  
emacs package.


But, I think I can still do some useful work here.

I can create a rnc for metal and tal.  It can have hooks to let  
people add to the list of tags (which solves the first problem) and  
it could create a list (or two lists) of attributes that future  
schema writers could add into their schema.


Aside from xhtml and zcml, (for 99% of the usage), what is the list  
of base schemas people are going to add metal and tal attributes to?


It also sounds like I need to look at the tutorials.  I was just look  
at the spec.  Maybe there are conventions that I missed.


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] emacs with metal and tal namespaces

2006-10-29 Thread Perry Smith
I think I'm going to attack this again.  The xhtml rnc I have has  
foo.attlist for each tag that I can append to.


But since emacs seems to be happy and not really do any checking, can  
you suggest a way to test whatever I come up with?  If not, I'll  
browse the net some more to see what I can find.


Thanks,
Perry

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users