MoinLight

Annotated moinformat/macros/manifest.py

176:47af441b48bf
2018-11-26 Paul Boddie Support linking to stylesheets based on the collection of available files.
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@109 22
from moinformat.imports import get_extensions, get_mapping, get_modules
paul@89 23
paul@89 24
# Define an attribute mapping names to modules.
paul@89 25
paul@109 26
modules = get_modules(__file__, __name__)
paul@89 27
paul@89 28
# Obtain all macros.
paul@89 29
paul@109 30
# Use names declared in each class to register the handlers:
paul@89 31
# macro.name -> macro
paul@89 32
paul@109 33
macros = get_mapping(modules, lambda n, m: m.macro.name, lambda m: m.macro)
paul@89 34
paul@89 35
# vim: tabstop=4 expandtab shiftwidth=4