diff --git a/changelog.xml b/changelog.xml index eebd1433..2aaba428 100644 --- a/changelog.xml +++ b/changelog.xml @@ -34,6 +34,9 @@ Fix false positives when using siunitx (LaTeX) + + Fix unquoted languages in YAML front matter not parsed correctly + Fix plural dummy in German languages diff --git a/src/main/kotlin/org/bsplines/ltexls/parsing/markdown/MarkdownFragmentizer.kt b/src/main/kotlin/org/bsplines/ltexls/parsing/markdown/MarkdownFragmentizer.kt index 471663c8..f9502dc0 100644 --- a/src/main/kotlin/org/bsplines/ltexls/parsing/markdown/MarkdownFragmentizer.kt +++ b/src/main/kotlin/org/bsplines/ltexls/parsing/markdown/MarkdownFragmentizer.kt @@ -52,8 +52,8 @@ class MarkdownFragmentizer(codeLanguageId: String) : CodeFragmentizer(codeLangua companion object { private val YAML_FRONT_MATTER_REGEX = Regex( - "\\A---[ \t]*$.*?^lang:[ \t]+(?:\"(.+)\"|'(.+)'|(.+))$.*?^---[ \t]*$", - setOf(RegexOption.MULTILINE, RegexOption.DOT_MATCHES_ALL), + "\\A---[ \t]*$(?s).*?(?-s)^lang:[ \t]+(?:\"(.+)\"|'(.+)'|(.+))$(?s).*?(?-s)^---[ \t]*$", + RegexOption.MULTILINE, ) private val COMMENT_REGEX = Regex( diff --git a/src/test/kotlin/org/bsplines/ltexls/parsing/markdown/MarkdownFragmentizerTest.kt b/src/test/kotlin/org/bsplines/ltexls/parsing/markdown/MarkdownFragmentizerTest.kt index 3869ee2e..1f7d5a20 100644 --- a/src/test/kotlin/org/bsplines/ltexls/parsing/markdown/MarkdownFragmentizerTest.kt +++ b/src/test/kotlin/org/bsplines/ltexls/parsing/markdown/MarkdownFragmentizerTest.kt @@ -47,6 +47,7 @@ class MarkdownFragmentizerTest { """ --- lang: 'de-DE' + abc: def --- This is a test. @@ -61,6 +62,7 @@ class MarkdownFragmentizerTest { """ --- lang: de-DE + abc: def --- This is a test.