Skip to content

Commit

Permalink
fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
killers78 committed Mar 13, 2024
1 parent 90a83ca commit 962bbfa
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/convert_md_2_html.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,23 @@ import (

func convertMarkdownToHTML(input string) (string, error) {
output := blackfriday.Run([]byte(input))
fmt.Println("HTML: ", output)
#fmt.Println("HTML: ", output)

Check failure on line 14 in src/convert_md_2_html.go

View workflow job for this annotation

GitHub Actions / build

invalid character U+0023 '#'
return string(output), nil
}

func processFile(path string, info fs.FileInfo, err error) error {
parts := strings.Split(path, "/")

// Verifica se há pelo menos 3 partes (0-indexed)
if len(parts) >= 3 {
// Obtém o elemento na posição 2
platform := parts[2]
product := parts[3]

Check failure on line 25 in src/convert_md_2_html.go

View workflow job for this annotation

GitHub Actions / build

product declared and not used
fmt.Println("Segunda parte do caminho:", platform)
} else {
fmt.Println("O caminho não contém pelo menos 3 partes.")
}

if strings.HasSuffix(path, ".md") {
input, err := ioutil.ReadFile(path)
if err != nil {
Expand All @@ -27,7 +39,7 @@ func processFile(path string, info fs.FileInfo, err error) error {
return err
}

newPath := strings.TrimSuffix(path, ".md") + ".html"
newPath := strings.TrimSuffix(path, ".md") + "-" + platform + "-" + product + ".html"

Check failure on line 42 in src/convert_md_2_html.go

View workflow job for this annotation

GitHub Actions / build

undefined: platform

Check failure on line 42 in src/convert_md_2_html.go

View workflow job for this annotation

GitHub Actions / build

undefined: product
err = ioutil.WriteFile(newPath, []byte(htmlContent), info.Mode())
if err != nil {
return err
Expand Down

0 comments on commit 962bbfa

Please sign in to comment.