Monorepo for Tangled tangled.org
2

Configure Feed

Select the types of activity you want to include in your feed.

appview/markup: restrict README candidate matching

Restricts README detection to `README` or `README.<single_extension>` filenames only, preventing files like `README.Music.md` being selected to be rendered over `README.md`

Fixes [#604](https://tangled.org/tangled.org/core/issues/604)

Signed-off-by: Smit Patil <smit@smit.codes>

+7 -4
+1 -1
appview/pages/markup/format.go
··· 17 17 FormatMarkdown: regexp.MustCompile(`(?i)\.(md|markdown|mdown|mkdn|mkd)$`), 18 18 } 19 19 20 - var ReadmePattern = regexp.MustCompile(`(?i)^readme(?:[._-].+)?$`) 20 + var ReadmePattern = regexp.MustCompile(`(?i)^readme(?:\.[^.]+)?$`) 21 21 22 22 // IsReadmeFile reports whether name/mode identifies a readme blob. The git 23 23 // mode is checked so directories or symlinks named "readme" are filtered out.
+6 -3
appview/pages/markup/format_test.go
··· 30 30 {"readme", dirMode, false}, 31 31 {"README.md", dirMode, false}, 32 32 33 - // readme is matched by convention, not by renderable format — 33 + // readme is matched by convention, not by renderable format; 34 34 // unsupported markup falls through to plaintext in GetFormat. 35 35 {"README.rst", fileMode, true}, 36 36 {"README.org", fileMode, true}, 37 - {"readme-old", fileMode, true}, 38 - {"readme_legacy", fileMode, true}, 37 + {"README.asciidoc", fileMode, true}, 38 + {"README.foo", fileMode, true}, 39 39 40 + {"README.Music.md", fileMode, false}, 41 + {"readme-old", fileMode, false}, 42 + {"readme_legacy", fileMode, false}, 40 43 {"notreadme.md", fileMode, false}, 41 44 {"READMEISH", fileMode, false}, 42 45 {"README.md", "", false},