diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-06-08 14:35:04 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-06-08 14:35:04 +0200 |
commit | 9d00df8bc5b6f4ba313b1085c069c19faeaaaaf9 (patch) | |
tree | dc1471817679c5782aa07cc81b21788dd2867767 | |
parent | 99d72446511240b08e50cd5cb02eae90d3b16689 (diff) | |
download | comatose-9d00df8bc5b6f4ba313b1085c069c19faeaaaaf9.tar.gz comatose-9d00df8bc5b6f4ba313b1085c069c19faeaaaaf9.tar.bz2 comatose-9d00df8bc5b6f4ba313b1085c069c19faeaaaaf9.zip |
Do not link paper title of no url is available
-rw-r--r-- | Main.hs | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -143,7 +143,7 @@ calcRank db = stop prevalgos algos = rankdiff prevalgos algos > 0.00001 in db { dalgos = (iterateUntil run stop initalgos) } -maybeToHtml = maybe (toHtml ("" :: String)) toHtml +maybeToHtml = maybe mempty toHtml scholarSearch q = "http://scholar.google.com/scholar?q=" ++ escapeURIString isReserved q resolveDoi q = "http://doi.org/" ++ q @@ -221,12 +221,17 @@ bibentryurl bib = safeHead $ catMaybes [doi, url] -- | Format bibliography/references item bibentry :: E.T -> Html () bibentry bib = do - let fields = E.fields bib - a_ [href_ $ T.pack $ maybe "" id $ bibentryurl bib, class_ "title"] $ maybeToHtml $ lookup "title" fields + let + fields = E.fields bib + htmlLookup k = maybeToHtml $ lookup k fields + maybe + (span_ [class_ "title"] $ htmlLookup "title") + (\x -> a_ [href_ $ T.pack $ x, class_ "title"] $ htmlLookup "title") + (bibentryurl bib) ", " - span_ [class_ "author"] $ maybeToHtml $ lookup "author" fields + span_ [class_ "author"] $ htmlLookup "author" ", " - span_ [class_ "year"] $ maybeToHtml $ lookup "year" fields + span_ [class_ "year"] $ htmlLookup "year" -- | References section references :: [E.T] -> Html () |