-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize strings when they are read from the filesystem, fixes #48
This ensures all characters in string are precomposed. https://blog.golang.org/normalization * Normalize first * Change position of normalization * Add documentation * Add dependency for text/unicode/norm * Add tests for composing title strings * Fix Year and Format
- Loading branch information
1 parent
aa62a61
commit 4a68e77
Showing
37 changed files
with
24,700 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2018 Atelier Disko. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
) | ||
|
||
func TestDocTitlesWithDecomposedFilenames(t *testing.T) { | ||
tmp, _ := ioutil.TempDir("", "tree") | ||
defer os.RemoveAll(tmp) | ||
|
||
node0 := filepath.Join(tmp, "foo") | ||
os.Mkdir(node0, 0777) | ||
|
||
doc0 := filepath.Join(node0, "01-Cafe\u0301.md") | ||
ioutil.WriteFile(doc0, []byte(""), 0666) | ||
|
||
node := &Node{root: tmp, path: filepath.Join(tmp, "foo")} | ||
|
||
docs, err := node.Docs() | ||
if err != nil { | ||
t.Errorf("can’t read docs") | ||
} | ||
|
||
if docs[0].Title() != "Café" { | ||
t.Errorf("failed to decode file name, got %v", docs[0].Title()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.