Skip to content

Commit

Permalink
Fix final heading bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
iwahbe committed Aug 14, 2024
1 parent c584ae5 commit 7adba83
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/tfgen/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ func (p *tfMarkdownParser) parseSection(h2Section []string) error {
}

// For all other sections, append them to the description section.
if !wroteHeader {
if !wroteHeader && header != "" {
p.ret.Description += fmt.Sprintf("## %s\n", header)
wroteHeader = true
if !isBlank(reformattedH3Section[0]) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/tfgen/test_data/TestConvertViaPulumiCLI/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"resources": {
"simple:index:resource": {
"description": "## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as simple from \"@pulumi/simple\";\n\nconst aResource = new simple.Resource(\"a_resource\", {\n renamedInput1: \"hello\",\n inputTwo: \"true\",\n});\nexport const someOutput = aResource.result;\n```\n```python\nimport pulumi\nimport pulumi_simple as simple\n\na_resource = simple.Resource(\"a_resource\",\n renamed_input1=\"hello\",\n input_two=\"true\")\npulumi.export(\"someOutput\", a_resource.result)\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Simple = Pulumi.Simple;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var aResource = new Simple.Resource(\"a_resource\", new()\n {\n RenamedInput1 = \"hello\",\n InputTwo = \"true\",\n });\n\n return new Dictionary\u003cstring, object?\u003e\n {\n [\"someOutput\"] = aResource.Result,\n };\n});\n```\n```go\npackage main\n\nimport (\n\t\"example.com/pulumi-simple/sdk/go/simple\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\taResource, err := simple.Newresource(ctx, \"a_resource\", \u0026simple.resourceArgs{\n\t\t\tRenamedInput1: pulumi.String(\"hello\"),\n\t\t\tInputTwo: pulumi.String(\"true\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tctx.Export(\"someOutput\", aResource.Result)\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.simple.resource;\nimport com.pulumi.simple.ResourceArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var aResource = new Resource(\"aResource\", ResourceArgs.builder()\n .renamedInput1(\"hello\")\n .inputTwo(true)\n .build());\n\n ctx.export(\"someOutput\", aResource.result());\n }\n}\n```\n```yaml\nresources:\n aResource:\n type: simple:resource\n name: a_resource\n properties:\n renamedInput1: hello\n inputTwo: true\noutputs:\n someOutput: ${aResource.result}\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n##Extras\n",
"description": "Sample resource.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as simple from \"@pulumi/simple\";\n\nconst aResource = new simple.Resource(\"a_resource\", {\n renamedInput1: \"hello\",\n inputTwo: \"true\",\n});\nexport const someOutput = aResource.result;\n```\n```python\nimport pulumi\nimport pulumi_simple as simple\n\na_resource = simple.Resource(\"a_resource\",\n renamed_input1=\"hello\",\n input_two=\"true\")\npulumi.export(\"someOutput\", a_resource.result)\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Simple = Pulumi.Simple;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var aResource = new Simple.Resource(\"a_resource\", new()\n {\n RenamedInput1 = \"hello\",\n InputTwo = \"true\",\n });\n\n return new Dictionary\u003cstring, object?\u003e\n {\n [\"someOutput\"] = aResource.Result,\n };\n});\n```\n```go\npackage main\n\nimport (\n\t\"example.com/pulumi-simple/sdk/go/simple\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\taResource, err := simple.Newresource(ctx, \"a_resource\", \u0026simple.resourceArgs{\n\t\t\tRenamedInput1: pulumi.String(\"hello\"),\n\t\t\tInputTwo: pulumi.String(\"true\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tctx.Export(\"someOutput\", aResource.Result)\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.simple.resource;\nimport com.pulumi.simple.ResourceArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var aResource = new Resource(\"aResource\", ResourceArgs.builder()\n .renamedInput1(\"hello\")\n .inputTwo(true)\n .build());\n\n ctx.export(\"someOutput\", aResource.result());\n }\n}\n```\n```yaml\nresources:\n aResource:\n type: simple:resource\n name: a_resource\n properties:\n renamedInput1: hello\n inputTwo: true\noutputs:\n someOutput: ${aResource.result}\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n##Extras\n",
"properties": {
"inputTwo": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion pkg/tfgen/test_data/custom-replaces/expected.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Description": "## \n\nThis is a test for checking custom replaces.",
"Description": "This is a test for checking custom replaces.",
"Arguments": {},
"Attributes": {},
"Import": ""
Expand Down
2 changes: 1 addition & 1 deletion pkg/tfgen/test_data/link/expected.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Description": "## \n\nThis is a test that we correctly strip TF doc links.\n\nThis is another test that we correctly strip TF import links.\n\nWe also make sure that we strip TF registry doc links.",
"Description": "This is a test that we correctly strip TF doc links.\n\nThis is another test that we correctly strip TF import links.\n\nWe also make sure that we strip TF registry doc links.",
"Arguments": {},
"Attributes": {},
"Import": ""
Expand Down
2 changes: 1 addition & 1 deletion pkg/tfgen/test_data/simple/expected.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Description": "## \n\n \tThis is a document for the pkg_mod1_res1 resource. To create this resource, run \"pulumi preview\" then \"pulumi up\".\n \tThe specified email must be valid: `jdoe@example.com`.\n\n The description will say \"Made by Pulumi\" or \"Made with Pulumi\".",
"Description": "This is a document for the pkg_mod1_res1 resource. To create this resource, run \"pulumi preview\" then \"pulumi up\".\n \tThe specified email must be valid: `jdoe@example.com`.\n\n The description will say \"Made by Pulumi\" or \"Made with Pulumi\".",
"Arguments": {},
"Attributes": {},
"Import": ""
Expand Down

0 comments on commit 7adba83

Please sign in to comment.