@@ -23,11 +23,15 @@ func plainDocsParser(docFile *DocFile, g *Generator) ([]byte, error) {
2323
2424 //TODO: See https://github.com/pulumi/pulumi-terraform-bridge/issues/2078
2525 // - translate code blocks with code choosers
26- // - apply default edit rules
2726 // - reformat TF names
28- // - Translation for certain headers such as "Arguments Reference" or "Configuration block"
2927 // - Ability to omit irrelevant sections
30- return []byte (contentStr ), nil
28+
29+ // Apply edit rules to transform the doc for Pulumi-ready presentation
30+ contentBytes , err := applyEditRules ([]byte (contentStr ), docFile )
31+ if err != nil {
32+ return nil , err
33+ }
34+ return contentBytes , nil
3135}
3236
3337func writeFrontMatter (title string ) string {
@@ -91,3 +95,32 @@ func writeInstallationInstructions(goImportBasePath, providerName string) string
9195 goImportBasePath ,
9296 )
9397}
98+
99+ func applyEditRules (contentBytes []byte , docFile * DocFile ) ([]byte , error ) {
100+ // Obtain default edit rules for documentation files
101+ edits := defaultEditRules ()
102+
103+ // Additional edit rules for installation files
104+ edits = append (edits ,
105+ // Replace all "T/terraform" with "P/pulumi"
106+ reReplace (`Terraform` , `Pulumi` ),
107+ reReplace (`terraform` , `pulumi` ),
108+ // Replace all "H/hashicorp" strings
109+ reReplace (`Hashicorp` , `Pulumi` ),
110+ reReplace (`hashicorp` , `pulumi` ),
111+ // Reformat certain headers
112+ reReplace (`The following arguments are supported` ,
113+ `The following configuration inputs are supported` ),
114+ reReplace (`Argument Reference` ,
115+ `Configuration Reference` ),
116+ reReplace (`block contains the following arguments` ,
117+ `input has the following nested fields` ))
118+ var err error
119+ for _ , rule := range edits {
120+ contentBytes , err = rule .Edit (docFile .FileName , contentBytes )
121+ if err != nil {
122+ return nil , err
123+ }
124+ }
125+ return contentBytes , nil
126+ }
0 commit comments