Skip to content

Commit

Permalink
Extras moved to /extra folder and their own modules
Browse files Browse the repository at this point in the history
  • Loading branch information
EwenQuim committed Jul 22, 2024
1 parent d36673d commit 1c9019e
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 10 deletions.
7 changes: 6 additions & 1 deletion examples/full-app-gourmet/go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module github.com/go-fuego/fuego/examples/full-app-gourmet

go 1.22.2
go 1.22.5

require (
github.com/a-h/templ v0.2.747
github.com/go-chi/chi/v5 v5.1.0
github.com/go-fuego/fuego v0.14.0-rc2
github.com/go-fuego/fuego/extra/markdown v0.0.0-00010101000000-000000000000
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/golang-migrate/migrate/v4 v4.17.1
github.com/google/uuid v1.6.0
Expand Down Expand Up @@ -57,3 +58,7 @@ require (
)

replace github.com/go-fuego/fuego => ../..

replace github.com/go-fuego/fuego/extra/markdown => ../../extra/markdown

replace github.com/go-fuego/fuego/middleware/cache => ../../middleware/cache
4 changes: 2 additions & 2 deletions examples/full-app-gourmet/templa/recipe.page.templ
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"strconv"
"context"
"io"
"github.com/go-fuego/fuego/extra/markdown"
"github.com/go-fuego/fuego/examples/full-app-gourmet/store"
"github.com/go-fuego/fuego/examples/full-app-gourmet/templa/components"
"github.com/go-fuego/fuego"
)

func Unsafe(html string) templ.Component {
Expand Down Expand Up @@ -144,7 +144,7 @@ templ RecipePage(props RecipePageProps, generalProps GeneralProps) {
<div class="md:col-span-2 space-y-2">
<h2 class="text-2xl font-semibold text-gray-800 dark:text-gray-200 mt-0">Instructions</h2>
<p class="dark:text-gray-100">
@Unsafe(string(fuego.Markdown(props.Recipe.Instructions)))
@Unsafe(string(markdown.Markdown(props.Recipe.Instructions)))
</p>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion examples/full-app-gourmet/views/recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/go-fuego/fuego/examples/full-app-gourmet/static"
"github.com/go-fuego/fuego/examples/full-app-gourmet/store"
"github.com/go-fuego/fuego/examples/full-app-gourmet/templa"
"github.com/go-fuego/fuego/extra/markdown"

"github.com/go-fuego/fuego"
"github.com/google/uuid"
Expand Down Expand Up @@ -274,7 +275,7 @@ func (rs Ressource) RecipePage(c fuego.ContextNoBody) (fuego.HTML, error) {
return c.Render("pages/recipe.page.html", fuego.H{
"Recipe": recipe,
"Ingredients": ingredients,
"Instructions": fuego.Markdown(recipe.Instructions),
"Instructions": markdown.Markdown(recipe.Instructions),
})
}

Expand Down
5 changes: 5 additions & 0 deletions extra/markdown/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/go-fuego/fuego/extra/markdown

go 1.22.5

require github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024
2 changes: 2 additions & 0 deletions extra/markdown/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024 h1:saBP362Qm7zDdDXqv61kI4rzhmLFq3Z1gx34xpl6cWE=
github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA=
2 changes: 1 addition & 1 deletion views.go → extra/markdown/markdown.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fuego
package markdown

import (
"html/template"
Expand Down
2 changes: 1 addition & 1 deletion views_test.go → extra/markdown/markdown_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fuego
package markdown

import (
"html/template"
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
github.com/getkin/kin-openapi v0.123.0
github.com/go-playground/validator/v10 v10.19.0
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/gomarkdown/markdown v0.0.0-20231222211730-1d6d20845b47
github.com/gorilla/schema v1.4.1
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/stretchr/testify v1.9.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/gomarkdown/markdown v0.0.0-20231222211730-1d6d20845b47 h1:k4Tw0nt6lwro3Uin8eqoET7MDA4JnT8YgbCjc/g5E3k=
github.com/gomarkdown/markdown v0.0.0-20231222211730-1d6d20845b47/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA=
github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E=
github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
Expand Down
3 changes: 2 additions & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.22.4
go 1.22.5

use (
.
Expand All @@ -9,5 +9,6 @@ use (
./examples/full-app-gourmet
./examples/hello-world
./examples/openapi
./extra/markdown
./testing-from-outside
)

0 comments on commit 1c9019e

Please sign in to comment.