@@ -114,6 +114,15 @@ after the hook function is executed. Possible return values are defined below
114114for each hook. Some special return values, such as ` BREAK ` and ` CONT ` , are
115115registered as constants under ` scriptshifter.exceptions ` .
116116
117+ ### Note on running multiple functions on a hook
118+
119+ Currently, if multiple functions are defined for a hook, they are executed
120+ in the order specified in the configuration. There is no way to skip a function
121+ implicitly based on the outcome of the previous one. The only state that is
122+ passed around in this context, is the ` ctx ` instance of the ` Transliterator `
123+ class. This may change in the future as specific needs arise.
124+
125+
117126### Always available context members
118127
119128The following members of the context object are available in all the hooks:
@@ -191,7 +200,7 @@ ignore term and when or when not to trigger a match.
191200 at every character iteration. See "Cursor Flags" below.
192201- ` ctx.dest_ls ` : destination token list.
193202
194- #### Output
203+ #### Return
195204
196205` CONT ` , ` BREAK ` , or ` None ` . ` CONT ` skips the checks on the
197206current ignore token. ` BREAK ` stops looking up ignore tokens for the current
@@ -217,7 +226,7 @@ scanning for more ignore tokens past the match.
217226- ` ctx.ignoring ` : whether an ignore token matched. If set to ` False ` , the rest
218227 of the workflow will assume a non-match.
219228
220- #### Output
229+ #### Return
221230
222231` CONT ` , ` BREAK ` , or ` None ` . ` CONT ` voids the match and keeps
223232on looking up the ignore list. ` BREAK ` stops looking up ignore tokens for the
@@ -242,7 +251,7 @@ number of characters, and/or exit the text scanning loop altogether.
242251- ` ctx.src_tk ` : the input token being looked up.
243252- ` ctx.dest_tk ` : the transliterated string associated with the current token.
244253
245- #### Output
254+ #### Return
246255
247256` CONT ` , ` BREAK ` , or ` None ` . ` CONT ` skips the checks on the
248257current token. ` BREAK ` stops looking up all tokens for the current
@@ -269,7 +278,7 @@ also inject additional conditions and logic for the match, and revoke the
269278- ` ctx.match ` : whether there was a match. If set to ` False ` , the rest of the
270279 workflow will assume a non-match.
271280
272- #### Output
281+ #### Return
273282
274283` CONT ` , ` BREAK ` , or ` None ` . ` CONT ` voids the match and keeps
275284on looking up the token list. ` BREAK ` stops looking up tokens for the
@@ -292,7 +301,7 @@ cursor position to the destination list, verbatim.
292301 at every character iteration. See "Cursor Flags" below.
293302- ` ctx.dest_ls ` : destination token list.
294303
295- #### Output
304+ #### Return
296305
297306` CONT ` , ` BREAK ` , or ` None ` . ` CONT ` skips to the next position in the input
298307text. Int his case, the function ** must** advance the cursor. ` BREAK ` stops all
@@ -311,10 +320,10 @@ bypass any further output handling.
311320
312321- ` ctx.dest_ls ` : destination token list.
313322
314- #### Output
323+ #### Return
315324
316- A string or ` None ` . If the output is a string, the transliteration function
317- returns this string immediately; otherwise it proceeds with standard
325+ ` BREAK ` or ` None ` . If ` BREAK ` , the content of ` ctx.dest ` , which should be set
326+ by the function, is returned immediately; otherwise it proceeds with standard
318327adjustments and assembly of the output list.
319328
320329### ` post_assembly `
@@ -333,9 +342,9 @@ and return it before any further default processing is done.
333342
334343#### Output
335344
336- String or ` None ` . If a string , the transliteration function returns that
337- immediately; otherwise it proceeds with standard adjustments of the output
338- string before returning.
345+ ` BREAK ` or ` None ` . If ` BREAK ` , the transliteration function returns the content
346+ of ` ctx.dest ` immediately; otherwise it proceeds with standard adjustments of
347+ the output string before returning.
339348
340349## Cursor flags
341350
0 commit comments