[ZPT] creating a definition list with tal

2006-04-19 Thread gf
Hi,
I am having difficulties constructing a definition list using tal. I
have searched for relevant information, but have not found anything
useful.

I have a python script 'get_subfolder_info' that returns a list of
dictionaries containing subfolder information [{url1,summary1,alias1},
 {url2,summary2,alias2}, ...]

I would like to create something like the following:
dl
dta href=url1alias1/a/dt
ddsummary1/dd
dta href=url2alias2/a/dt
ddsummary2/dd
...
/dl

Below I have listed a couple of the variations of code that I have tried.

I'd appreciate any help or advice you can give.

Regards,
gyro

===

The following creates repeated definition lists:

---

dl tal:define=folder_info get_subfolder_info
tal:repeat=finfo folder_info
dta tal:attributes=href finfo/url
   tal:content=finfo/aliasthe term/a/dt
dd tal:content=finfo/summarythe definition/dd
/dl

---

If I include a 'span' to repeat only the dt and dd tagged elements,
the list is not formatted properly (the 'span' messes up the 'dd'
formatting).

dl tal:define=folder_info get_subfolder_info
span tal:repeat=finfo folder_info
dta tal:attributes=href finfo/url
   tal:content=finfo/aliasthe term/a/dt
dd tal:content=finfo/summarythe definition/dd
/span
/dl
___
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt


Re: [ZPT] creating a definition list with tal

2006-04-19 Thread gf
On 4/19/06, Andreas Jung [EMAIL PROTECTED] wrote:


 --On 19. April 2006 08:39:37 -0600 gf [EMAIL PROTECTED] wrote:

   {url2,summary2,alias2}, ...]
 
  I would like to create something like the following:
  dl
  dta href=url1alias1/a/dt
  ddsummary1/dd
  dta href=url2alias2/a/dt
  ddsummary2/dd
  ...
  /dl
 
  Below I have listed a couple of the variations of code that I have tried.
 
  I'd appreciate any help or advice you can give.
 
  Regards,
  gyro
 
  ===
 
  The following creates repeated definition lists:
 
  ---
 
  dl tal:define=folder_info get_subfolder_info
  tal:repeat=finfo folder_info
  dta tal:attributes=href finfo/url
 tal:content=finfo/aliasthe term/a/dt
  dd tal:content=finfo/summarythe definition/dd
  /dl
 

 Move the ral:repeat *inside* the DT tag.

  ---
 
  If I include a 'span' to repeat only the dt and dd tagged elements,
  the list is not formatted properly (the 'span' messes up the 'dd'
  formatting).

 In this case tal:omit-tag is your friend...as documented.

 -aj



Thank you, Andreas!
That was a great help.

Best Regards,
gyro
___
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt


[ZPT] Re: creating a definition list with tal

2006-04-19 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

gf wrote:
 On 4/19/06, Andreas Jung [EMAIL PROTECTED] wrote:
 

--On 19. April 2006 08:39:37 -0600 gf [EMAIL PROTECTED] wrote:


 {url2,summary2,alias2}, ...]

I would like to create something like the following:
dl
dta href=url1alias1/a/dt
ddsummary1/dd
dta href=url2alias2/a/dt
ddsummary2/dd
...
/dl

Below I have listed a couple of the variations of code that I have tried.

I'd appreciate any help or advice you can give.

Regards,
gyro

===

The following creates repeated definition lists:

---

dl tal:define=folder_info get_subfolder_info
tal:repeat=finfo folder_info
dta tal:attributes=href finfo/url
   tal:content=finfo/aliasthe term/a/dt
dd tal:content=finfo/summarythe definition/dd
/dl

Move the ral:repeat *inside* the DT tag.


---

If I include a 'span' to repeat only the dt and dd tagged elements,
the list is not formatted properly (the 'span' messes up the 'dd'
formatting).

In this case tal:omit-tag is your friend...as documented.

Another common practice is to introduce an element in the 'tal'
namespace to group the repeated elements;  such tags are automatically
omitted when rendered.  E.g.:

  dl
   tal:loop tal:repeat=finfo folder_info
dta tal:attributes=href finfo/url
   tal:content=finfo/aliasTHE_TERM/a/dt
dd tal:content=finfo/summaryTHE_DEFINITION/dd
   /tal:loop
  /dl

This technique has the advantage of not confusing tools which think they
know what the correct content model for 'span' is (of course, they
need to be willing to ignore elements from unknown namespaces).


