.. | .. |
---|
59 | 59 | optional_arguments = 4 |
---|
60 | 60 | option_spec = { |
---|
61 | 61 | 'doc': directives.unchanged_required, |
---|
62 | | - 'functions': directives.unchanged, |
---|
63 | 62 | 'export': directives.unchanged, |
---|
64 | 63 | 'internal': directives.unchanged, |
---|
| 64 | + 'identifiers': directives.unchanged, |
---|
| 65 | + 'no-identifiers': directives.unchanged, |
---|
| 66 | + 'functions': directives.unchanged, |
---|
65 | 67 | } |
---|
66 | 68 | has_content = False |
---|
67 | 69 | |
---|
68 | 70 | def run(self): |
---|
69 | 71 | env = self.state.document.settings.env |
---|
70 | 72 | cmd = [env.config.kerneldoc_bin, '-rst', '-enable-lineno'] |
---|
| 73 | + |
---|
| 74 | + # Pass the version string to kernel-doc, as it needs to use a different |
---|
| 75 | + # dialect, depending what the C domain supports for each specific |
---|
| 76 | + # Sphinx versions |
---|
| 77 | + cmd += ['-sphinx-version', sphinx.__version__] |
---|
71 | 78 | |
---|
72 | 79 | filename = env.config.kerneldoc_srctree + '/' + self.arguments[0] |
---|
73 | 80 | export_file_patterns = [] |
---|
.. | .. |
---|
76 | 83 | env.note_dependency(os.path.abspath(filename)) |
---|
77 | 84 | |
---|
78 | 85 | tab_width = self.options.get('tab-width', self.state.document.settings.tab_width) |
---|
| 86 | + |
---|
| 87 | + # 'function' is an alias of 'identifiers' |
---|
| 88 | + if 'functions' in self.options: |
---|
| 89 | + self.options['identifiers'] = self.options.get('functions') |
---|
79 | 90 | |
---|
80 | 91 | # FIXME: make this nicer and more robust against errors |
---|
81 | 92 | if 'export' in self.options: |
---|
.. | .. |
---|
86 | 97 | export_file_patterns = str(self.options.get('internal')).split() |
---|
87 | 98 | elif 'doc' in self.options: |
---|
88 | 99 | cmd += ['-function', str(self.options.get('doc'))] |
---|
89 | | - elif 'functions' in self.options: |
---|
90 | | - functions = self.options.get('functions').split() |
---|
91 | | - if functions: |
---|
92 | | - for f in functions: |
---|
93 | | - cmd += ['-function', f] |
---|
| 100 | + elif 'identifiers' in self.options: |
---|
| 101 | + identifiers = self.options.get('identifiers').split() |
---|
| 102 | + if identifiers: |
---|
| 103 | + for i in identifiers: |
---|
| 104 | + cmd += ['-function', i] |
---|
94 | 105 | else: |
---|
95 | 106 | cmd += ['-no-doc-sections'] |
---|
| 107 | + |
---|
| 108 | + if 'no-identifiers' in self.options: |
---|
| 109 | + no_identifiers = self.options.get('no-identifiers').split() |
---|
| 110 | + if no_identifiers: |
---|
| 111 | + for i in no_identifiers: |
---|
| 112 | + cmd += ['-nosymbol', i] |
---|
96 | 113 | |
---|
97 | 114 | for pattern in export_file_patterns: |
---|
98 | 115 | for f in glob.glob(env.config.kerneldoc_srctree + '/' + pattern): |
---|
.. | .. |
---|
131 | 148 | lineoffset = int(match.group(1)) - 1 |
---|
132 | 149 | # we must eat our comments since the upset the markup |
---|
133 | 150 | else: |
---|
134 | | - result.append(line, filename, lineoffset) |
---|
| 151 | + doc = env.srcdir + "/" + env.docname + ":" + str(self.lineno) |
---|
| 152 | + result.append(line, doc + ": " + filename, lineoffset) |
---|
135 | 153 | lineoffset += 1 |
---|
136 | 154 | |
---|
137 | 155 | node = nodes.section() |
---|