<commit_before>(ns statuses.views.common
  (:use [hiccup.page :only [include-css include-js html5]]
        [hiccup.element :only [link-to]]
        [hiccup.util :only [escape-html]]
        [statuses.configuration :only [config]]
        ))


(defn layout [content navigation]
            (html5
              [:head
               [:meta {:name "viewport"
                       :content "width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no"}]
               [:title "innoQ Statuses"]
               (include-css "https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css")
               (include-css "/statuses/css/statuses.css")
               [:link {:href "/statuses/updates?format=atom"
                       :rel "alternate"
                       :title (config :title)
                       :type "application/atom+xml"}]
               [:style "body {  }"]]
              [:body
               (list
                [:div.navbar.navbar-default.navbar-static-top {"data-toggle" "collapse" "data-target" ".nav-collapse" "style" "position: static; margin-bottom: 18px;" "role" "navigation" }
                  [:div.container-fluid
                   [:div.navbar-header
                    [:button.navbar-toggle.collapsed {"type" "button" "data-toggle" "collapse" "data-target" "#statuses-navbar-collapse"}
                     [:span.sr-only "Toggle navigation"]
                     [:span.icon-bar]
                     [:span.icon-bar]
                     [:span.icon-bar]]
                    [:a.navbar-brand {"href" "/statuses/updates"} "innoQ Statuses"]]]]
                [:div.container-fluid
                 [:div.row
                  [:div.col-xs-12.col-md-8 content]
                  [:div.col-xs-6.col-md-3
                   [:div.well {:style "padding:1em;"}
                    [:ul {:class "nav nav-list"}
                     navigation ]]]]])
                (include-js "https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js")
                (include-js "https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js")
                (include-js "/statuses/lib/jquery-charCount.js")
                (include-js "/statuses/js/statuses.js")]))

(def uri #"\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))")

;; see: http://www.regular-expressions.info/email.html
(def email #"([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)")

(defn linkify [text]
  (let [handle  (fn [[_ m]] (str " @<a href='/statuses/updates?author=" m "'>" m "</a>"))
        hashtag (fn [[_ m]] (str "#<a href='/statuses/updates?query=%23" m "'>" m "</a>"))
        anchor  (fn [[m _]] (str "<a href='" m "'>" m "</a>"))
        mailto  (fn [[m _]] (str "<a href='mailto:" m "'>" m "</a>"))]
    (-> text
        escape-html
        (clojure.string/replace #" @(\w+)" handle)<commit_msg>Fix linkifying of mentions at begin of line.<commit_after>(ns statuses.views.common
  (:use [hiccup.page :only [include-css include-js html5]]
        [hiccup.element :only [link-to]]
        [hiccup.util :only [escape-html]]
        [statuses.configuration :only [config]]
        ))


(defn layout [content navigation]
            (html5
              [:head
               [:meta {:name "viewport"
                       :content "width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no"}]
               [:title "innoQ Statuses"]
               (include-css "https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css")
               (include-css "/statuses/css/statuses.css")
               [:link {:href "/statuses/updates?format=atom"
                       :rel "alternate"
                       :title (config :title)
                       :type "application/atom+xml"}]
               [:style "body {  }"]]
              [:body
               (list
                [:div.navbar.navbar-default.navbar-static-top {"data-toggle" "collapse" "data-target" ".nav-collapse" "style" "position: static; margin-bottom: 18px;" "role" "navigation" }
                  [:div.container-fluid
                   [:div.navbar-header
                    [:button.navbar-toggle.collapsed {"type" "button" "data-toggle" "collapse" "data-target" "#statuses-navbar-collapse"}
                     [:span.sr-only "Toggle navigation"]
                     [:span.icon-bar]
                     [:span.icon-bar]
                     [:span.icon-bar]]
                    [:a.navbar-brand {"href" "/statuses/updates"} "innoQ Statuses"]]]]
                [:div.container-fluid
                 [:div.row
                  [:div.col-xs-12.col-md-8 content]
                  [:div.col-xs-6.col-md-3
                   [:div.well {:style "padding:1em;"}
                    [:ul {:class "nav nav-list"}
                     navigation ]]]]])
                (include-js "https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js")
                (include-js "https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js")
                (include-js "/statuses/lib/jquery-charCount.js")
                (include-js "/statuses/js/statuses.js")]))

(def uri #"\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))")

;; see: http://www.regular-expressions.info/email.html
(def email #"([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)")

(defn linkify [text]
  (let [handle  (fn [[_ m]] (str "@<a href='/statuses/updates?author=" m "'>" m "</a>"))
        hashtag (fn [[_ m]] (str "#<a href='/statuses/updates?query=%23" m "'>" m "</a>"))
        anchor  (fn [[m _]] (str "<a href='" m "'>" m "</a>"))
        mailto  (fn [[m _]] (str "<a href='mailto:" m "'>" m "</a>"))]
    (-> text
        escape-html
        (clojure.string/replace #"(?:^|(?<=\s))@(\S+)" handle)
{'fraction_non_alphanumeric': 0.24831243972999037, 'fraction_numerical': 0.01639344262295082, 'mean_word_length': 1.8756931608133087, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 33, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1856038', 'n_tokens_mistral': 2322, 'n_tokens_neox': 2175, 'n_words': 326}