1# -*- coding: utf-8 -*-2# Copyright 2011 Takeshi KOMIYA3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.1516from blockdiag.utils.rst import directives17from docutils.parsers import rst1819import nwdiag.builder20import nwdiag.drawer21import nwdiag.parser22from nwdiag.utils.rst.nodes import nwdiag as nwdiag_node2324directive_options_default = dict(format='PNG',25 antialias=False,26 fontpath=None,27 outputdir=None,28 nodoctype=False,29 noviewbox=False,30 inline_svg=False,31 ignore_pil=False)32directive_options = {}333435class NwdiagDirective(directives.BlockdiagDirective):36 name = "nwdiag"37 node_class = nwdiag_node38 processor = nwdiag394041 def global_options(self):42 return directive_options434445def setup(**kwargs):46 for key, value in directive_options_default.items():47 directive_options[key] = kwargs.get(key, value)4849 rst.directives.register_directive("nwdiag", NwdiagDirective)