Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Nov 20, 2024
1 parent 01b8b2a commit c81023f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
run: |
zip -r MDX.zip MDX -x "*.DS_Store"
cd testdata && ../bin/vale sync && cd -
go test -v ./...
go run main.go
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
MDX.zip
/testdata/styles
/testdata/out.md

# Binaries for programs and plugins
*.exe
Expand Down
4 changes: 2 additions & 2 deletions MDX/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ CommentDelimiters = {/*, */}
# `<Component>...</Component>`
# `{ ... }`
TokenIgnores = (?sm)((?:import|export) .+?$), \
(<[A-Z]+ ?.+ ?\/>), \
(?<!`)(<\w+ ?.+ ?\/>)(?!`), \
(<[A-Z]\w+>.+?<\/[A-Z]\w+>)

# Exclude:
#
# `<Component \n ... />`
BlockIgnores = (?sm)^(<\w+\n .*\s\/>)$, \
(?sm)^({.+\n.*})
(?sm)^({.+.*})
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ zip:
zip -r MDX.zip MDX -x "*.DS_Store"

sync:
cd testdata && vale sync && vale transform test.mdx > test.md && cd -
cd testdata && vale sync && vale transform test.mdx > out.md && cd -

test: zip sync
9 changes: 1 addition & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
module github.com/errata-ai/Hugo
module github.com/errata-ai/MDX

go 1.17

require github.com/google/go-cmdtest v0.4.0

require (
github.com/google/go-cmp v0.3.1 // indirect
github.com/google/renameio v0.1.0 // indirect
)
6 changes: 0 additions & 6 deletions go.sum

This file was deleted.

28 changes: 24 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
package main

import "os"
import (
"errors"
"os"
"path/filepath"
)

func cdf() int {
os.Chdir(os.Args[1])
return 0
func main() {
expected := filepath.Join("testdata", "in.md")
observed := filepath.Join("testdata", "out.md")

// Read the expected and observed files
expectedContent, err := os.ReadFile(expected)
if err != nil {
panic(err)
}

observedContent, err := os.ReadFile(observed)
if err != nil {
panic(err)
}

// Compare the contents of the files
if string(expectedContent) != string(observedContent) {
panic(errors.New("expected and observed files do not match"))
}
}
46 changes: 0 additions & 46 deletions main_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion testdata/test.md → testdata/in.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ An `<External>external</External>` component and a `<Local>local one</Local>`.
`<MyComponent id="123" />`

You can also use objects with components, such as the `thisOne` component on
the `myComponents` object: <myComponents.thisOne />
the `myComponents` object: `<myComponents.thisOne />`


```
Expand Down

0 comments on commit c81023f

Please sign in to comment.