lentil 1.0.11.4 → 1.1.0.0
raw patch · 12 files changed
+171/−42 lines, 12 files
Files
- authors.txt +22/−0
- changes.txt +7/−0
- contributors.txt +0/−22
- doc/usr/page.rst +4/−2
- issues.txt +1/−4
- lentil.cabal +4/−4
- src/Lentil/Parse/Run.hs +0/−1
- src/Lentil/Parse/Source.hs +80/−7
- src/Lentil/Parse/Syntaxes.hs +3/−1
- src/Main.hs +1/−1
- test/Lentil/Parse/RunSpec.hs +3/−0
- test/Lentil/Parse/SourceSpec.hs +46/−0
+ authors.txt view
@@ -0,0 +1,22 @@+(in alphabetical order)++Michał Antkiewi+Francesco Ariis+Damien Couroussé+Ben Franksen+Artyom Kazak+Anton Felix Lorenzen+Rodney Lorrimar+Francesco Mazzoli+Eric Mertens+Simon Michael+Luca Molteni+Luke Murphy+Qptain Nemo+Mats Rauhala+Stefano Rodighiero+Peter Simons+Henning Thielemann+Tomislav+Tuncer Ayaz+YongJoon Joe
changes.txt view
@@ -1,3 +1,10 @@+1.1.0.0+-------++- Released Tue 30 Oct 2018 19:31:59 CET+- Added org-mode support (Damien Couroussé), both for TODO and+ list-like (checkboxes) items.+ 1.0.11.4 --------
− contributors.txt
@@ -1,22 +0,0 @@-(in alphabetical order)--Michał Antkiewi-Francesco Ariis-Damien Couroussé-Ben Franksen-Artyom Kazak-Anton Felix Lorenzen-Rodney Lorrimar-Francesco Mazzoli-Eric Mertens-Simon Michael-Luca Molteni-Luke Murphy-Qptain Nemo-Mats Rauhala-Stefano Rodighiero-Peter Simons-Henning Thielemann-Tomislav-Tuncer Ayaz-YongJoon Joe
doc/usr/page.rst view
@@ -179,6 +179,7 @@ - Standard ML source files (``.sml``) - OpenGL Shading Language source files (``.glsl``) - Restructured Text (Sphinx) ``.. ::todo`` directives (``.rst``)+- Org mode for Emacs files (``.org``), both ``TODO`` and list-like items - plain text files (``.txt``) If you want a file type ``.xyz`` to be recognised as one in the list above,@@ -256,8 +257,9 @@ The ``-f TYPE`` option modifies the output format, with ``pretty`` being the default. -``-f csv`` export issues to CSV (RFC 4180).+``-f csv`` exports issues to CSV (RFC 4180). +``-f xml`` exports issues to XML. ``-f tagpop``, lists tags by their popularity (reverse order), useful to get a summary of open issues:@@ -287,7 +289,7 @@ alpha.hs:11: add a type signature to replace [lint] -This is useful because it is recognised by editors like EMACS,+This is useful because it is recognised by editors like Emacs, which can turn them into active links to the relevant file/position. .. raw:: html
issues.txt view
@@ -7,14 +7,11 @@ src/Lentil/File.hs 77 combine funziona su windows? [test] -src/Lentil/Parse/Run.hs- 57 a function String -> [Issue]- src/Lentil/Parse/Syntaxes.hs 25 qptain_nemo fake multiline comments in C (i.e. // and \ at the bottom of the line, continued into next line, are valid C comments but not recognised by lentil [u:1] [request]- 99 rst parser doesn't respect whitespace or paragraphs. How to+ 100 rst parser doesn't respect whitespace or paragraphs. How to implement this without breaking other parsers? [bug] [design] src/Main.hs
lentil.cabal view
@@ -1,5 +1,5 @@ name: lentil-version: 1.0.11.4+version: 1.1.0.0 synopsis: frugal issue tracker description: minumum effort, cohesive issue tracker based on ubiquitous @TODO@s and @FIXME@s conventions.@@ -7,10 +7,10 @@ homepage: http://www.ariis.it/static/articles/lentil/page.html license: GPL-3 license-file: LICENSE-author: Francesco Ariis <fa-ml@ariis.it>+author: Francesco Ariis <fa-ml@ariis.it> plus authors.txt maintainer: Francesco Ariis <fa-ml@ariis.it> copyright: © 2015-2018 Francesco Ariis-category: Development+category: Development, Project Management stability: Stable build-type: Simple tested-with: GHC==8.0.1, GHC==8.2.2, GHC==8.4.1, GHC==8.6.1@@ -46,7 +46,7 @@ test/test-files/test-proj/dot-folders/.alfa/foo1.hs, test/test-files/test-proj/dot-folders/_beta/foo1.hs extra-doc-files: README, changes.txt, doc/usr/page.rst, doc/usr/test.zip,- issues.txt, contributors.txt+ issues.txt, authors.txt cabal-version: 1.24 flag developer
src/Lentil/Parse/Run.hs view
@@ -54,7 +54,6 @@ each tra >-> comm2Issues fws --- todo a function String -> [Issue] (w/o IO) [debug] [refactor] ----------- -- PIPES --
src/Lentil/Parse/Source.hs view
@@ -35,7 +35,8 @@ psStringLits :: [Char], psCharStyle :: CharStyle, psCharLits :: [Char] }- | RstSyntax -- reStructuredText/sphinx parsing+ | OrgModeSyntax -- org-mode parsing+ | RstSyntax -- reStructuredText/sphinx parsing deriving (Show) data EscapeStyle = ClangLike | SQLLike@@ -57,7 +58,7 @@ lineComment s = SingleLine <$> (initId s *> getRow) <*> manyTill anyChar newline- <?> "line comment"+ <?> "line comment" where -- for 1-char line comments (#, ;, etc.), erases repeating initId :: String -> ParSource ()@@ -68,7 +69,7 @@ blockComment (i, e) = MultiLine <$> (string i *> getRow) <*> manyTill anyChar (try $ string e)- <?> "block comment"+ <?> "block comment" getRow :: ParSource Row getRow = fmap sourceLine getPosition@@ -87,7 +88,7 @@ -- quoted strings, escaped by \, by mauke^ cString :: Char -> ParSource String cString ic = q *> many ((char '\\' *> anyChar) <|> noneOf no) <* q- <?> "codestring"+ <?> "codestring" where q = char ic no = C.showLitChar ic "\\" @@ -109,7 +110,7 @@ -- quoted single character commonChar :: Char -> ParSource Char commonChar ic = q *> ((char '\\' *> anyChar) <|> anyChar) <* q- <?> "char string sign"+ <?> "char string sign" where q = char ic -- $a for 'a' (where ic = '$')@@ -147,7 +148,8 @@ ----------------------- rstDocumentPart :: ParSource (Maybe CommentString)-rstDocumentPart = choice . map try $ [Just <$> rstTodo, Nothing <$ rstOther]+rstDocumentPart = (choice . map try $ [Just <$> rstTodo, Nothing <$ rstOther])+ <?> "rst document part" -- `.. todo::` directive rstTodo :: ParSource CommentString@@ -185,14 +187,86 @@ if c == 1 then () <$ string ".. todo::" else parserFail "rst todo incipit: not at begin-of-line"+ <?> "rst todo incipit" +---------------------+-- ORG-MODE SYNTAX --+---------------------++orgModeDocument :: ParSource (Maybe CommentString)+orgModeDocument = choice [Just <$> try orgTodo,+ Just <$> try orgListMulti,+ Just <$> try orgListSingle,+ Nothing <$ orgOther]+ <?> "org-mode document"++orgTodo :: ParSource CommentString+orgTodo = lineComment "*" <?> "org TODO"++orgListMulti :: ParSource CommentString+orgListMulti = MultiLine <$>+ (orgInitList *> getRow) <*>+ body+ <?> "org-mode list item over multiple lines"+ where+ body :: ParSource String+ body = (++) <$> pure " TODO " <*>+ manyTill anyChar+ -- A list item over multiple lines terminates either:+ -- + when an empty lines follows the last+ -- line of the current item,+ -- + or when a new list item follows. In+ -- this case, we must not consume the+ -- header of the list item.+ ( try (newline *> newline) <|>+ try (newline <* lookAhead (listMarker *> spaces)) <|>+ (eof *> pure 'x')+ )++orgListSingle :: ParSource CommentString+orgListSingle = SingleLine <$>+ (orgInitList *> getRow) <*>+ body+ <?> "org-mode list item in a single-line"+ where+ body :: ParSource String+ body = (++) <$> pure " TODO " <*> manyTill anyChar newline++-- - [ ] or + [ ] or 1. or 1)+orgInitList :: ParSource ()+orgInitList = listMarker *> spaces *>+ checkBox *> spaces+ where+ checkBox :: ParSource ()+ checkBox = () <$ string "[ ]"++listMarker :: ParSource Char+listMarker = choice+ [char '-',+ char '+',+ numMark]+ where+ numMark :: ParSource Char+ numMark = (digit *> (char '.' <|> char ')'))+++orgOther :: ParSource ()+orgOther = choice+ [() <$ newline, -- an empty line+ () <$ manyTill1 anyChar (endp <|> eof)] -- a non-empty one+ <?> "org-mode other text"+ where+ endp = () <$ newline++ ------------ -- SOURCE -- ------------ -- given a set of lineparsers / blockparsers sourcePart :: ParSyntax -> ParSource (Maybe CommentString)+sourcePart OrgModeSyntax = orgModeDocument sourcePart RstSyntax = rstDocumentPart sourcePart ps@(StdSyntax lc bc es sl cs cl) = choice [plc, pbc, psl, pcl, ppr]@@ -249,4 +323,3 @@ comment2Tuple :: CommentString -> Comment comment2Tuple (SingleLine r t) = (r, t) comment2Tuple (MultiLine r t) = (r, t)-
src/Lentil/Parse/Syntaxes.hs view
@@ -65,10 +65,11 @@ ([".rs", ".rlib"], Just rust), ([".sml"], Just sml), ([".rst"], Just rst), -- reStructuredText+ ([".org"], Just org), -- org-mode ([".txt"], Just text) ] haskell, c, javascript, pascal, python, ruby, perl, nix,- xml, erlang, ocaml, rust, sml, rst, text :: ParSource [CommentString]+ xml, erlang, ocaml, rust, sml, rst, org, text :: ParSource [CommentString] haskell = source $ StdSyntax ["--"] [("{-", "-}")] ClangLike ['"'] CommonChr ['\''] c = source $ StdSyntax ["//"] [("/*", "*/")]@@ -99,6 +100,7 @@ -- todo [bug] [design] rst parser doesn't respect whitespace or -- paragraphs. How to implement this without breaking other -- parsers?+org = source OrgModeSyntax text = (:[]) . MultiLine 1 <$> many anyChar
src/Main.hs view
@@ -32,7 +32,7 @@ short 'v' S.<> help "show version and copyright info" ) where- versionCopy = "\nlentil - frugal issue tracker, version 1.0.11.4\n\+ versionCopy = "\nlentil - frugal issue tracker, version 1.1.0.0\n\ \(C) 2015-2018 Francesco Ariis - http://www.ariis.it\n\ \released under the GNU General Public License v3\n"
test/Lentil/Parse/RunSpec.hs view
@@ -109,4 +109,7 @@ `shouldReturn` [Issue "test/test-files/lang-comm/rst.rst" 3 (Just "some text, more text another paragraph, \ \still belongs to todo") [Tag "hh2"]]+ it "parses a org-mode source" $+ fileParser [] [] "test/test-files/lang-comm/org-mode.org"+ `shouldReturn` spt "test/test-files/lang-comm/org-mode.org"
test/Lentil/Parse/SourceSpec.hs view
@@ -78,6 +78,8 @@ it "stops at ' which is not a literal char" $ sp (program hss) "prova' " `shouldBe` Just "prova' " + -- RST --+ describe "rstTodo" $ do it "parses a reStructuredText+sphinx todo directive" $ sp rstTodo ".. todo:: prova\n\n foo" `shouldBe`@@ -98,6 +100,50 @@ sp (rstDocumentPart *> many anyChar) "gianni \n.. todo:: prova\n\n foo" `shouldBe` Just ".. todo:: prova\n\n foo"++ -- ORG --++ let orgOneLine = Just (sl 1 " TODO prova")+ describe "orgTodo" $ do+ it "parses a single line orgmode todo" $+ sp orgTodo "* TODO prova\n" `shouldBe` orgOneLine+ it "deeper levels" $+ sp orgTodo "** TODO prova\n" `shouldBe` orgOneLine+ it "doesn't parse next line" $+ sp orgTodo "** TODO prova\nxyz" `shouldBe` orgOneLine+ it "parses INACTIVE item" $+ sp orgTodo "** INACTIVE prova\n" `shouldBe`+ Just (sl 1 " INACTIVE prova")+ it "parses priority level" $+ sp orgTodo "** TODO [#A] prova\n" `shouldBe`+ Just (sl 1 " TODO [#A] prova")++ describe "orgListSingle" $ do+ it "parses a list-like orgmode todo" $+ sp orgListSingle "- [ ] prova\n" `shouldBe` orgOneLine+ it "`+` format" $+ sp orgListSingle "+ [ ] prova\n" `shouldBe` orgOneLine+ it "number/dot format" $+ sp orgListSingle "3. [ ] prova\n" `shouldBe` orgOneLine+ it "number/parens format" $+ sp orgListSingle "2) [ ] prova\n" `shouldBe` orgOneLine+ it "does not parse done items" $+ sp orgListSingle "- [X] prova\n" `shouldBe` Nothing++ let orgMultiSing = Just (ml 1 " TODO prova")+ describe "orgListMulti" $ do+ it "parses a list-like orgmode todo, multiline" $+ sp orgListMulti "- [ ] prova\n la rana" `shouldBe`+ Just (ml 1 " TODO prova\n la rana")+ it "stops at new list marker" $+ sp orgListMulti "- [ ] prova\n- [ ] xxx" `shouldBe` orgMultiSing+ it "does not stop at new list marker without newline" $+ sp orgListMulti "- [ ] prova\n - [ ] xxx" `shouldBe`+ Just (ml 1 " TODO prova\n - [ ] xxx")+ it "stops at blank line list marker" $+ sp orgListMulti "- [ ] prova\n\nxxx" `shouldBe` orgMultiSing++ -- SOURCE -- let rbs = StdSyntax ["#"] [] ClangLike ['"', '\''] CommonChr [] describe "source" $ do