̾Á° WML Turorial - ¥¹¥Æ¥Ã¥×Êý¼°¤ÇWML¤òÍý²ò¤¹¤ë


ÀâÌÀ

¤³¤Î¥Á¥å¡¼¥È¥ê¥¢¥ë¤Ï¡¢WML¤Îµ¡Ç½¤Ë¤Ä¤¤¤Æ¾®¤µ¤Ê¥ì¥Ã¥¹¥ó¤Ë¶èÀڤäÆÀâÌÀ¤· ¤Æ¤æ¤¯¡£¤½¤ì¤¾¤ì¤Î¥ì¥Ã¥¹¥ó¤Ç¤Ï¡¢WML¤ÎÆÃÄê¤Î»ö¹à¤äµ¡Ç½¤Ë¤Ä¤¤¤Æ¶µ¤¨¤ë¡£ ¥ì¥Ã¥¹¥ó¤Ï°×¤·¤¯Ê¿Ëޤʻö¤«¤é¡¢Æñ¤·¤¯Ê£»¨¤Ê»ö¤Þ¤Ç½çÈÖ¤Ëʤó¤Ç¤¤¤ë¡£


°ÅÌۤΥޡ¼¥¯¥¢¥Ã¥×½èÍý


LESSON: À¸¥Ç¡¼¥¿¤Î½èÍý

Input:

 1| foo
 2| <bar>
 3| quux

Output:

 1| foo
 2| <bar>
 3| quux

¤³¤ì¤Ï¡¢¥·¥ó¥Ü¥ë foo ¤â quux ¤â¡¢HTML ¥¿¥° <bar> ¤È¤·¤ÆÄêµÁ¤µ¤ì¤Æ ¤Ê¤«¤Ã¤¿»þ¤Îɸ½à¤Îưºî¤Ç¤¢¤ë¡£¤½¤·¤Æ¡¢ÉÔɬÍפʶõÇòʸ»ú¤¬¤³¤ÎÎã¤Ë¤Ï̵¤¤ ¤Î¤Ç¡¢ÆþÎϤ¬¤Ê¤ó¤Ç¤¢¤Ã¤Æ¤â¼è¤ê½ü¤«¤ì¤Ê¤¤¡£


LESSON: ¥Þ¡¼¥¯¥¢¥Ã¥×¥³¡¼¥É¤òÊݸ¤¹¤ë

»þ¡¹¡¢¤¤¤¯¤Ä¤«¤Î¥Þ¡¼¥¯¥¢¥Ã¥×¥³¡¼¥É¤ä¥Ú¡¼¥¸¤ÎÆâÍÆ¤¬¡¢WML ¤È½ÅÊ£¤¹¤ë¥¿¥° ̾Åù¤È¾×ÆÍ¤¹¤ë¤³¤È¤¬¤¢¤ë¡£°Ê²¼¤Ç¤Ï¡¢WML ¥¤¥ó¥¿¥×¥ê¥¿¤¬¡¢¼ÂºÝ¤Ë¤Ï²ò¼á¤· ¤Ê¤¤¤Ç¤Û¤·¤¤¤â¤Î¤ò²ò¼á¤¹¤ë¡£

Input:

 1| foo: foo.c
 2|    $(CC) -o foo foo.c

Output:

 1| foo: foo.c
 2|     -o foo foo.c

