Skip to content

Commit c81023f

Browse files
committed
WIP
1 parent 01b8b2a commit c81023f

File tree

9 files changed

+31
-69
lines changed

9 files changed

+31
-69
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ jobs:
4343
run: |
4444
zip -r MDX.zip MDX -x "*.DS_Store"
4545
cd testdata && ../bin/vale sync && cd -
46-
go test -v ./...
46+
go run main.go

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
MDX.zip
22
/testdata/styles
3+
/testdata/out.md
34

45
# Binaries for programs and plugins
56
*.exe

MDX/.vale.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ CommentDelimiters = {/*, */}
1111
# `<Component>...</Component>`
1212
# `{ ... }`
1313
TokenIgnores = (?sm)((?:import|export) .+?$), \
14-
(<[A-Z]+ ?.+ ?\/>), \
14+
(?<!`)(<\w+ ?.+ ?\/>)(?!`), \
1515
(<[A-Z]\w+>.+?<\/[A-Z]\w+>)
1616

1717
# Exclude:
1818
#
1919
# `<Component \n ... />`
2020
BlockIgnores = (?sm)^(<\w+\n .*\s\/>)$, \
21-
(?sm)^({.+\n.*})
21+
(?sm)^({.+.*})

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ zip:
66
zip -r MDX.zip MDX -x "*.DS_Store"
77

88
sync:
9-
cd testdata && vale sync && vale transform test.mdx > test.md && cd -
9+
cd testdata && vale sync && vale transform test.mdx > out.md && cd -
1010

1111
test: zip sync

go.mod

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
module github.com/errata-ai/Hugo
1+
module github.com/errata-ai/MDX
22

33
go 1.17
4-
5-
require github.com/google/go-cmdtest v0.4.0
6-
7-
require (
8-
github.com/google/go-cmp v0.3.1 // indirect
9-
github.com/google/renameio v0.1.0 // indirect
10-
)

go.sum

Lines changed: 0 additions & 6 deletions
This file was deleted.

main.go

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
11
package main
22

3-
import "os"
3+
import (
4+
"errors"
5+
"os"
6+
"path/filepath"
7+
)
48

5-
func cdf() int {
6-
os.Chdir(os.Args[1])
7-
return 0
9+
func main() {
10+
expected := filepath.Join("testdata", "in.md")
11+
observed := filepath.Join("testdata", "out.md")
12+
13+
// Read the expected and observed files
14+
expectedContent, err := os.ReadFile(expected)
15+
if err != nil {
16+
panic(err)
17+
}
18+
19+
observedContent, err := os.ReadFile(observed)
20+
if err != nil {
21+
panic(err)
22+
}
23+
24+
// Compare the contents of the files
25+
if string(expectedContent) != string(observedContent) {
26+
panic(errors.New("expected and observed files do not match"))
27+
}
828
}

main_test.go

Lines changed: 0 additions & 46 deletions
This file was deleted.

testdata/test.md renamed to testdata/in.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ An `<External>external</External>` component and a `<Local>local one</Local>`.
2121
`<MyComponent id="123" />`
2222

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

2626

2727
```

0 commit comments

Comments
 (0)