User Tools

Site Tools


pracro:post-commit-hook

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
pracro:post-commit-hook [2011/12/02 10:42] devapracro:post-commit-hook [2011/12/02 10:48] deva
Line 28: Line 28:
 An important feature of this list is that the native order of the macros are the same as in the template - **NOT** sorted alphabetically or similar!. An important feature of this list is that the native order of the macros are the same as in the template - **NOT** sorted alphabetically or similar!.
    
 +
  
 =====Script placement===== =====Script placement=====
Line 52: Line 53:
 </code> </code>
  
 +A similar solution is to be used in the individual macros (ie. oncommit/ondiscard attributes in the macro tag).
 +Each macros scripts are to be loaded in turn in a clean namespace containing only the values of the current macro (again to avoid naming conflicts) and executed in the same order in which they occur in the template.
 +
 +The template scripts are to be executed //before// the macro scripts.
 +
 +<code xml>
 +<?xml version='1.0' encoding='UTF-8'?>
 +<macro name="mymacro" version="1.0" oncommit="func1()" ondiscard="func2()">
 +  <oncommit>
 +    <script>
 +      function func1()
 +        -- do something useful
 +      end
 +
 +      function func2()
 +        -- do something useful
 +      end
 +    </script>
 +  </oncommit>
 +   .
 +   .
 +   .
 +</code>
  
 =====Resume scripts===== =====Resume scripts=====
 The resume scripts cannot directly be replaced by a single on-commit script since the resumes are used dynamically while the template is being edited (to show resumes in collapsed macros). The resume scripts cannot directly be replaced by a single on-commit script since the resumes are used dynamically while the template is being edited (to show resumes in collapsed macros).
  
pracro/post-commit-hook.txt · Last modified: 2011/12/02 13:35 by deva