¤³¤ì¤Ï¡¢IPP ¤¬ make ¤Ë»÷¤¿ÊÑ¿ôÊä´°¤Îʸˡ¤ò»È¤¦¤¿¤á¡¢`$(CC)' ¤¬¶õÇò¤Ë Ÿ³«¤µ¤ì¤ë¤¿¤á¤Ç¤¢¤ë¡£Ìµ¸ú¤Ë¤¹¤ë¤Ë¤Ï¡¢½ÅÍפÊÉôʬ¤ò WML ÆâÉô¤Î <protect>¥³¥ó¥Æ¥Ê¥¿¥°¤Ç°Ï¤à¡£

Input:

 1| foo: foo.c
 2|    <protect>$(CC)</protect> -o foo foo.c

Output:

 1| foo: foo.c
 2|    $(CC) -o foo foo.c


LESSON: ¥Þ¡¼¥¯¥¢¥Ã¥×¥³¡¼¥É¤òÀÚ¤êµÍ¤á¤ë

¤µ¤Æ¡¢ÉÔɬÍפʶõÇò¤òºï¤ëÎãÂê¤ËÄ©À路¤Æ¤ß¤è¤¦¡£µ¤¤ò¤Ä¤±¤Ê¤±¤ì¤Ð¤¤¤±¤Ê¤¤ ¤Î¤Ï¡¢'ÉÔɬÍפÊ'¤È¤¤¤¦°ÕÌ£¤Ï¡¢¥Ö¥é¥¦¥¶¤ò¤ÎÃæ¤Ç Webpage ¤¬É½¼¨¤µ¤ì¤ë·ë²Ì ¤¬¡¢¸µ¤ÈƱ¤¸¤è¤¦¤Ë¤Ê¤ë¸Â¤êÀÚ¤êµÍ¤á¤ë¤È¤¤¤¦»ö¤Ç¤¢¤ë¡£

Input:

 1| <body>
 2| 
 3| <img src = "file.gif"    alt="  test  " >
 4| <pre>
 5|
 6|     Preformatted          Text  
 7| </pre>
 8|     Not    Preformatted   Text
 9| </body>

Output:

 1| <body>
 2| <img src="file.gif" alt=" test ">
 4| <pre>
 5|
 6|     Preformatted          Text  
 7| </pre>
 8|     Not Preformatted Text
 9| </body>

Æó¹ÔÌܤ¬ HTML ¤Ë¤ª¤¤¤Æ¤Ê¤ó¤Î°ÕÌ£¤â̵¤¤¶õ¹Ô¤Ê¤Î¤Ç¡¢´°Á´¤Ëºï½ü¤µ¤ì¤ë¡£ src °À­¤È¤½¤ÎÃͤδ֤ζõÇò¤âºï½ü¤µ¤ì¤ë¡£¤½¤·¤Æ¡¢Á´¤Æ¤ÎÆó¤Ä°Ê¾å¤Î¶õÇò ¤Ï°ì¤Ä¤Î¶õÇòʸ»ú¤ËÃÖ¤­´¹¤¨¤é¤ì¤ë¡£¤·¤«¤·¡¢À°·ÁºÑ¤ÎÈϰϤǤϤ½¤¦¤Ê¤é¤Ê¤¤¡£


LESSON: ¥Þ¡¼¥¯¥¢¥Ã¥×¥³¡¼¥É¤òÀ°¤¨¤ë

¤µ¤Æ¡¢500x400¥Ô¥¯¥»¥ë¤ÎÂ礭¤µ¤Î GIF ¥¤¥á¡¼¥¸ image.gif ¥Õ¥¡¥¤¥ë¤ò¡¢ ¥Ú¡¼¥¸¤Ë¤Ï¤ê¤Ä¤±¤ë¤È¤¹¤ë¡£

 1| <body>
 2| <center>
 3| <font color=336699>Headline:</font><br>
 4| <img src="image.gif">
 5| </center>
 6| </body>

¤³¤ì¤ÏÀµ¤·¤¤ HTML ¥³¡¼¥É¤À¤¬¡¢WML ¤Ï¤è¤ê¥Ý¡¼¥¿¥Ö¥ë¤Ë¡¢¥Ö¥é¥¦¥¶¤Îɽ¼¨ ®ÅÙ¤ò®¤¯¡¢¤½¤·¤Æ Lynx ¥æ¡¼¥¶¤¬¹¬Ê¡¤Ë¤Ê¤ë¤è¤¦¤Ë¡¢¤è¤ê¤è¤¯À°·Á¤¹¤ë ¤³¤È¤¬¤Ç¤­¤ë¡£¤½¤¦¡¢WML ¤Ï <img> ¥¿¥°¤òǧ¼±¤¹¤ë¤È¡¢¼«Æ°Åª¤Ë¤«¤±¤Æ ¤¤¤ë¾ðÊó¤òÄɲä·¡¢¤¹¤¿¤ì¤¿¥¿¥°¤òºÇ¿·¤Î¼ïÎà¤ËÃÖ¤­´¹¤¨¤ë¡£

 1| <body>
 2| <div align=center>
 3| <font color="#336699">Headline:</font><br>
 4| <img src="image.gif" alt="" width="500" height="400">
 5| </div>
 6| </body>

¸«¤Æ¤ÎÄ̤ꡢWML ¤Ï¤Þ¤º <center> ¥¿¥°¤ò HTML 3.2 ¤Î <div align=center> ¤ËÃÖ¤­´¹¤¨¤ë¡£¼¡¤Ë¡¢<font> ¤Î color °À­¤ò½¤Àµ¤¹ ¤ë¡£¤½¤·¤Æ¡¢·ç¤±¤Æ¤¤¤ë alt ¤È width/height °À­¤òÄɲ乤롣


¥Þ¡¼¥¯¥¢¥Ã¥×¥³¡¼¥É¤ò¹½Â¤²½¤¹¤ë


LESSON: ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤ò»È¤¦

WML ¤ÎºÇ¤âÊØÍø¤Êµ¡Ç½¤Î°ì¤Ä¤Ï¡¢¤è¤¯»È¤¦¤â¤Î¤ò¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤Ë¤·¡¢ ¸å¤«¤éÁªÂòŪ¤ËƳÆþ¤Ç¤­¤ë¤³¤È¤Ç¤¢¤ë¡£

bar.wml ¤È¤¤¤¦¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤ò»ý¤Ã¤Æ¤¤¤ë¤È¤¹¤ë...

 1| bar
 2| The value of bar is: $(bar:-unknown)

...¤½¤·¤Æ¡¢¼¡¤Ë¥Õ¥¡¥¤¥ë¤òÁÞÆþ¤¹¤ë:

 1| foo
 3| #include 'bar.wml' bar="FooBar"
 2| #include 'bar.wml'
 5| quux

¤¹¤ë¤È½ÐÎϤÏ:

 1| foo
 2| bar
 3| The value of bar is: Foobar
 4| bar
 5| The value of bar is: unknown
 6| quux

¸«¤Æ¤ÎÄ̤ꡢ#include ¤¬Âбþ¤·¤¿¥Õ¥¡¥¤¥ë¤ÎÆâÍÆ¤ËÃÖ¤­´¹¤¨¤é¤ì¤ë¡£ ¤½¤·¤Æ¡¢¤³¤Î¥¤¥ó¥¯¥ë¡¼¥É¤µ¤ì¤¿¥³¥ó¥Æ¥ó¥ÄÆâ¤ÎÊÑ¿ô¤Ëɸ½à¤ÎÃͤ¬ÄêµÁ¤µ¤ì¤Æ ¤¤¤ì¤Ð¡¢´Þ¤Þ¤ì¤¿ÊÑ¿ô¤Ë¼ê¤ò²Ã¤¨¤ë¤³¤È¤¬¤Ç¤­¤ë¡£

¤³¤ÎÊÑ¿ô¤ò»È¤¦¤³¤È¤Ç¡¢Ã±½ã¤Ê if-then-else ¹½Ê¸¤¬¼Â¸½¤Ç¤­¤ë:

  1| The value of bar is $(bar:+set)$(bar:*unset).

¤³¤Î `$(bar:+set)$(bar:*unset)' ¤Ï°Ê²¼¤Î¹½Â¤¤ÈƱ¤¸¤Ç¤¢¤ë¡£

  if (isdefined(bar))
      expandto("set")
  else 
      expandto("unset")


