source: rtems-central/rtemsqual/applconfig.py @ dfca4bc

Last change on this file since dfca4bc was c0ac12a, checked in by Sebastian Huber <sebastian.huber@…>, on 02/25/20 at 12:54:17

Initial import

  • Property mode set to 100644
File size: 2.7 KB
Line 
1# SPDX-License-Identifier: BSD-2-Clause
2""" Functions for application configuration documentation generation. """
3
4# Copyright (C) 2019, 2020 embedded brains GmbH (http://www.embedded-brains.de)
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25# POSSIBILITY OF SUCH DAMAGE.
26
27import rtemsqual.content
28
29
30def _application_configuration_option_content(item, content):
31    content.add_index_entries(item["index"])
32    content.add_blank_line()
33    header = item["header"]
34    content.add_label(header)
35    content.add_blank_line()
36    content.add_header(header)
37    content.add_definition_item("DESCRIPTION:",
38                                item["description"].split("\n"))
39    content.add_definition_item("NOTES:", item["notes"].split("\n"))
40
41
42def _application_configuration_group_content(item, document):
43    content = rtemsqual.content.SphinxContent()
44    for child in item.children:
45        if (child["type"] == "interface" and
46                child["interface-type"] == "application-configuration-option"):
47            _application_configuration_option_content(child, content)
48        else:
49            raise Exception("unexpected item type")
50
51
52def classic_api_guide_content(item, document):
53    """ This is work in progress. """
54    for child in item.children:
55        if (child["type"] == "interface" and
56                child["interface-type"] == "application-configuration-group"):
57            _application_configuration_group_content(child, document)
58        else:
59            classic_api_guide_content(child, document)
Note: See TracBrowser for help on using the repository browser.