From b8ac3dcb7b13bea30e327b8be006b1e150825d93 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Mon, 5 Aug 2013 21:02:21 +0300 Subject: [PATCH] Format urlanalyzer output nicer --- lib/plugins/urlanalyzer.ex | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/plugins/urlanalyzer.ex b/lib/plugins/urlanalyzer.ex index 9d27c2e..9d92be9 100644 --- a/lib/plugins/urlanalyzer.ex +++ b/lib/plugins/urlanalyzer.ex @@ -99,16 +99,20 @@ defmodule Nulform.Plugins.URLAnalyzer do {status, domain, type, size, title} -> result = id_str <> "[" <> domain <> "] " if status == 200 do - if is_number(size) and size > 0 do - size_str = "(" <> human_bytes(size) <> ")" + if String.strip(type) != "" do + result = result <> String.strip(type) <> " " end - result = result <> type <> " " <> size_str + if is_number(size) and size > 0 + # Don't show size for HTML pages, it's always wrong + and not (Enum.any? @parseable_types, fn(x) -> x == type end) do + size_str = "(" <> Nulform.Utilities.human_bytes(size) <> ")" + result = result <> size_str <> " " + end - IO.inspect result - IO.inspect title + if title != "" do - result = result <> " | " <> title + result = result <> "| " <> title IO.inspect result end else