LESSON: ¹Ô¤ÎÏ¢·ë

Î㤨 HTML ¤¬ÉáÄ̶õÇò¤È²þ¹Ô¤ò¤­¤Ë¤·¤Ê¤¤¤È¤Ï¤¤¤¨¡¢¼ÂºÝ¤Ë°ì¹Ô¤Ç¤Ê¤±¤ì¤Ð¤Ê ¤é¤Ê¤¤¾ì¹ç¡¢À°·ÁºÑ¤ÎÎΰè¤òºî¤Ã¤¿¤ê¥³¡¼¥É¤òÊ£¿ô¹Ô¤Ë³ÈÄ¥¤¹¤ëµ¡Ç½Ìµ¤·¤Ç¡¢ ¼«Ê¬¼«¿È¤Î¥¿¥°(¸å¤ÇÀâÌÀ)¤ò½ñ¤¯¤Î¤ÏÈó¾ï¤Ëº¤Æñ¤Ç¤¢¤ë¡£ ¤³¤Î¤¿¤á¤Ë¡¢Â¿¤¯¤Î¸À¸ì¤Ç¤Ï¹ÔÏ¢·ë/·Ñ³ʸ»ú¤È¤·¤Æ `\' ¤ò»È¤¦¡£WML ¤â¤½ ¤¦¤Ç¤¢¤ë¡£

Input:

 1| foo\
 2|    bar \
 3| quux

Output:

 1| foobar quux

¹Ô¤ÎÏ¢·ë¤Ï¡¢Ï¢·ë³«»Ï¤«¤é¶õÇò¤Î½ª¤ê¤Þ¤Ç¡¢¶õÇò¤òÊݸ¤»¤º¤Ë¼è¤êµî¤ë¡£ ¤Ä¤Þ¤ê¡¢¼ÂºÝ¤Î¶õÇò¤È¤·¤ÆÏ¢·ëʸ»ú¤ÎÁ°¤Î¶õÇòʸ»ú¤ò»È¤¨¤ë¤¬¡¢Ï¢·ë¤Î¸å¤Î¶õ Çò¤ò¼ÂºÝ¤Î¶õÇò¤È¤·¤Æ»È¤¦¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£


LESSON: °ÌÃ֤ؤΞÍÑ

WML¤ÎºÇ¤â¶¯ÎϤʵ¡Ç½¤Î°ì¤Ä¤Ï¡¢ÄêµÁ¤µ¤ì¤¿°ÌÃ֤ˡ¢¥Ç¡¼¥¿¤òžÍѤ¹¤ë ǽÎϤǤ¢¤ë¡£

Input:

 1| {#BAR#:this is:##}
 2| foo
 3| {#BAR#}
 4| quux
 5| {#BAR#: bar:##}
 6| foobar
 7| {#BAR#}

Output:

 1| foo
 2| this is bar
 3| quux
 4| foobar
 5| this is bar

3¹ÔÌܤˤ¢¤ë BAR ¤Ï1¹ÔÌܤÈ5¹ÔÌÜ¤ÎÆâÍÆ¤¬Å¾ÍѤµ¤ì¤ÆÉ½¼¨¤µ¤ì¤ë¡£ ¤½¤·¤Æ¡¢¸«¤Æ¤Î¤È¤ª¤ê¡¢¤É¤ó¤Ê¾ì½ê¤«¤é¤Ç¤â¡¢²¿Å٤ǤâžÍѤǤ­¤ë¡£°Ê¹ß¤ÎÀß Äê(1¤È5¹ÔÌÜ)¤Ë¤è¤ê¡¢ÆâÍÆ¤òÎßÀѤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£¤³¤ì¤Ï¡¢ºÇ½é¤ËWML¤¬Á´ ¤Æ¤ÎÆâÍÆ¤òÎßÀѤ·¡¢¤½¤ì¤«¤é¤¹¤Ù¤Æ¤Î¾ì½ê¤ÇžÍѤ¹¤ë¤¿¤á¤À¡£

wml::std::tags ¤Î¹â¿å½à¤Î¥¿¥°¤È°ì½ï¤Ë»È¤¦»ö¤Ç¡¢¤è¤ê¿Í¤¬ÆÉ¤ß¤ä¤¹¤¤Êý Ë¡¤Ç¡¢Îã¤ò½ñ¤±¤¿:

 1| #use wml::std::tags
 2| <divert BAR>this is</divert>
 3| foo
 4| <dump BAR>
 5| quux
 6| <divert BAR> bar</divert>
 7| foobar
 8| <dump BAR>


LESSON: ʬ³ä½ÐÎϤÎÄêµÁ

»þ¡¹¡¢¿Í¤ÏÊ£¿ô¤Î½ÐÎÏ¥Õ¥¡¥¤¥ë¤òɬÍפȤ¹¤ë¡£Ä̾¥³¥ó¥Æ¥ó¥Ä¤Î90%¤¬Æ±¤¸¤â ¤Î¤Ç¤¢¤ë¤±¤ì¤É¤â¡¢¿Í¤Ï10%¤Î»Ä¤ê¤òÁªÂò¤¹¤ëɬÍפ¬¤¢¤ë¡£WML ¤Î¥¢¥×¥í¡¼¥Á ¤Ï¡¢°Û¤Ê¤ë½ÐÎÏ¥Õ¥¡¥¤¥ë¤ò¤Ä¤¯¤ë¤¿¤á¤Ë¸å¤Ç»È¤¦ ¥¹¥é¥¤¥¹ ¤òÄêµÁ¤¹¤ë¤³¤È ¤Ë¤è¤ê°ã¤¦Éôʬ¤òÀÚÎ¥¤¹¤³¤È¤Ë¤è¤ê¡¢10%¤ò¥Õ¥¡¥¤¥ë¤ÎÃæ¤ËľÀÜʬ³ä½ñ¤­¹þ¤àÊý Ë¡¤Ç¤¢¤ë¡£

 1| <html>
 2| <head>
 3| <title>[EN:Titleline:][DE:Titelzeile:]</title>
 4| </head>
 5| <body>
 6| <h1>[EN:Headerline:][DE:Ueberschrift:]</h1>
 7| </body>
 8| </html>

¾åµ­¤Î¥Ú¡¼¥¸¤¬¡¢¥Õ¥¡¥¤¥ë index.wml ¤È¥³¥Þ¥ó¥É¤Ç¤¢¤ë¤È²¾Äꤹ¤ë¤È

 $ wml -o UNDEF+EN:index.html.en \
       -o UNDEF+DE:index.html.de index.wml

`EN'¤ÇÄêµÁ¤µ¤ì¤¿¥¹¥é¥¤¥¹¤È¡¢¤½¤ì°Ê³°¤Î¶¦Ä̤ÎÎΰè¤ò´Þ¤à¡¢½ÐÎÏ¥Õ¥¡¥¤¥ë index.html.en¤òÀ¸À®¤¹¤ë...

 1| <html>
 2| <head>
 3| <title>Titleline</title>
 4| </head>
 5| <body>
 6| <h1>Headerline</h1>
 7| </body>
 8| </html>

