qapi: Reject section markup in definition documentation
Section markup in definition documentation makes no sense and can produce invalid Texinfo. Reject. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200320091805.5585-2-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
		
							parent
							
								
									62f9256052
								
							
						
					
					
						commit
						d98884b75d
					
				@ -835,6 +835,8 @@ Double the '=' for a subsection title:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # == Subsection title
 | 
					    # == Subsection title
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Both are only permitted in free-form documentation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
'|' denotes examples:
 | 
					'|' denotes examples:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # | Text of the example, may span
 | 
					    # | Text of the example, may span
 | 
				
			||||||
 | 
				
			|||||||
@ -282,6 +282,11 @@ class QAPISchemaParser:
 | 
				
			|||||||
                doc.end_comment()
 | 
					                doc.end_comment()
 | 
				
			||||||
                self.accept()
 | 
					                self.accept()
 | 
				
			||||||
                return doc
 | 
					                return doc
 | 
				
			||||||
 | 
					            if self.val.startswith('# ='):
 | 
				
			||||||
 | 
					                if doc.symbol:
 | 
				
			||||||
 | 
					                    raise QAPIParseError(
 | 
				
			||||||
 | 
					                        self,
 | 
				
			||||||
 | 
					                        "unexpected '=' markup in definition documentation")
 | 
				
			||||||
            doc.append(self.val)
 | 
					            doc.append(self.val)
 | 
				
			||||||
            self.accept(False)
 | 
					            self.accept(False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					doc-bad-section.json:5:1: unexpected '=' markup in definition documentation
 | 
				
			||||||
@ -1,9 +1,8 @@
 | 
				
			|||||||
# = section within an expression comment
 | 
					# = section within an expression comment
 | 
				
			||||||
# BUG: not rejected
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
##
 | 
					##
 | 
				
			||||||
# @Enum:
 | 
					# @Enum:
 | 
				
			||||||
# == Produces *invalid* texinfo
 | 
					# == No good here
 | 
				
			||||||
# @one: The _one_ {and only}
 | 
					# @one: The _one_ {and only}
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# @two is undocumented
 | 
					# @two is undocumented
 | 
				
			||||||
 | 
				
			|||||||
@ -1,24 +0,0 @@
 | 
				
			|||||||
module None
 | 
					 | 
				
			||||||
object q_empty
 | 
					 | 
				
			||||||
enum QType
 | 
					 | 
				
			||||||
    prefix QTYPE
 | 
					 | 
				
			||||||
    member none
 | 
					 | 
				
			||||||
    member qnull
 | 
					 | 
				
			||||||
    member qnum
 | 
					 | 
				
			||||||
    member qstring
 | 
					 | 
				
			||||||
    member qdict
 | 
					 | 
				
			||||||
    member qlist
 | 
					 | 
				
			||||||
    member qbool
 | 
					 | 
				
			||||||
module doc-bad-section.json
 | 
					 | 
				
			||||||
enum Enum
 | 
					 | 
				
			||||||
    member one
 | 
					 | 
				
			||||||
    member two
 | 
					 | 
				
			||||||
doc symbol=Enum
 | 
					 | 
				
			||||||
    body=
 | 
					 | 
				
			||||||
== Produces *invalid* texinfo
 | 
					 | 
				
			||||||
    arg=one
 | 
					 | 
				
			||||||
The _one_ {and only}
 | 
					 | 
				
			||||||
    arg=two
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    section=None
 | 
					 | 
				
			||||||
@two is undocumented
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user