shikensu 0.1.1 → 0.1.2
raw patch · 6 files changed
+33/−38 lines, 6 files
Files
- shikensu.cabal +1/−1
- src/Shikensu.hs +14/−13
- src/Shikensu/Contrib.hs +6/−10
- src/Shikensu/Metadata.hs +7/−7
- src/Shikensu/Sorting.hs +1/−3
- src/Shikensu/Utilities.hs +4/−4
shikensu.cabal view
@@ -1,5 +1,5 @@ name: shikensu-version: 0.1.1+version: 0.1.2 category: File IO synopsis:
src/Shikensu.hs view
@@ -73,23 +73,24 @@ {-| Make a Definition. Example definition, given:+ - the root path `/Users/icidasset/Projects/shikensu` - the pattern `example/**/*.md` - the workspace path `example/test/hello.md` - Definition- { basename = "hello"- , dirname = "test"- , extname = ".md"- , pattern = "example/**/*.md"- , rootDirname = "/Users/icidasset/Projects/shikensu"- , workingDirname = "example"-- , content = Nothing- , metadata = HashMap.empty- , parentPath = "../"- , pathToRoot = "../../"- }+> Definition+> { basename = "hello"+> , dirname = "test"+> , extname = ".md"+> , pattern = "example/**/*.md"+> , rootDirname = "/Users/icidasset/Projects/shikensu"+> , workingDirname = "example"+>+> , content = Nothing+> , metadata = HashMap.empty+> , parentPath = "../"+> , pathToRoot = "../../"+> } -} makeDefinition :: FilePath -> Pattern -> FilePath -> Definition
src/Shikensu/Contrib.hs view
@@ -54,9 +54,7 @@ make a clone with a new `localPath` (2nd argument), and add that into dictionary just after the matching definition. -Example:-- clone "index.html" "200.html" dictionary+> clone "index.html" "200.html" dictionary -} clone :: FilePath -> FilePath -> Dictionary -> Dictionary clone existingPath newPath dict =@@ -114,9 +112,7 @@ and change the basename to the given string. It will NOT change definitions that already have the new basename. -Example:-- permalink "index" dictionary+> permalink "index" dictionary -} permalink :: String -> Dictionary -> Dictionary permalink a = fmap (permalinkDef a)@@ -160,7 +156,7 @@ Change the `localPath` of the definitions that match a given `localPath`. For example, if you have a definition with the local path `a/b/example.html`: - rename "a/b/example.html" "example/index.html" dictionary+> rename "a/b/example.html" "example/index.html" dictionary See `Shikensu.localPath` for more info. -}@@ -180,9 +176,9 @@ Example: - renameExt ".markdown" ".html" dictionary- -- The definitions that had the extname ".markdown"- -- now have the extname ".html"+> renameExt ".markdown" ".html" dictionary+> -- The definitions that had the extname ".markdown"+> -- now have the extname ".html" -} renameExt :: String -> String -> Dictionary -> Dictionary renameExt a b = fmap (renameExtDef a b)
src/Shikensu/Metadata.hs view
@@ -19,13 +19,13 @@ Transpose our metadata object to a given type which implements the Aeson.FromJSON instance. - data Example =- Example { some :: Text }- deriving (Generic, FromJSON)-- hashMap = HashMap.fromList [ ("some", "metadata") ]- defaultEx = Example { some = "default" }- example = transposeMetadata hashMap defaultExample :: Example+> data Example =+> Example { some :: Text }+> deriving (Generic, FromJSON)+>+> hashMap = HashMap.fromList [ ("some", "metadata") ]+> defaultEx = Example { some = "default" }+> example = transposeMetadata hashMap defaultExample :: Example -} transposeMetadata :: Aeson.FromJSON a => Metadata -> a -> a
src/Shikensu/Sorting.hs view
@@ -10,9 +10,7 @@ {-| Sort by absolutePath. -Example:-- Data.List.sortBy Shikensu.sortByAbsolutePath dictionary+> Data.List.sortBy Shikensu.sortByAbsolutePath dictionary -} sortByAbsolutePath :: Definition -> Definition -> Ordering
src/Shikensu/Utilities.hs view
@@ -27,9 +27,9 @@ {-| "Clean up" a path. -`/directory/./nested/` -> `directory/nested`-`./` -> ``-`.` -> ``+> `/directory/./nested/` -> `directory/nested`+> `./` -> ``+> `.` -> `` -} cleanPath :: FilePath -> FilePath@@ -50,7 +50,7 @@ {-| Path to parent, when there is one. - Just "../" or Nothing+> Just "../" or Nothing -} compileParentPath :: FilePath -> Maybe FilePath