67 lines · 1.8 KB · Text
RawDownload
module Parser.Unlit import public Text.Literate %default total%access export public exportdata LiterateModes = Bird | Org | CMark exportstyleBird : LiterateStylestyleBird = MkLitStyle Nil [">", "<"] [".lidr"] exportstyleOrg : LiterateStylestyleOrg = MkLitStyle              [ ("#+BEGIN_SRC idris","#+END_SRC")              , ("#+begin_src idris","#+end_src")              , ("#+COMMENT idris","#+END_COMMENT")              , ("#+comment idris","#+end_comment")]              ["#+IDRIS:"]              [".org"] exportstyleCMark : LiterateStylestyleCMark = MkLitStyle [("```idris", "```")] Nil [".md"] exportisLitFile : String -> Maybe LiterateStyleisLitFile fname =    case isStyle styleBird of      Just s => Just s      Nothing => case isStyle styleOrg of                     Just s => Just s                     Nothing => isStyle styleCMark   where   hasSuffix : String -> Bool   hasSuffix ext = isSuffixOf ext fname    isStyle : LiterateStyle -> Maybe LiterateStyle   isStyle style =     if any hasSuffix (file_extensions style)      then Just style      else Nothing exportisLitLine : String -> (Maybe String, String)isLitLine str =  case isLiterateLine styleBird str of     (Just l, s) => (Just l, s)     otherwise => case isLiterateLine styleOrg str of                    (Just l, s) => (Just l, s)                    otherwise => case isLiterateLine styleCMark str of                                   (Just l, s) => (Just l, s)                                   otherwise => (Nothing, str) exportunlit : Maybe LiterateStyle -> String -> Either LiterateError Stringunlit Nothing  str = Right strunlit (Just s) str = unlit s str exportrelit : Maybe String -> String -> Stringrelit Nothing     str = strrelit (Just mark) str = unwords [mark, str]

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t