...¤½¤·¤Æ¡¢`EN'¤ÇÄêµÁ¤µ¤ì¤¿¥¹¥é¥¤¥¹¤È¡¢¤½¤ì°Ê³°¤Î¶¦Ä̤ÎÎΰè¤ò´Þ¤à¡¢ ½ÐÎÏ¥Õ¥¡¥¤¥ë index.html.de ¤ò½ÐÎϤ¹¤ë¡£

 1| <html>
 2| <head>
 3| <title>Titelzeile</title>
 4| </head>
 5| <body>
 6| <h1>Ueberschrift</h1>
 7| </body>
 8| </html>


À°·Á


LESSON: Îΰè¤ÎÃÖ¤­´¹¤¨

WML¤Ï¡¢ÃÖ¤­´¹¤¨µ¡Ç½¤òÄ󶡤¹¤ë¡£»ØÄꤷ¤¿Îΰè¤ËÂФ·¡¢¼ã´³¤ÎPerl¤ÎÃÖ¤­´¹¤¨ ¤äž´¹¤Îµ¡Ç½¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤ë¡£

Input:

 1| foo
 2| {: [[s/foo/bar/g]] [[s/quux/foobar/g]] [[tr/[a-z]/[A-Z]/]]
 3| this is foo and quux.
 4| :}
 5| quux

Output:

 1| foo
 2| THIS IS BAR AND FOOBAR.
 3| quux

¤³¤ì¤ÏÌò¤Ë¤¿¤¿¤Ê¤¤¤«¤â¤·¤ì¤Ê¤¤¡£²æ¡¹¤Ï¤µ¤é¤Ëwml::fmt::isolatin ¤È wml::fmt::url ¤Î <isolatin> ¤È <url> ¥³¥ó¥Æ¥Ê¥¿¥°¤ò»ÈÍѤ·¤¿Îã ¤ò¼¨¤¹¡£

Input:

 1| #use wml::fmt::isolatin
 2| #use wml::fmt::url
 3| <isolatin><url>
 4| Some umlauts `öäüÖÄß' and
 5| a hyperlink http://foo.bar.com/
 6| </url></isolatin>

