saltstack-formulas / template-formula

SaltStack formula template filled with dummy content
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
119 stars 85 forks source link

fix(convert-formula.sh): fix reST underlining during conversion #237

Closed dafyddj closed 3 years ago

dafyddj commented 3 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

NA

Describe the changes you're proposing

Fix the conversion script so that reST section headings/underlines match the length of the new formula name.

Pillar / config required to test the proposed changes

NA

Debug log showing how the proposed changes work

$ DEBUG=true bin/convert-formula.sh my-long_name-test
...
++ repeat_char =                                                                                                                                                                                                   
++ printf %17s                                                                                           
++ tr ' ' =                                                                                              
++ repeat_char '^'                                                                                       
++ printf %17s                                                                                           
++ tr ' ' '^'                                                                                            
++ repeat_char '`'                                                                                       
++ printf %17s                                                                                           
++ tr ' ' '`'                                                                                            
+ sedi '/TEMPLATE/{                                                                                      
        n                                                                                                
        s/========/=================/                                                                    
        s/\^^^^^^^^/\^^^^^^^^^^^^^^^^^/                                                                  
        s/````````/`````````````````/                                                                    
        }' docs/README.rst docs/map.jinja.rst                                                            
+ sed --version                                                                                                                                                                                                    
+ sed -i '' '/TEMPLATE/{                                                                                 
        n                                                                                                
        s/========/=================/                                                                    
        s/\^^^^^^^^/\^^^^^^^^^^^^^^^^^/                                                                  
        s/````````/`````````````````/                                                                    
        }' docs/README.rst docs/map.jinja.rst
# Results in e.g.
$ cat docs/README.rst
...
my-long_name-test-formula
=========================
...
``my-long_name-test.package``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...

Documentation checklist

Testing checklist

Additional context

myii commented 3 years ago

@dafyddj As mentioned in Slack, this commit works for me:

myii commented 3 years ago

Thanks for the excellent fix, @dafyddj -- merged. @baby-gnu Thanks for the review.

saltstack-formulas-travis commented 3 years ago

:tada: This PR is included in version 5.0.3 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: