packages feed

WEditorHyphen 0.1.0.2 → 0.1.0.3

raw patch · 3 files changed

+52/−21 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

WEditorHyphen.cabal view
@@ -1,5 +1,5 @@ name:                WEditorHyphen-version:             0.1.0.2+version:             0.1.0.3 synopsis:            Language-specific hyphenation policies for WEditor.  description:
WEditorHyphen/LangHyphen.hs view
@@ -83,35 +83,56 @@     | null cs || null (hyphenChar l) = False     | otherwise = hyphenChar l `isSuffixOf` cs +-- Set the language-specific minimum line width here. minWidth :: Language -> Int minWidth _ = 8  wordChars :: Language -> Char -> Bool-wordChars l c = generalCategory c `elem` cats l || noSplitChars l c where-  -- Add language-specific tokenizing rules here.-  cats _ = [UppercaseLetter,-            LowercaseLetter,-            TitlecaseLetter,-            ModifierLetter,-            OtherLetter,-            NonSpacingMark,-            SpacingCombiningMark,-            DashPunctuation]+wordChars = check where+  -- Override the language-specific predicate here.+  check l@English_US c = checkDefault l c || c `elem` "'"+  check l@English_GB c = checkDefault l c || c `elem` "'"+  check l c = checkDefault l c+  -- Override the language-specific character categories here.+  cats _ = defaultCats+  -- Leave the stuff below here alone.+  checkDefault l c = generalCategory c `elem` cats l || noSplitChars l c+  defaultCats = [+      DashPunctuation,+      LowercaseLetter,+      ModifierLetter,+      NonSpacingMark,+      OtherLetter,+      SpacingCombiningMark,+      TitlecaseLetter,+      UppercaseLetter+    ]  noSplitChars :: Language -> Char -> Bool-noSplitChars l c = generalCategory c `elem` cats l where-  -- Add language-specific punctuation rules here.-  cats _ = [DecimalNumber,-            OtherNumber,-            ConnectorPunctuation,-            InitialQuote,-            FinalQuote,-            OtherPunctuation,-            CurrencySymbol]+noSplitChars = check where+  -- Override the language-specific predicate here.+  check l@English_US c = checkDefault l c && not (c `elem` "'")+  check l@English_GB c = checkDefault l c && not (c `elem` "'")+  check l c = checkDefault l c+  -- Override the language-specific character categories here.+  cats _ = defaultCats+  -- Leave the stuff below here alone.+  checkDefault l c = generalCategory c `elem` cats l+  defaultCats = [+      ConnectorPunctuation,+      CurrencySymbol,+      DecimalNumber,+      FinalQuote,+      InitialQuote,+      OtherNumber,+      OtherPunctuation+    ] +-- Set language-specific whitespace detection here. whitespaceChars :: Language -> Char -> Bool whitespaceChars _ c = isSeparator c +-- Set the language-specific hyphen char here. hyphenChar :: Language -> [Char] hyphenChar _ = "-" 
test/TestLangHyphen.hs view
@@ -84,7 +84,17 @@        [innerLine "pseudo-",         hyphenLine "some",         hyphenLine "thing",-        endLine "ness"])+        endLine "ness"]),+    ("langHyphen English_US apostrophe toward end", checkLineBreak+       (setLineWidth (breakWords (langHyphen English_US)) 8)+       "something's"+       [hyphenLine "some",+        endLine"thing's"]),+    ("langHyphen English_US trailing apostrophe not left hanging", checkLineBreak+       (setLineWidth (breakWords (langHyphen English_US)) 8)+       "    aren't"+       [innerLine "    ",+        endLine "aren't"])   ]  checkLineBreak b x ys = do