Output:

 1| Some umlauts `&ouml;&auml;&uuml;&Ouml;&Auml;&szlig;' and
 2| a hyperlink <a href="http://foo.bar.com/";>http://foo.bar.com/<;/a>


LESSON: ¥Æ¥­¥¹¥È¤Î½ñ¼°À°·Á

¥Æ¥­¥¹¥È¤ËÊ£¿ô¤ÎÃÊÍî¤ò½ñ¤­¹þ¤à¤è¤¦¤Ë¤Ê¤ë¤È¤­¡¢HTML¤Ï̵»ë¤¹¤ë¡£ WML¤Ï¡¢Â¾¤Î¥Þ¡¼¥¯¥¢¥Ã¥×¸À¸ì¥×¥í¥»¥Ã¥µ¡¼¤òÄ̤·¤Æ¡¢ÆþÎϤÎÎΰè¤ò½ñ¼°À°·Á ¤¹¤ëÁÇÀ²¤é¤·¤¤ÊýË¡¤òÄ󶡤¹¤ë¡£¤³¤ÎÎã¤Ç¤Ï¡¢Æó¤Ä¤ÎËä¤á¹þ¤Þ¤ì¤¿Îΰ褬¤¢¤ë¡£ ÊÒÊý¤Ï Plain Old Document (POD) ¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¡¢¤â¤¦°ì¤Ä¤Ï¡¢ Simple Document Format (SDF) ¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¤¢¤ë¡£

Input:

  1| #use wml::fmt::pod
  2| #use wml::fmt::sdf
  3| <html>
  4| <pod notypo>
  5| =head1 Headline1
  6| 
  7| Foo
  8| 
  9| =head2 Headline1.1
 10| 
 11| Bar
 12| </pod>
 13| 
 14| <sdf notypo>
 15| H1: Headline1
 16| 
 17| Foo
 18| 
 19| H2: Headline 1.1
 20| 
 21| Bar
 22|   * Baz
 23|     - Foobar
 24|     - Quux 
 25|   * Foo
 26| </sdf>
 27| </html>

Output:

  1| <html>
  2| <P>
  3| <H1><A NAME="Headline1">Headline1
  4| </A></H1>
  5| Foo
  6| <P>
  7| <H2><A NAME="Headline1_1">Headline1.1
  8| </A></H2>
  9| Bar
 10| <P>
 11| <H1><A NAME="Headline1">1. Headline1</A></H1>
 12| <P>Foo</P>
 13| <H2><A NAME="Headline 1.1">1.1. Headline 1.1</A></H2>
 14| <P>Bar</P>
 15| <UL>
 16| <LI>Baz<UL>
 17| <LI>Foobar
 18| <LI>Quux</UL>
 19| <LI>Foo</UL>
 20| </html>


LESSON: ¥Æ¡¼¥Ö¥ë¤Î½ñ¼°À°·Á

¤â¤¦¤Ò¤È¤Ä¡¢HTML¤ÎÈóÀ¸»ºÅª¤Ç½¹¤¤¥³¡¼¥É¤È¤¤¤¨¤Ð¡¢<table> ¹½Â¤¤Ç¤¢¤ë¡£ WML ¤Ç¤Ï¤è¤êÍÆ°×¤Ê¡¢Æó¼ïÎà¤Î¥³¥ó¥Æ¥Ê¥¿¥°¤òÄ󶡤¹¤ë:

ltgridgt

¤³¤Î¥³¥ó¥Æ¥Ê¥¿¥°¤ÎÌÜŪ¤Ï¡¢Æó¼¡¸µ¤Î¥°¥ê¥Ã¥É(³Ê»Ò)¤È¤·¤Æ¡¢»×¤¦¤¬¤Þ¤Þ¤Ë ¥Æ¡¼¥Ö¥ë¤ò»ØÄê¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë¤³¤È¤Ç¤¢¤ë¡£¥°¥ê¥Ã¥É¤Ï¥ì¥¤¥¢¥¦¥È¤ò»ØÄê ¤·¤Æ¤«¤é¡¢¥»¥ë¤ÎÃæ¤ËÆâÍÆ¤ò½ñ¤¯¤³¤È¤Ë¤è¤ê¤Ä¤¯¤é¤ì¤ë¡£¤µ¤é¤Ë¡¢<grid> ¥³¥ó¥Æ¥Ê¥¿¥°¤Ï¡¢¥»¥ë¤Î°ÌÃÖ¤ò·¤¨¤ë¤¿¤á¤ÎÁÇÀ²¤·¤¤µ¡Ç½¤òÄ󶡤¹¤ë¡£

Input:

  1| #use wml::std::grid
  2| <grid layout=2x3 align=lr valign=tbb border=1>
  3|   <cell>Header 1</cell> <cell>Header 2</cell>
  4|   <cell>Cell-A</cell>   <cell>Cell-B</cell>
  5|   <cell>Cell-C</cell>   <cell>Cell-D</cell>
  6| </grid>

Output:

  1| <table border="1" cellspacing="0" cellpadding="0">
  2|   <tr>
  3|     <td align=left valign=top>Header 1</td>
  4|     <td align=right valign=top>Header 2</td>
  5|   </tr>
  6|   <tr>
  7|     <td align=left valign=bottom>Cell-A</td>
  8|     <td align=right valign=bottom>Cell-B</td>
  9|   </tr>
 10|   <tr>
 11|     <td align=left valign=bottom>Cell-C</td>
 12|     <td align=right valign=bottom>Cell-D</td>
 13|   </tr>
 14| </table>
ltxtablegt

¤³¤ì¤Ï¡¢³°Éô¥×¥í¥°¥é¥à¤Î wml_aux_freetable ¤Ë¤è¤ê³ÈÄ¥¤µ¤ì¤¿¡¢ <table> ¥³¥ó¥Æ¥Ê¥¿¥°¤Ç¤¢¤ë¡£¤½¤ÎÌÜŪ¤Ï¡¢¥³¥ó¥Ñ¥¯¥È¤Ê ¹½Ê¸¤Ç¥Æ¡¼¥Ö¥ë¤ò»ØÄê¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë¤³¤È¤Ç¤¢¤ë¡£¼ÂºÝ¤ËÎã¤ò¸«¤Æ ¤ß¤è¤¦:

(ÆüËܸìÈÇÃí: Debian GNU/Linux ¤Ç¤Ï wwwtable ¥Ñ¥Ã¥±¡¼¥¸¤¬É¬Í×)

Input:

  1| #use wml::fmt::xtable
  2| <xtable border=1>
  3|   (*, 1) align=left
  4|   (*, 2) align=right
  5|   (1, *) valign=top
  6|   (2|3, *) valign=bottom
  7|   (1,1) 
  8|   Header 1 
  9|   (1,2)
 10|   Header 2
 11|   (2,1) 
 12|   Cell-A   
 13|   (2,2)
 14|   Cell-B
 15|   (3,1) 
 16|   Cell-C   
 17|   (3,2) 
 18|   Cell-D
 19| </xtable>

Output:

  1| <table border="1">
  2|   <tr valign=top>
  3|     <td align=left>Header 1</td>
  4|     <td align=right>Header 2</td>
  5|   </tr>
  6|   <tr>
  7|     <td align=left valign=bottom>Cell-A</td>
  8|     <td align=right valign=bottom>Cell-B</td>
  9|   </tr>
 10|   <tr>
 11|     <td align=left valign=bottom>Cell-C</td>
 12|     <td align=right valign=bottom>Cell-D</td>
 13|   </tr>
 14| </table>


ÆÈ¼«¤ÎHTML¥¿¥°¤òÄêµÁ¤¹¤ë


LESSON: ñ½ã¤Ê¥¿¥°¤È¥³¥ó¥Æ¥Ê¥¿¥°

¤µ¤Æ¡£¿·¤·¤¤¡¢ÆÃÀ½¤ÎHTML¥¿¥°¤òÄêµÁ¤·¤Æ¡¢¥Þ¡¼¥¯¥¢¥Ã¥×¸À¸ì¤ò³ÈÄ¥¤¹¤ë»þ´Ö¤Ç¤¢¤ë¡£ ¤³¤ì¤Ë¤Ï¡¢Æó¼ïÎà¤ÎHTML¥¿¥°¤¬¤¢¤ë¡£

ñ½ã¤Ê¥¿¥°

Îã¤È¤·¤Æ¡¢<me> ¤È¤¤¤¦»ä¤Î̾Á°¤ò¾Êά¤Ç¤­¤ë¥¿¥°¤òÄêµÁ¤·¤¿¡£

Input:

 1| <define-tag me>
 2| rse@engelschall.com
 3| </define-tag>
 4|
 5| This is <me>.

Output:

 1| This is rse@engelschall.com.
¥³¥ó¥Æ¥Ê¥¿¥°

Îã¤È¤·¤Æ¡¢<red>¤È¤¤¤¦¡¢¤«¤³¤Þ¤ì¤¿Ê¸»ú¤Î¿§¤òÀ֤ˤ¹¤ë¥¿¥°¤ò ÄêµÁ¤·¤¿¡£

Input:

  1| <define-tag red endtag=required>
  2| <font color="#cc3333">%body</font>
  3| </define-tag>
  4| 
  5| This is <red>very important</red>.

Output:

  1| This is <font color="#cc3333">very important</font>.


LESSON: °À­ÉÕ¤­¤Î¥¿¥°

°À­¤Î̵¤¤¥¿¥°¤Ï¤¢¤Þ¤ê½ÀÆð¤Ç¤Ï¤Ê¤¤¤Î¤Ç¡¢Â°À­ÉÕ¤­¤Î¥¿¥°¤òÄêµÁ¤·¤Æ¤ß¤è¤¦¡£

Input:

  1| <define-tag me whitespace=delete>
  2| <if   "%0" ""            "rse@engelschall.com">
  3| <ifeq "%0" "engelschall" "rse@engelschall.com">
  4| <ifeq "%0" "netsw"       "rse@netsw.org">
  5| <ifeq "%0" "apache"      "rse@apache.org">
  6| <ifeq "%0" "freebsd"     "rse@freebsd.org">
  7| <ifeq "%0" "sdm"         "rse@sdm.de">
  8| </define-tag>
  9| 
 10| This is <me> and <me apache>.

Output:

   1| This is rse@engelschall.com and rse@apache.org.

name=value ¤È¤¤¤¦Â°À­¤òÊÑ¿ô¤È¤·¤Æ¤¤¤ë:

Input:

  2| <define-tag me whitespace=delete>
  3| <preserve at>
  4| <set-var %attributes>
  5| <if   "<get-var at>" ""            "rse@engelschall.com">
  6| <ifeq "<get-var at>" "engelschall" "rse@engelschall.com">
  7| <ifeq "<get-var at>" "netsw"       "rse@netsw.org">
  8| <ifeq "<get-var at>" "apache"      "rse@apache.org">
  9| <ifeq "<get-var at>" "freebsd"     "rse@freebsd.org">
 10| <ifeq "<get-var at>" "sdm"         "rse@sdm.de">
 11| <restore at>
 12| </define-tag>
 13| 
 14| This is <me> and <me at=apache>.

Output:

   1| This is rse@engelschall.com and rse@apache.org.


LESSON: ´û¤Ë¤¢¤ëHTML¥¿¥°¤ò¾å½ñ¤­¤¹¤ë

WML ¤Ç¤Ï¡¢´û¸¤ÎHTML¥¿¥°¤ò¾å½ñ¤­¤¹¤ë»ö¤â¤Ç¤­¤ë¡£´û¸¤Î¥¿¥°¤ÈƱ¤¸Ì¾Á°¤Î ÆÃÀ½¤Î¥¿¥°¤òÄêµÁ¤·¡¢¤½¤ÎÃæ¤Ç¸µ¤ÎHTML¥¿¥°¤ò»È¤¨¤ë¤Î¤À¡£

Input:

   1| <define-tag br whitespace=delete>
   2| <br*><br*>
   4| </define-tag>
   5|
   6| Some Text<br>
   7| Some more Text
    
Output:

   1| Some Text<br><br>
   2| Some more Text


LESSON: Perl ¤Ç¥¿¥°¤ò¥×¥í¥°¥é¥à¤¹¤ë

WML ¤Î½ÅÍפʵ¡Ç½¤Î°ì¤Ä¤Ë¡¢¤É¤Î¤è¤¦¤Ê¾ì½ê¤Ç¤â¡¢`<:' ¤È `:>' ¤Ç°Ï¤ó¤ÀÎΰè¤Ë¡¢Perl ¥³¡¼¥É¤ò½ñ¤±¤ë¤È¤¤¤¦»ö¤¬¤¢¤ë¡£¤³¤ì¤Ï¡¢¥¿¥°¤òÄêµÁ¤È ÁȤ߹ç¤ï¤»¤ë¤³¤È¤Ç¡¢Perl¤Ç ¥¿¥°¤ò¥×¥í¥°¥é¥à¤Ç¤­¤ë¤È¤¤¤¦¤³¤È¤À¡£

