-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply default docs edit rules to installation docs #2211
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but CI is failing.
contentBytes, err := applyEditRules([]byte(contentStr), docFile) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return contentBytes, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contentBytes, err := applyEditRules([]byte(contentStr), docFile) | |
if err != nil { | |
return nil, err | |
} | |
return contentBytes, nil | |
return applyEditRules([]byte(contentStr), docFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in next PRs I'll be adding more here so I'll need the contentBytes
for the next transformation 😅
pkg/tfgen/installation_docs.go
Outdated
// Obtain default edit rules for documentation files | ||
edits := defaultEditRules() | ||
|
||
// Additional edit rules for installation files | ||
installationFileEdits := editRules{ | ||
// Replace all "T/terraform" with "P/pulumi" | ||
reReplace(`Terraform`, `Pulumi`), | ||
reReplace(`terraform`, `pulumi`), | ||
// Replace all "H/hashicorp" strings | ||
reReplace(`Hashicorp`, `Pulumi`), | ||
reReplace(`hashicorp`, `pulumi`), | ||
// Reformat certain headers | ||
reReplace(`The following arguments are supported`, | ||
`The following configuration inputs are supported`), | ||
reReplace(`Argument Reference`, | ||
`Configuration Reference`), | ||
reReplace(`block contains the following arguments`, | ||
`input has the following nested fields`), | ||
} | ||
|
||
edits = append(edits, installationFileEdits...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the shorter version reads better.
// Obtain default edit rules for documentation files | |
edits := defaultEditRules() | |
// Additional edit rules for installation files | |
installationFileEdits := editRules{ | |
// Replace all "T/terraform" with "P/pulumi" | |
reReplace(`Terraform`, `Pulumi`), | |
reReplace(`terraform`, `pulumi`), | |
// Replace all "H/hashicorp" strings | |
reReplace(`Hashicorp`, `Pulumi`), | |
reReplace(`hashicorp`, `pulumi`), | |
// Reformat certain headers | |
reReplace(`The following arguments are supported`, | |
`The following configuration inputs are supported`), | |
reReplace(`Argument Reference`, | |
`Configuration Reference`), | |
reReplace(`block contains the following arguments`, | |
`input has the following nested fields`), | |
} | |
edits = append(edits, installationFileEdits...) | |
edits := append(defaultEditRules(), | |
// Replace all "T/terraform" with "P/pulumi" | |
reReplace(`Terraform`, `Pulumi`), | |
reReplace(`terraform`, `pulumi`), | |
// Replace all "H/hashicorp" strings | |
reReplace(`Hashicorp`, `Pulumi`), | |
reReplace(`hashicorp`, `pulumi`), | |
// Reformat certain headers | |
reReplace(`The following arguments are supported`, | |
`The following configuration inputs are supported`), | |
reReplace(`Argument Reference`, | |
`Configuration Reference`), | |
reReplace(`block contains the following arguments`, | |
`input has the following nested fields`), | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me!
d15f94b
to
c956c49
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2211 +/- ##
==========================================
+ Coverage 60.59% 60.61% +0.01%
==========================================
Files 356 356
Lines 46338 46368 +30
==========================================
+ Hits 28079 28105 +26
- Misses 16701 16705 +4
Partials 1558 1558 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR has been shipped in release v3.88.0. |
Adds default doc edit rules plus a few more installation-doc specific edit rules to the plain docs parser functionality.
Fixes #2208