home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 May / Gamestar_73_2005-05_dvd.iso / Programy / amaya / amaya-Win98-8.7.3.exe / _SETUP.1 / HTML.trans.fr < prev    next >
Encoding:
Text File  |  2004-04-21  |  10.8 KB  |  525 lines

  1. ! Use of the file HTML.trans
  2. !!!!!!!!!!!!!!!!!!!!!!!!!!!!
  3. ! This file can be edited during an Amaya session. It will be 
  4. ! dynamically parsed when the transformation tool is required by
  5. ! the editor. So new transformations can be added while editing.
  6. !
  7. ! Syntax of the transformation language for Amaya
  8. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  9. !
  10. ! comments begin with !
  11. !
  12. ! This file can be edited during an Amaya session. It will be 
  13. ! dynamically parsed when the transformation tool is required by
  14. ! the editor. So new transformations can be added while editing.
  15. !
  16. ! A tranformation rule has three parts : 
  17. !     - a NAME terminated by a colon ":"
  18. !     - a SOURCE PATTERN terminated by a semi-colon ";"
  19. !     - and a list of RULES between braces "{" "}", each one
  20. !       terminated by a semi-colon ";"
  21. !
  22. ! a) The NAME will appear in the transform menu.
  23. !
  24. ! b) The SOURCE PATTERN gives of a specific organization of the elements
  25. ! to be transformed: it contains XML/HTML tags and SGML-like syntax
  26. ! for the composition operators:
  27. !     e1 | e2   for a choice between elements e1 and e2
  28. !     e1 , e2   for a sequence e1 followed by e2
  29. !     e+        for a sequence of one or more elements e
  30. !     ?e        for an optional element e
  31. !     ( )       for grouping nodes
  32. ! The braces "{" "}" define the content of a node.
  33. ! The symbol "*" is a token that matches any element type
  34. ! It is possible to rename a tag by preceeding it with a name
  35. ! followed by a colon ":"
  36. !
  37. ! c) RULES express transformations to be applied to the elements 
  38. ! identified in the pattern.
  39. ! Each rule end with a symbol ";"
  40. !
  41. ! - It could be performed by an action rule. In this case the rule
  42. !   starts with a "$" followed by the menu action to be called.
  43. !
  44. ! - It could be a list of transformation items:
  45. !  They have two parts :
  46. !      - a source identifier: a tag or a name which occurs in
  47. !        the pattern and links the rule to the pattern nodes
  48. !      - a rule body: drives the transformation
  49. !        there are two kinds of rule bodies:
  50. !        - a discard rule body is slash and express that the correspoding
  51. !          pattern node does not occuring the transformation result
  52. !        - a generation rule begins with
  53. !        - a symbol ">"
  54. !        - and a target tag list. This list is itself divided into
  55. !          two parts separated by a colon":": 
  56. !           * the generation location path
  57. !           * and the list of tags to be generated
  58. !   The dot symbol "." is used for descending in the tree structure.
  59. !   if the special token star "*" ends the list of tags to be 
  60. !   generated, the source elment tag is not changed but this element
  61. !   can be moved in a different place in the destination. 
  62. !
  63. !   The rules are applied in the order the identifiers are met when
  64. !   (depth first) traversing the source structure.
  65. !   Several rules may have the same identifier, in that case, the rules
  66. !   are applied in the order they are defined.
  67.  
  68. ! Transformation rules 
  69. !!!!!!!!!!!!!!!!!!!!!!
  70.  
  71. Adresse:(p{*+})+;
  72.     {
  73.     * > address:*;
  74.     }
  75.  
  76. Paragraphe:(address{*+});
  77.     {
  78.     * > p:*;
  79.     }
  80.  
  81. !between lists
  82. !!!!!!!!!!!!!!
  83.  
  84. Liste de dΘfinition:*{(li{(list:*{(li2:li)+}|other:*)+})+};
  85.     {
  86.     other > dl:dt;
  87.     list > dl:dd;
  88.     li2 > dl.dd:;
  89.     }
  90.  
  91. Liste α puces:(dl{(dt|dd{(*)+})+})+;
  92.     {
  93.     dt > ul:li;
  94.     * > ul.li.ul:li.*;
  95.     }
  96.  
  97. Liste numΘrotΘe:(dl{(dt|dd{(*)+})+})+;
  98.     {
  99.     dt > ol:li;
  100.     * > ol.li.ol:li.*;
  101.     }
  102.  
  103. Liste α puces:(ol{(li{(*)+})+})+;
  104.         {
  105.         * > ul:li.*;
  106.         }
  107.  
  108. Liste numΘrotΘe:(ul{(li{(*)+})+})+;
  109.         {
  110.     * > ol:li.*;
  111.         }
  112.  
  113. DΘfinition:dt{(*)+};
  114.     {
  115.     * > dd:*;
  116.     }
  117.  
  118. Terme:dd{(p|*)+};
  119.     {
  120.     dd > :dt;
  121.     p > :dt;
  122.     * > dt:*;
  123.     }
  124.  
  125. Retirer la liste de dΘfinition:(dl{(dt{(dtc:*)+}|dd{(p|*)+})+})+;
  126.     {
  127.     dtc > h4:*;
  128.     p > p;
  129.     * > p:*;
  130.     }
  131.  
  132. !flattering headings 
  133. !!!!!!!!!!!!!!!!!!!!
  134.  
  135. Paragraphes: 
  136. (h1|h2|h3|h4|h5|h6|p|*{(li{(il:*)+})+})+;
  137.     { 
  138.     h1 > :p;
  139.     h2 > :p;
  140.     h3 > :p;
  141.     h4 > :p;
  142.     h5 > :p;
  143.     h6 > :p;
  144.     p > :p;
  145.     il > :p;
  146.     }
  147.  
  148. !headings to/from definitions
  149. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  150.  
  151. Liste de dΘfinition:*,(h1|h2|h3|h4|h5|h6|p)+;
  152.     {
  153.     * > dl:dt;
  154.     h1 > dl:dt;
  155.     h2 > dl:dt;
  156.     h2 > dl:dt;
  157.     h3 > dl:dt;
  158.     h4 > dl:dt;
  159.     h5 > dl:dt;
  160.     h6 > dl:dt;
  161.     p > dl:dd;
  162.     }
  163.  
  164. Liste de dΘfinition:(h1,?hr,?(level1:*)+,?(h2,?(level2:*)+,?((h3|h4|h5|h6),(level3:*)+)+)+)+;
  165.     {
  166.     h1 > dl:dt;
  167.     level1>dl.dd:*;
  168.     h2 > dl.dd:dl.dt ;
  169.     level2 > dl.dd.dl.dd:*;
  170.     h3 > dl.dd.dl.dd:dl.dt ;
  171.     h4 > dl.dd.dl.dd:dl.dt ;
  172.     h5 > dl.dd.dl.dd:dl.dt ;
  173.     h6 > dl.dd.dl.dd:dl.dt ;
  174.     level3 > dl.dd.dl.dd.dl.dd:*;
  175.     }
  176.  
  177. Liste de dΘfinition:(h2,?hr,?(level1:*)+,(h3,?(level2:*)+,((h4|h5|h6),(level3:*)+)+)+)+;
  178.     {
  179.     h2 > dl:dt;
  180.     level1 > dl.dd:*;
  181.     h3 > dl.dd:dl.dt ;
  182.     level2 > dl.dd.dl.dd:*;
  183.     h4 > dl.dd.dl.dd:dl.dt ;
  184.     h5 > dl.dd.dl.dd:dl.dt ;
  185.     h6 > dl.dd.dl.dd:dl.dt ;
  186.     level3 > dl.dd.dl.dd.dl.dd:*;
  187.     }
  188.  
  189. Liste de dΘfinition:(h3,?hr,?(level1:*)+,?(h4,?(level2:*)+,((h5|h6),(level3:*)+)+)+)+;
  190.     {
  191.     h3 > dl:dt;
  192.     level1 > dl.dd:*;
  193.     h4 > dl.dd:dl.dt ;
  194.     level2 > dl.dd.dl.dd:*;
  195.     h5 > dl.dd.dl.dd:dl.dt ;
  196.     h6 > dl.dd.dl.dd:dl.dt ;
  197.     level3 > dl.dd.dl.dd.dl.dd:*;
  198.     }
  199.  
  200. Liste de dΘfinition multi-niveaux:(h4,?hr,?(level1:*)+,(h5,?(level2:*)+,((h6)+,(level3:*)+)+)+)+;
  201.     {
  202.     h4 > dl:dt;
  203.     level1 > dl.dd:*;
  204.     h5 > dl.dd:dl.dt ;
  205.     level2 > dl.dd.dl.dd:*;
  206.     h6 > dl.dd.dl.dd:dl.dt ;
  207.     level3 > dl.dd.dl.dd.dl.dd:*;
  208.     }
  209.  
  210. Titre h1:(dl{(dt1:dt|dd{(dl{(dt2:dt|dd{(dl{(dt3:dt|dd{content:*})+}|content:*)+})+}|content:*)+})+}|hr)+;
  211.     {
  212.     dt1 > :h1;
  213.     dt2 > :h2;
  214.     dt3 > :h3;
  215.     content > :*;
  216.     }
  217.  
  218. Titre h2:(dl{(dt1:dt|dd{(dl{(dt2:dt|dd{(dl{(dt3:dt|dd{content:*})+}|content:*)+})+}|content:*)+})+}|hr)+;
  219.     {
  220.     dt1 > :h2;
  221.     dt2 > :h3;
  222.     dt3 > :h4;
  223.     content > :*;
  224.     }
  225.  
  226. Titre h3:(dl{(dt1:dt|dd{(dl{(dt2:dt|dd{(dl{(dt3:dt|dd{content:*})+}|content:*)+})+}|content:*)+})+}|hr)+;
  227.     {
  228.     dt1 > :h3;
  229.     dt2 > :h4;
  230.     dt3 > :h5;
  231.     content > :*;
  232.     }
  233.  
  234. Liste de dΘfinition: p,*+;
  235.     {
  236.     p > dl:dt;
  237.     * > dl.dd:*;
  238.     }
  239.  
  240. ! Preformatted to/from paragraphs
  241. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  242.  
  243. PreformatΘ: (p{*+})+;
  244.     {
  245.     * > pre:*;
  246.     }
  247.  
  248. Paragraphe: (pre{*+})+;
  249.     {
  250.     *   > p:*;
  251.     }
  252.  
  253. RΘunin les items: li,(li2:li)+;
  254.     {
  255.     li > li:;
  256.     li2 > li:;
  257.     }
  258. Retirer le niveau paragraphe: li{p{(cont:*)+},?(next:*)+};
  259.     {
  260.          li > li:;
  261.          cont > *;
  262.          next > *;
  263.          }
  264. Retirer le soulignΘ: (u{*+})+;
  265.         {
  266.         * > :*;
  267.         }
  268.  
  269. Couper l'item de liste: (li{a:*,(b:*)+})+;
  270.     {
  271.     a > :li.*;
  272.     b > :li.*;
  273.     }
  274.  
  275. RΘunir les listes: ul{li+},(ul{li+})+;
  276.     {
  277.     li > ul:li;
  278.     }
  279.  
  280. RΘunir les listes: ol{li+},(ol{li+})+;
  281.     {
  282.     li > ol:li;
  283.     }
  284.  
  285. RΘunir les listes: dl{(dt|dd)+},(dl{(dt|dd)+})+;
  286.     {
  287.     dt > dl:dt;
  288.     dd > dl:dd;
  289.     }
  290.  
  291. Paragraphe: *{(li{(*{?(li{(lev2:*)+})+})+})+};
  292.     {
  293.     lev2 > :*;
  294.     }
  295.  
  296. Paragraphes: (ol{(li{(h1|h2|h3|h4|h5|h6|p|*)+})+})+;
  297.     {
  298.     h1 > :h1;
  299.     h2 > :h2;
  300.     h3 > :h3;
  301.     h4 > :h4;
  302.     h5 > :h5;
  303.     h6 > :h6;
  304.     p > :p;
  305.     * > :p.*;
  306.     }
  307.  
  308. Paragraphes: (ul{(li{(h1|h2|h3|h4|h5|h6|p|*)+})+})+;
  309.     {
  310.     h1 > :h1;
  311.     h2 > :h2;
  312.     h3 > :h3;
  313.     h4 > :h4;
  314.     h5 > :h5;
  315.     h6 > :h6;
  316.     p > :p;
  317.     * > :p.*;
  318.     }
  319.  
  320. Retirer 2 niveaux de liste: *{(li{(*{?(li{(lev2:*)+})+})+})+};
  321.     {
  322.     lev2 > :*;
  323.     }
  324.  
  325. ! Forms to/from elements
  326. !!!!!!!!!!!!!!!!!!!!!!!!
  327.  
  328. Englober dans Formulaire:(h1|h2|h3|h4|h5|h6|p)+;
  329.     {
  330.     h1 > form:h1;
  331.     h2 > form:h2;
  332.     h3 > form:h3;
  333.     h4 > form:h4;
  334.     h5 > form:h5;
  335.     h6 > form:h6;
  336.     p > form:p;
  337.     }
  338.  
  339. Retirer Formulaire: form{?*+};
  340.     {
  341.     * > :*;
  342.     }
  343.  
  344. Retirer le sous-menu: (optgroup{*+})+;
  345.     {
  346.         * > :*;
  347.     }
  348.  
  349. ! Lists to/from elements
  350. !!!!!!!!!!!!!!!!!!!!!!!!
  351.  
  352. Liste α puces: (p|ol|menu|dir|pre|form)+;
  353.        {
  354.         p > ul:<li style=p.style>;
  355.         ol > ul;
  356.         pre > ul:li.pre;
  357.         form > ul:li.form;
  358.         }
  359.  
  360. Liste numΘrotΘe:(p|ul|menu|dir|pre|form)+;
  361.        {
  362.         p > ol:li;
  363.         ul > ol;
  364.         pre > ol:li.pre;
  365.         form > ol:li.form;
  366.         }
  367.  
  368.  
  369. !Tables to/from lists
  370. !!!!!!!!!!!!!!!!!!!!
  371.  
  372. Table: *{(lev1:li{?(*{(lev2:li)+}|elem:*)+})+};
  373.     {
  374.     lev1 > <table border="1">:tr;
  375.     elem > table.tr:td.*;
  376.     lev2 > table.tr:td;
  377.     }
  378.  
  379. Table: dl{(dt|dd)+};
  380.     {
  381.     dt > <table border="1">.tbody:tr.td;
  382.     dd > table.tbody.tr:td;
  383.     }
  384.  
  385. Liste numΘrotΘe:table{?caption,(block:*{(tr{(td|th),?(td2:td|th2:th)+})+})+};
  386.       {
  387.     caption > :ol.li.strong;
  388.     block > :ol;
  389.     tr > ol:li;
  390.     td > ol.li:;
  391.     th > ol.li:;
  392.     td2 > ol.li.ul:li;
  393.     th2 > ol.li.ul:li;
  394.     }
  395.  
  396. Liste α puces:table{?caption,(block:*{(tr{(td|th),?(td2:td|th2:th)+})+})+};
  397.     {
  398.     caption > :ul.li.strong;
  399.     block > :ul;
  400.     tr > ul:li;
  401.     td > ul.li:;
  402.     th > ul.li:;
  403.     td2 > ul.li.ul:li;
  404.     th2 > ul.li.ul:li;
  405.     }
  406.  
  407. Liste de dΘfinition:table{?caption,(block:*{(tr{(td|th),?(td2:td|th2:th)+})+})+};
  408.         {
  409.         caption > :dl.dt;
  410.         block   > :dl;
  411.         td      > dl:dt;
  412.         th      > dl:dt;
  413.         td2     > dl:dd;
  414.         th2     > dl:dd;
  415.         }
  416.  
  417. ! Remove elements
  418. !!!!!!!!!!!!!!!!!!!!!!!!!
  419.  
  420. Retirer la division: (div{*+})+;
  421.     {
  422.         * > :*;
  423.     }
  424.  
  425. Retirer le Centrer: (center{*+})+;
  426.     {
  427.         * > :*;
  428.     }
  429.  
  430. Retirer le niveau paragraphe: p{img};
  431.          {
  432.         img > :*;
  433.          }
  434.  
  435. Retirer le BlockQuote: blockquote{*+};
  436.     {
  437.     * > :*;
  438.     }
  439.  
  440. Retirer l'ΘlΘment font: font{*+};
  441.     {
  442.     * > :*;
  443.     }
  444.  
  445. Retirer l'ΘlΘment span: span{*+};
  446.     {
  447.     * > :*;
  448.     }
  449.  
  450. Retirer le Subscript: sub{*+};
  451.     {
  452.     * > :*;
  453.     }
  454.     
  455. Retirer le Superscript: sup{*+};
  456.     {
  457.     * > :*;
  458.     }
  459.     
  460. Retirer la Quotation: q{*+};
  461.     {
  462.         * > :*;
  463.     }
  464.  
  465. Retirer le BiDi: bdo{*+};
  466.     {
  467.         * > :*;
  468.     }
  469.  
  470. ! Tables to/from elements
  471. !!!!!!!!!!!!!!!!!!!!!!!!!
  472.  
  473. Table verticale: *+;
  474.     {
  475.     * > <table border="1">:tr.td.*;
  476.     }
  477.  
  478. Table horizontale: *+;
  479.     {
  480.     * > <table border="1">.tr:td.*;
  481.     }
  482.  
  483.  
  484. Retirer la table:table{?caption,(block:*{(tr{(td|th),?(td2:td|th2:th)+})+})+};
  485.         {
  486.         caption > :div.p;
  487.         block   > :div;
  488.         td      > :div;
  489.         th      > :div;
  490.         td2     > :div;
  491.         th2     > :div;
  492.         }
  493.  
  494. Transposer la table:table{tbody{tr{(td|th)+}|(tr{td2:td|th2:th})+}};
  495.     {
  496.     td > <table border=table.border>:tr.td;
  497.     th > table:tr.td;
  498.     td2 > <table border=table.border>.tr:td;
  499.     th2 > table.tr:td;
  500.     }
  501.  
  502. Cellule titre:?(td|th)+,td,?(td|th)+;
  503.     {
  504.     $ChangeToHeadingCell;
  505.     }
  506.  
  507. Cellule:?(td|th)+,th,?(td|th)+;
  508.     {
  509.     $ChangeToDataCell;
  510.     }
  511.  
  512. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  513. ! Global Document transformation tests !
  514. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  515.  
  516. DistrThot: body{*+}
  517.     {
  518.     body >     <table border="0" with="100%">.tbody.tr.<td with="30%">.<a href="http://opera.inrialpes.fr/OPERA/Thot.en.html"><img src="thot.gif" alt="Thot Editor" border="0" align="middle">;
  519.     body > table.tbody.tr.td:<a href="http://opera.inrialpes.fr">.<img src="opera.gif" alt="Opera project" border="0" align="middle">;
  520.     body > table.tbody.tr:td.<img src="guide.gif" alt="Documentation" border="0" align="middle">;
  521.     body > table.tbody.tr.td:h1."Title of the page";
  522.     body > :<table border="0" with="100%">.tbody.tr.<td with="30%">.h2.<a href="Index.html">."Home";
  523.     * > table.tbody.tr:td.*;
  524.     }
  525.