Input:

  1| #use wml::std::tags
  2| <define-tag me whitespace=delete>
  3| <preserve at>
  4| <set-var %attributes>
  5| <:{ 
  6|     my $at = qq/<get-var at>/;
  7|     my $addr;
  8|     $addr = "rse@engelschall.org" if $at eq '';
  9|     $addr = "rse@engelschall.org" if $at eq 'engelschall';
 10|     $addr = "rse@netsw.org"       if $at eq 'netsw';
 11|     $addr = "rse@apache.org"      if $at eq 'apache';
 12|     $addr = "rse@freebsd.org"     if $at eq 'freebsd';
 13|     $addr = "rse@sdm.de"          if $at eq 'sdm';
 14|     print $addr;
 15| }:>
 16| <restore at>
 17| </define-tag>
 18| 
 19| This is <me> and <me at=apache>.

Output:

  1| This is rse@engelschall.com and rse@apache.org.


¾åµé¸þ¤±µ¡Ç½


LESSON: ¥Æ¥ó¥×¥ì¡¼¥È¤ò»È¤¦

´û¤Ë¡¢¥Ç¡¼¥¿¤ò¾¤Î°ÌÃ֤˞ÍѤ¹¤ëÊýË¡¤Ï¸«¤¿¡£WML ¤Ï¥Õ¥¡¥¤¥ë¤Î½ªÃ¼¤Ç¡¢´û¤Ë ³«¤¤¤Æ¤¤¤ëžÍѤò¼«Æ°Åª¤ËÊĤ¸¤ë¡£²æ¡¹¤Ï¥Æ¥ó¥×¥ì¡¼¥È¤òºî¤ë¤¿¤á¤Ë¤³¤Îµ¡Ç½¤ò »È¤¦¤³¤È¤¬¤Ç¤­¤ë¡£Î㤨¤Ð¡¢template.wml ¤È¤¤¤¦¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤¬¤¢ ¤ë¤È²¾Äꤹ¤ë¡£

  1| #   the template itself 
  2| <html>
  3| <head>
  4| <title>{#SUBJECT_LOC#}</title>
  5| </head>
  6| <body>
  7| <h1>{#SUBJECT_LOC#}</h1>
  8| <blockquote>
  9| {#BODY#}
 10| </blockquote>
 11| </body>
 12| </html>
 13| 
 14| #   way to insert the subject
 15| <define-tag subject>
 16| {#SUBJECT_LOC#:%0:##}
 17| </define-tag>
 18| 
 19| #   per default we are in body
 20| {#BODY#:

Input:

  1| #include 'template.wml'
  2| 
  3| <subject "Foo, Bar and Quux">
  4|
  5| This is about Foo, Bar and Quux...

Output:

  1| <html>
  2| <head>
  3| <title>Foo, Bar and Quux</title>
  4| </head>
  5| <body>
  6| <h1>Foo, Bar and Quux</h1>
  7| <blockquote>
  8| This is about Foo, Bar and Quux...
  9| </blockquote>
 10| </body>
 11| </html>

WML¤ÎžÍѥᥫ¥Ë¥º¥à¤¬¤É¤ó¤Ê¥Ý¥¤¥ó¥È¤Ç¤âžÍѤò¹Ô¤¦¤¿¤á¡¢Ê£¿ô¤Î¥Æ¥ó¥×¥ì¡¼¥È ¤òÆþ¤ì»Ò¤Ë¤¹¤ë¤³¤È¤â¤Ç¤­¤ë¡£


LESSON: ¿¸À¸ì¥Ú¡¼¥¸¤òºîÀ®¤¹¤ë

WML ¤Î¥³¥¢¤È¤Ê¤ë¸À¸ì¤Ï¡¢¤½¤ì¤¾¤ì°ã¤¦¿Í´Ö¤Î¸À¸ì¤ÇƱ¤¸¥Ú¡¼¥¸¾ðÊó¤ò´Þ¤à¾ì¹ç ¤ò½ü¤­¡¢°ì¤Ä¤ÎÆþÎϤ«¤éÊ£¿ô¤Î¥Ú¡¼¥¸¤òºî¤ë¤È¤¤¤Ã¤¿¡¢Â¿¸À¸ì¥Ú¡¼¥¸¤òºî¤ë¤¿¤á ¤ÎÀìÍѤε¡Ç½¤òÄ󶡤·¤Ê¤¤¡£¤·¤«¤·¡¢WML ¤Ï ``¥¹¥é¥¤¥¹½èÍý'' (9ÈÖÌܤνèÍý) ¤òÄ̤·¤Æ¤³¤ì¤òÄ󶡤¹¤ë¡£¤½¤·¤Æ¡¢¿§¡¹¤Ê½ÐÎÏ¥Õ¥¡¥¤¥ë¤òºî¤ë¤³¤È¤Î¤Ç¤­¤ë¥¿¥° ·²¤ò´Þ¤à¡¢ wml::std::lang ¤È¤¤¤¦¤â¤Î¤¬Â¸ºß¤¹¤ë¡£

Let take an example:

  1| #!wml -o (ALL-LANG_*)+LANG_EN:index.en.html \
  2|       -o (ALL-LANG_*)+LANG_DE:index.de.html
  3| 
  4| #use wml::std::page
  5| #use wml::std::lang
  6| 
  7| <lang:new id=en short>
  8| <lang:new id=de short>
  9| 
 10| <page>
 11| 
 12| <h1><en: Welcome><de: Willkommen>!</h1>
 13| 
 14| <a href="<lang:star: index2.*.html>">Index 2</a>
 15| 
 16| <lang:area>
 17| (en)This is a test page
 18| (de)Dies ist eine Testseite
 19| </lang:area>

½èÍý¤Î1ÈÖÌܤ«¤é8ÈÖÌÜ (wml -p1-8) ¤Þ¤Ç¹Ô¤¦¤È¡¢WML¤ÏÆâÉô¤Ç°Ê²¼¤Î¤è¤¦¤Ê ¥³¡¼¥É¤òÀ¸À®¤¹¤ë:

  1| <html>
  2| <head>
  3| </head>
  4| <body bgcolor="#ffffff" text="#000000" link="#333399" alink="#9999ff" vlink="#000066">
  5| <h1>[LANG_EN:Welcome:][LANG_DE:Willkommen:]!</h1>
  6| <a href="[LANG_EN:index2.en.html:][LANG_DE:index2.de.html:]">Index 2</a>
  7| [LANG_EN:This is a test page
  8| :][LANG_DE:Dies ist eine Testseite:]
  9| </body>
 10| </html>

¤½¤·¤Æ¤½¤Î¸å¡¢9ÈÖÌܤνèÍý¤Ç WML¤Î¥Þ¥¸¥Ã¥¯¹Ô¤Ç¤¢¤ë (#!wml -o...) ¤¬°Ê²¼¤Î Æó¤Ä¤Î¥Õ¥¡¥¤¥ë¤òÀ¸À®¤¹¤ë:

index.en.html:

  1| <html>
  2| <head>
  3| </head>
  4| <body bgcolor="#ffffff" text="#000000" link="#333399" alink="#9999ff" vlink="#000066">
  5| <h1>Welcome!</h1>
  6| <a href="index2.en.html">Index 2</a>
  7| This is a test page
  8| 
  9| </body>
 10| </html>

index.de.html:

  1| <html>
  2| <head>
  3| </head>
  4| <body bgcolor="#ffffff" text="#000000" link="#333399" alink="#9999ff" vlink="#000066">
  5| <h1>Willkommen!</h1>
  6| <a href="index2.de.html">Index 2</a>
  7| Dies ist eine Testseite
  8| </body>
  9| </html>

¤½¤·¤Æ¡¢¤³¤ì¤é¤Î2¥Ú¡¼¥¸¤Ï¡¢WEB ¥µ¡¼¥Ð¤Î¸À¸ìÁªÂòµ¡Ç½¤¢¤ë¤¤¤ÏľÀÜ»²¾È ¤Ë¤è¤êÄ󶡤µ¤ì¤ë¡£


ÉÕµ­

¤³¤³¤Þ¤Ç¡¢WML¤ÎÍÍ¡¹¤Êµ¡Ç½¤ò¸«¤¿¤Ï¤º¤Ç¤¢¤ë¡£¾ÜºÙ¤òÃΤꤿ¤¤¤Î¤Ê¤é¤Ð¡¢ wml_intro(7) ¤Ç¤ÎWML¤Î³µÎ¬¤Þ¤¿¤Ï¤½¤ì¤¾¤ì¤Î¥³¥¢¸À¸ì¤Î¥Þ¥Ë¥å¥¢¥ë¤òÄ´¤Ù ¤ëɬÍפ¬¤¢¤ë¡£¤Þ¤º¤Ï¡¢¥Õ¥í¥ó¥È¥¨¥ó¥É¤Ç¤¢¤ë wml(1) ¤«¤é¤Ï¤¸¤á¤è¤¦¡£

¤µ¤é¤Ë¡¢¥¤¥ó¥¯¥ë¡¼¥É¤µ¤ì¤ë WML ¥Õ¥¡¥¤¥ë¤Ë¤è¤ê¡¢µ¬³Ê¤ò¾ÜºÙ¤ËÃΤ뤳¤È¤â ¤Ç¤­¤ë¡£¤³¤ì¤ÏºÇ¾å°Ì¤Î¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤Ç¤¢¤ë wml:all(3) ¤«¤é¤Ï¤¸¤á ¤è¤¦¡£


´ØÏ¢¹àÌÜ

wml_intro(7)

wml_p1_ipp(1), wml_p2_mp4h(1), wml_p3_eperl(1), wml_p4_gm4(1), wml_p5_divert(1), wml_p6_asubst(1), wml_p7_htmlfix(1), wml_p8_htmlstrip(1), wml_p9_slice(1).

wml::all(3)