Tres.
- --
===
Tres Seaver  +1 202-558-7113  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFERpch+gerLs4ltQ4RAp4yAJ4sQbJ1XI80t2ti7IcpoJudpKcM3QCdGBct
bEjpsNATepGe3SHVmcAW25Y=
=jTi4
-END PGP SIGNATURE-
___
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt


[ZPT] Re: creating a definition list with tal

2006-04-19 Thread gf
On 4/19/06, Tres Seaver [EMAIL PROTECTED] wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 gf wrote:
  On 4/19/06, Andreas Jung [EMAIL PROTECTED] wrote:
 
 
 --On 19. April 2006 08:39:37 -0600 gf [EMAIL PROTECTED] wrote:
 
 
  {url2,summary2,alias2}, ...]
 
 I would like to create something like the following:
 dl
 dta href=url1alias1/a/dt
 ddsummary1/dd
 dta href=url2alias2/a/dt
 ddsummary2/dd
 ...
 /dl
 
 Below I have listed a couple of the variations of code that I have tried.
 
 I'd appreciate any help or advice you can give.
 
 Regards,
 gyro
 
 ===
 
 The following creates repeated definition lists:
 
 ---
 
 dl tal:define=folder_info get_subfolder_info
 tal:repeat=finfo folder_info
 dta tal:attributes=href finfo/url
tal:content=finfo/aliasthe term/a/dt
 dd tal:content=finfo/summarythe definition/dd
 /dl
 
 Move the ral:repeat *inside* the DT tag.
 
 
 ---
 
 If I include a 'span' to repeat only the dt and dd tagged elements,
 the list is not formatted properly (the 'span' messes up the 'dd'
 formatting).
 
 In this case tal:omit-tag is your friend...as documented.

 Another common practice is to introduce an element in the 'tal'
 namespace to group the repeated elements;  such tags are automatically
 omitted when rendered.  E.g.:

   dl
tal:loop tal:repeat=finfo folder_info
 dta tal:attributes=href finfo/url
tal:content=finfo/aliasTHE_TERM/a/dt
 dd tal:content=finfo/summaryTHE_DEFINITION/dd
/tal:loop
   /dl

 This technique has the advantage of not confusing tools which think they
 know what the correct content model for 'span' is (of course, they
 need to be willing to ignore elements from unknown namespaces).


 Tres.
 - --


Hi Tres,
Thanks for the great idea!

I'm a zpt and zope newbie, so please forgive my ignorance. Does what
you recommended mean that if I have no need for a 'real' tag, I can
create and use a 'tal'-based tag like you did in your example? Does
the element 'loop' have any special meaning?

It seems as if using 'div's and 'span's just to hold tal directives is
not a great idea (even if they can be 'omit-tag'ged away), or am I
missing something?

Although I am reading as much as I can about zpt, I seem to be missing
a lot of important stuff.

Cheers,
gyro
___
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt


[ZPT] Re: creating a definition list with tal

2006-04-19 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

gf wrote:

 On 4/19/06, Tres Seaver [EMAIL PROTECTED] wrote:

Another common practice is to introduce an element in the 'tal'
namespace to group the repeated elements;  such tags are automatically
omitted when rendered.  E.g.:

  dl
   tal:loop tal:repeat=finfo folder_info
dta tal:attributes=href finfo/url
   tal:content=finfo/aliasTHE_TERM/a/dt
dd tal:content=finfo/summaryTHE_DEFINITION/dd
   /tal:loop
  /dl

snip

 I'm a zpt and zope newbie, so please forgive my ignorance. Does what
 you recommended mean that if I have no need for a 'real' tag, I can
 create and use a 'tal'-based tag like you did in your example? Does
 the element 'loop' have any special meaning?

Nope, it merely indicates the purpose.

 It seems as if using 'div's and 'span's just to hold tal directives is
 not a great idea (even if they can be 'omit-tag'ged away), or am I
 missing something?

I generally avoid 'omit-tag', mostly because real HTML elemets which
are present in the template but not the output can cause CSS to render
differently.  It is more a matter of taste than anything else.


Tres.
- --
===
Tres Seaver  +1 202-558-7113  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFERqMQ+gerLs4ltQ4RAj/fAKCDo5yjA2LQo8/mbHjuuE/QuydC5wCgzjp6
OgwgCEqEkdGZY9XRmv6sllA=
=lZM7
-END PGP SIGNATURE-
___
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt