Skip to content

Commit b917fb7

Browse files
yanns1oaubert
authored andcommitted
Fix regression in [OUT] parameters handling
Out parameters that have documentation spanning multiple lines were not flagged as out parameters, because only the presence of `[OUT]` in the _first_ documentation line was checked. This commit fixes the issue be checking the presence of `[OUT]` in other lines as well. The concerned functions are: - `libvlc_media_discoverer_list_get` - `libvlc_media_player_get_full_chapter_descriptions` - `libvlc_media_player_get_full_title_descriptions` - `libvlc_media_slaves_get` - `libvlc_media_tracks_get` - `libvlc_renderer_discoverer_list_get`
1 parent 9840346 commit b917fb7

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

generator/generate.py

+27-1
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,8 @@ def docs_in_sphinx_format(self, first=0) -> str:
700700
r = []
701701
v = []
702702
block = None
703+
block_is_params = False
704+
last_param_name = None
703705

704706
lines = self.base_sphinx_format(self.docs)
705707

@@ -712,6 +714,7 @@ def docs_in_sphinx_format(self, first=0) -> str:
712714
if block is None:
713715
indent = ""
714716
block = heads
717+
block_is_params = False
715718

716719
# Check whether there is a blonk line right before the @code line.
717720
# If not, add one (needed for sphinx to properly display the list).
@@ -726,22 +729,35 @@ def docs_in_sphinx_format(self, first=0) -> str:
726729
i += 1
727730

728731
block.append("")
732+
729733
block = None
734+
block_is_params = False
730735
elif ":param" in line:
736+
last_param_name = line.split()[1]
737+
731738
if _OUT_ in line:
732739
line = line.replace(_PNTR_, "")
733-
out.append(line.split()[1])
740+
out.append(last_param_name)
741+
734742
params.append(param_re.sub(r":param \g<param_name>:", line))
743+
735744
block = params
745+
block_is_params = True
736746
elif ":return:" in line:
737747
r.append(line)
748+
738749
block = r
750+
block_is_params = False
739751
elif ":version:" in line:
740752
v.append(line)
753+
741754
block = v
755+
block_is_params = False
742756
elif ":bug:" in line:
743757
b.append(line)
758+
744759
block = b
760+
block_is_params = False
745761
elif "@code" in line: # we are dealing with a code block
746762
# Check whether there is a blonk line right before the @code line.
747763
# If not, add one (needed for sphinx to properly display the code block).
@@ -781,20 +797,30 @@ def docs_in_sphinx_format(self, first=0) -> str:
781797
heads.append(line.replace("@endcode", "").strip())
782798

783799
block = None
800+
block_is_params = False
784801
elif ".. note::" in line:
785802
if i - 1 >= 0 and lines[i - 1]:
786803
heads.append("")
804+
787805
heads.append(line)
806+
788807
block = heads
808+
block_is_params = False
789809
elif ".. warning::" in line:
790810
heads.append(line)
811+
791812
block = heads
813+
block_is_params = False
792814
elif block is not None:
815+
if block_is_params and _OUT_ in line:
816+
out.append(last_param_name)
817+
793818
if line:
794819
block.append(_INDENT_ + line)
795820
else:
796821
block.append(line)
797822
block = None
823+
block_is_params = False
798824
else:
799825
heads.append(line)
800826

0 commit comments

Comments
 (0)