paul@89 | 1 | #!/usr/bin/env python |
paul@89 | 2 | |
paul@89 | 3 | """ |
paul@89 | 4 | Moin macro implementation manifest. |
paul@89 | 5 | |
paul@89 | 6 | Copyright (C) 2017, 2018 Paul Boddie <paul@boddie.org.uk> |
paul@89 | 7 | |
paul@89 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@89 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@89 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@89 | 11 | version. |
paul@89 | 12 | |
paul@89 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@89 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@89 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@89 | 16 | details. |
paul@89 | 17 | |
paul@89 | 18 | You should have received a copy of the GNU General Public License along with |
paul@89 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@89 | 20 | """ |
paul@89 | 21 | |
paul@89 | 22 | from moinformat.imports import get_extensions |
paul@89 | 23 | from os.path import split |
paul@89 | 24 | |
paul@89 | 25 | reserved = ["__init__", "common", "manifest"] |
paul@89 | 26 | |
paul@89 | 27 | # Obtain details of this module's package. |
paul@89 | 28 | |
paul@89 | 29 | dirname = split(__file__)[0] |
paul@89 | 30 | package = __name__.rsplit(".", 1)[0] |
paul@89 | 31 | |
paul@89 | 32 | # Define an attribute mapping names to modules. |
paul@89 | 33 | |
paul@89 | 34 | modules = {} |
paul@89 | 35 | get_extensions(dirname, package, modules, reserved) |
paul@89 | 36 | |
paul@89 | 37 | # Obtain all macros. |
paul@89 | 38 | |
paul@89 | 39 | macros = {} |
paul@89 | 40 | |
paul@89 | 41 | # Use names declared in each handler to register the handlers: |
paul@89 | 42 | # macro.name -> macro |
paul@89 | 43 | |
paul@89 | 44 | for module in modules.values(): |
paul@89 | 45 | macros[module.macro.name] = module.macro |
paul@89 | 46 | |
paul@89 | 47 | # vim: tabstop=4 expandtab shiftwidth=4 |