github.com/kata-containers/tests@v0.0.0-20240307153542-772105b56064/cmd/check-markdown/search.go (about)

     1  //
     2  // Copyright (c) 2019 Intel Corporation
     3  //
     4  // SPDX-License-Identifier: Apache-2.0
     5  //
     6  
     7  package main
     8  
     9  // headingByLinkName returns the heading associated with the specified link name.
    10  func (d *Doc) headingByLinkName(linkName string) *Heading {
    11  	for _, heading := range d.Headings {
    12  		if heading.LinkName == linkName {
    13  			return &heading
    14  		}
    15  	}
    16  
    17  	return nil
    18  }
    19  
    20  // heading returns the heading with the name specified.
    21  func (d *Doc) heading(name string) *Heading {
    22  	for _, heading := range d.Headings {
    23  		if name == heading.LinkName {
    24  			return &heading
    25  		}
    26  	}
    27  
    28  	return nil
    29  }