corrade-nucleus-nucleons – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
2 | office | 1 | # UNPACKERS SPECIFICATIONS |
2 | |||
3 | Nothing very difficult: an unpacker is a submodule placed in the directory |
||
4 | where this file was found. Each unpacker must define three symbols: |
||
5 | |||
6 | * `PRIORITY` : integer number expressing the priority in applying this |
||
7 | unpacker. Lower number means higher priority. |
||
8 | Makes sense only if a source file has been packed with |
||
9 | more than one packer. |
||
10 | * `detect(source)` : returns `True` if source is packed, otherwise, `False`. |
||
11 | * `unpack(source)` : takes a `source` string and unpacks it. Must always return |
||
12 | valid JavaScript. That is to say, your code should look |
||
13 | like: |
||
14 | |||
15 | ``` |
||
16 | if detect(source): |
||
17 | return do_your_fancy_things_with(source) |
||
18 | else: |
||
19 | return source |
||
20 | ``` |
||
21 | |||
22 | *You can safely define any other symbol in your module, as it will be ignored.* |
||
23 | |||
24 | `__init__` code will automatically load new unpackers, without any further step |
||
25 | to be accomplished. Simply drop it in this directory. |