Skip to content

Commit

Permalink
utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
kflu committed Jan 9, 2017
1 parent b97837f commit 61e15e4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 14 additions & 0 deletions picdoc/picdoc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module picdoc =
#r "../packages/MetadataExtractor/lib/net45/MetadataExtractor.dll"
#r "../packages/XmpCore/lib/net35/XmpCore.dll"
#r "../packages/Nustache/lib/net20/Nustache.Core.dll"
#r "../packages/Argu/lib/net40/Argu.dll"
#endif

open System
Expand All @@ -20,13 +21,16 @@ module picdoc =
| [<MainCommand; ExactlyOnce>] InputDir of path:string
| [<AltCommandLine("-p")>] FilePattern of pattern:string
| [<AltCommandLine("-l")>] LinkPrefix of prefix:string
| Debug of debug : bool
| Pause of pause:bool
with
interface IArgParserTemplate with
member s.Usage =
match s with
| InputDir _ -> "input directory"
| FilePattern _ -> "pattern of files to be included"
| LinkPrefix _ -> "string to prefix the link to the images"
| _ -> ""

[<EntryPoint>]
let main argv =
Expand All @@ -36,6 +40,12 @@ module picdoc =
let targetDir = opts.GetResult(<@ InputDir @>) |> Path.GetFullPath
let filePattern = opts.GetResult(<@ FilePattern @>, defaultValue="*")
let prefix = opts.GetResult(<@ LinkPrefix @>, defaultValue="")
let debug = opts.GetResult(<@ Debug @>, defaultValue=false)
let pause = opts.GetResult(<@ Pause @>, defaultValue=false)

if pause then
printfn "Press any key to continue..."
System.Console.Read() |> ignore

let infos =
System.IO.Directory.GetFiles(targetDir)
Expand All @@ -46,6 +56,10 @@ module picdoc =
>> Manipulator.fromExtractor Extractor.Title
>> Manipulator.fromExtractor Extractor.Description)

if debug then
printfn "%A" infos
printfn "%A" System.Console.OutputEncoding

let rendered = Markdown.render infos // render

printfn "%s" rendered
Expand Down
6 changes: 3 additions & 3 deletions picdoc/renderer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ module renderer =

let template = """
{{#images}}
![{{title}}]({{path}})
![{{& title}}]({{& path}})
{{#title}}
**{{title}}**
**{{& title}}**
{{/title}}
{{#description}}
{{description}}
{{& description}}
{{/description}}
{{/images}}
Expand Down

0 comments on commit 61e15e4

Please sign in to comment.