Compare commits

..

No commits in common. "f6f71d1ee5649712791f8dea9d1b482071877ba6" and "ec6be15032d4d63fd91db5d7c9cb955f6d7ed9d5" have entirely different histories.

3 changed files with 7 additions and 27 deletions

View File

@ -1,7 +0,0 @@
defmodule LogsrvApi.Crawler do
alias LogsrvApi.{Filesystem,Page,Journal}
def crawl do
Filesystem.
end
end

View File

@ -24,22 +24,10 @@ defmodule LogsrvApi.Filesystem do
def all(Page) do
dir(:pages)
|> File.ls!
|> Enum.sort
|> Enum.map(fn(fd) ->
case fd |> File.ls do
{:error, _} ->
IO.puts("Error on #{fd}")
Page.init(fd)
pages ->
IO.puts(pages)
pages |> Enum.map(fn(page) ->
"pages/#{page}" |> Page.init
end)
end
Page.init(fd)
end)
|> Enum.sort(&sort/2)
end
def sort(a, b) do
Timex.compare(a.date, b.date) > 0
end
def all(Journal) do

View File

@ -49,14 +49,13 @@ defmodule LogsrvApi.Page do
{:nil, Earmark.as_html!(data)}
end
end
def parse_yaml(yaml) do
yaml
|> :yamerl_constr.string
|> List.flatten
defp parse_yaml(yaml) do
[parsed] = :yamerl_constr.string(yaml)
parsed
end
defp extract({props, content}, post) do
%{post |
title: get_prop(props, "title") |> to_string || post.title,
title: get_prop(props, "title") || post.title,
tags: get_prop(props, "tags"),
content: content}
end
@ -66,7 +65,7 @@ defmodule LogsrvApi.Page do
else
case :proplists.get_value(String.to_char_list(key), props) do
:undefined -> nil
x -> x
x -> to_string(x)
end
end
end