A set of useful functions for Clojure programming language Spreadsheet, Scaling, Pagination, Markdown and others
Put
[TODO 0.1.0]
to your project.clj
Below is the documentation on what is available within each namespace Most of it is autogenerated with the help of akronim library.
This readme file is AUTOGENERATED. Do not edit!! Check readme_template.md for source Check gen_doc.clj for generation mechanics
top
(excel-slurp fname-str)
Load spreadsheet as a hashmap where the key is a sheet name. and value is
a list of hashmaps with :key
being the header of a sheet and :val
being
the value on a given row.
Will raise an error if there is no such file
For dumping data to an excel file see excel-spit
See tests for more examples
Usage:
(require '[thereisnodot.utils.spreadsheets :refer [excel-slurp]])
(excel-slurp (str (clojure.java.io/file (clojure.java.io/resource
"demo2.xlsx"))))
;; => {"sheet1"
;; (list
;; {:secon_column "no one", :third_column "works on this", :first_column "a1"}
;; {:secon_column "no one", :third_column "n/a", :first_column "n/a"}),
;; "sheet2"
;; (list {:secon_column "everything", :third_column "n/a", :first_column "n/a"}
;; {:secon_column "no one",
;; :third_column "works on this",
;; :first_column "b1"})}
top
(excel-spit fpath sheet-maps)
(excel-spit fpath sheet-maps if-empty)
(excel-spit fpath sheet-maps if-empty header-order)
Will turn maps into a spreadsheet of many sheets
will overwrite any file that is on the given fpath
if-empty
should be a string value that will replace
empty cell.
Header order
will put order on the fields.
Those which specified, will go first in the specified order.
See tests for more examples
Usage:
(require '[thereisnodot.utils.spreadsheets :refer [excel-spit]])
(excel-spit "/tmp/thereisnodot.utils7945546543919997425.xlsx"
{"sheet1" (list {:first_column "a1",
:secon_column "no one",
:third_column "works on this"}
{:secon_column "no one"}),
"sheet2" (list {:secon_column "everything"}
{:first_column "b1",
:secon_column "no one",
:third_column "works on this"})}
"n/a" [])
;; => nil
(excel-spit "/tmp/thereisnodot.utils7945546543919997426.xlsx"
{"sheet1" (list {:first_column "a1",
:secon_column "no one",
:third_column "works on this"}
{:secon_column "no one"}),
"sheet2" (list {:secon_column "everything"}
{:first_column "b1",
:secon_column "no one",
:third_column "works on this"})}
"n/a" [:secon_column :third_column])
;; => nil
top
(excel-round-up number digits)
Excel compatible ROUND formula
Usage:
(require '[thereisnodot.utils.spreadsheets :refer [excel-round-up]])
(excel-round-up 3.2 0)
;; => 4.0
(excel-round-up 76.9 0)
;; => 77.0
(excel-round-up 3.14159 3)
;; => 3.142
(excel-round-up -3.14159 1)
;; => -3.2
(excel-round-up 31415.92654 -2)
;; => 31500.0
(excel-round-up 100.999 -2)
;; => 200.0
top
(excel-round-down number digits)
Excel compatible ROUND formula
Usage:
(require '[thereisnodot.utils.spreadsheets :refer [excel-round-down]])
(excel-round-down 3.2 0)
;; => 3.0
(excel-round-down 76.9 0)
;; => 76.0
(excel-round-down 3.14159 3)
;; => 3.141
(excel-round-down -3.14159 1)
;; => -3.1
(excel-round-down 31415.92654 -2)
;; => 31400.0
top
(hashmaps->sparse-table datum)
(hashmaps->sparse-table datum null-type)
(hashmaps->sparse-table datum null-type order-by)
Will turn a list of hashmaps into a sparse table. Useful when exporting data into a spreadsheet. First row is a headers row
Usage:
(require '[thereisnodot.utils.collections :refer [hashmaps->sparse-table]])
(hashmaps->sparse-table [{:hello "world", :blab "blip", :blop "12"}
{:1 "asd", :2 "zc", :hello "nothing"}])
;; => (list (list "hello" "blab" "blop" "1" "2")
;; (list "world" "blip" "12" nil nil)
;; (list "nothing" nil nil "asd" "zc"))
(hashmaps->sparse-table [{:name "hello", :surname "world"}
{:name "blab", :surname "blip", :whatever "blop"}]
"n/a"
[:whatever :name :surname])
;; => (list (list "whatever" "name" "surname")
;; (list "n/a" "hello" "world")
;; (list "blop" "blab" "blip"))
top
(meta-iterate data-set)
Provide metadata in the form {:index :last? :first?} on a collection
Usage:
(require '[thereisnodot.utils.collections :refer [meta-iterate]])
(for [[item meta-item] (meta-iterate (range 10 14))] [item meta-item])
;; => (list [10 {:index 0, :last? false, :first? true}]
;; [11 {:index 1, :last? false, :first? false}]
;; [12 {:index 2, :last? false, :first? false}]
;; [13 {:index 3, :last? true, :first? false}])
top
(map-longest fn & colls)
Opposite of map. On multiple collections will iterate until the longest sequence has no more members. Will hang when used with lazy collections
Usage:
(require '[thereisnodot.utils.collections :refer [map-longest]])
(map-longest list (range 1 6) (range 1 3) (range 10 15))
;; => (list (list 1 1 10)
;; (list 2 2 11)
;; (list 3 nil 12)
;; (list 4 nil 13)
;; (list 5 nil 14))
top
(filter-map-key filter-fn some-map)
Will filter on key of a hashmap
Usage:
(require '[thereisnodot.utils.collections :refer [filter-map-key]])
(filter-map-key (fn [item] (= item :1)) {:1 1, :2 2, :3 3})
;; => {:1 1}
top
(filter-map-val filter-fn some-map)
WIll filter on value of a hashmap
Usage:
(require '[thereisnodot.utils.collections :refer [filter-map-val]])
(filter-map-val (fn [item] (= item 1)) {:1 1, :2 2, :3 3})
;; => {:1 1}
top
(jaccard-words some-str some-another-str)
Calculate Jaccard distance between two strings split by space
Usage:
(require '[thereisnodot.utils.collections :refer [jaccard-words]])
(jaccard-words "Hello my friend" "goodbye my friend")
;; => 1/2
(jaccard-words "hello nobody" "buy one")
;; => 0
(jaccard-words "a b c d e n" "a b c d e")
;; => 5/6
(jaccard-words "a n" "a n")
;; => 1
top
(map-val f m)
Will execute function over value of the map
Usage:
(require '[thereisnodot.utils.collections :refer [map-val]])
(map-val inc {:1 1, :2 2})
;; => {:1 2, :2 3}
top
(pad-numbers n c pad-symbol)
Pad numbers - takes a number and the length to pad to as arguments
Usage:
(require '[thereisnodot.utils.collections :refer [pad-numbers]])
(pad-numbers 10 1234567 0)
;; => "1234567000"
top
(jaccard a b)
Will calculate Jaccard distance over two sets
Usage:
(require '[thereisnodot.utils.collections :refer [jaccard]])
(jaccard #{:b :a} #{:c :d})
;; => 0
(jaccard #{:c :b :a} #{:c :d})
;; => 1/4
(jaccard #{:c :b :a} #{:b :a})
;; => 2/3
(jaccard #{:b :a} #{:b :a})
;; => 1
top
(nested-group-by fs coll & [final-fn])
From: https://stackoverflow.com/a/38842018/3362518
Like group-by but instead of a single function, this is given a list or vec
of functions to apply recursively via group-by. An optional final
argument
(defaults to identity) may be given to run on the vector result of the final
group-by. !!careful, deep nesting is not supported
Usage:
(require '[thereisnodot.utils.collections :refer [nested-group-by]])
(nested-group-by [first second]
[["A" 2011 "Dan"] ["A" 2011 "Jon"] ["A" 2010 "Tim"]
["B" 2009 "Tom"]])
;; => {"A" {2010 [["A" 2010 "Tim"]], 2011 [["A" 2011 "Dan"] ["A" 2011 "Jon"]]},
;; "B" {2009 [["B" 2009 "Tom"]]}}
top
(pad-coll n coll pad-with)
Pad collection with until is reached
Usage:
(require '[thereisnodot.utils.collections :refer [pad-coll]])
(pad-coll 10 [3 4] nil)
;; => [3 4 nil nil nil nil nil nil nil nil]
(pad-coll 10 [3 4] "n/a")
;; => [3 4 "n/a" "n/a" "n/a" "n/a" "n/a" "n/a" "n/a" "n/a"]
top
(order-by-collection input order-coll)
Will order input hashmap by order collection. Will append non appearing at the end
Usage:
(require '[thereisnodot.utils.collections :refer [order-by-collection]])
(order-by-collection {:a 1, :b 34, :c 87, :h 47, :d 12} [:h :d])
;; => (list 47 12 1 34 87)
top
(invert-map dataset)
Turn values into keys and reverse. Basically, an inverted index. See tests for example
Usage:
(require '[thereisnodot.utils.collections :refer [invert-map]])
(invert-map {:F [:a :b :n], :Q [:c :d :n]})
;; => {:a [:F], :b [:F], :c [:Q], :d [:Q], :n [:F :Q]}
(invert-map
{1 ["hello" "world"], 2 ["not" "important"], 3 ["very" "important" "thing"]})
;; => {"hello" [1],
;; "important" [2 3],
;; "not" [2],
;; "thing" [3],
;; "very" [3],
;; "world" [1]}
top
(x-y->tile-lat-lon xtile ytile zoom)
Will calculate latitude and longitude coordinates of a map tile, when given tile X Y and a zoom level. You can check example on OpenStreetMap: https://www.openstreetmap.org/#map=18/42.1440/41.6780
Usage:
(require '[thereisnodot.utils.scale :refer [x-y->tile-lat-lon]])
(x-y->tile-lat-lon 161421 97171 18)
;; => [42.14405981155153 41.678009033203125]
top
(paginate current last-item)
Will create pagination based on current page and the amount of pages as input
Usage:
(require '[thereisnodot.utils.scale :refer [paginate]])
(paginate 1 3)
;; => (list {:page-num 1, :name "1", :cur? true, :first? true, :last? false}
;; {:page-num 2, :name "2", :cur? false, :first? false, :last? false}
;; {:page-num 3, :name "3", :cur? false, :first? false, :last? true})
(map :name (paginate 37 40))
;; => (list "1" "..." "35" "36" "37" "38" "39" "40")
(map :name (paginate 12 30))
;; => (list "1" "..." "10" "11" "12" "13" "14" "..." "30")
top
(lat-lon->tile-x-y lat-deg lon-deg zoom)
Will calculate X and Y coordinates of a map tile, when given latitude longitude and a zoom level. Which you can check on OpenStreetMap: https://c.tile.openstreetmap.org/18/161421/97171.png
Usage:
(require '[thereisnodot.utils.scale :refer [lat-lon->tile-x-y]])
(lat-lon->tile-x-y 42.1438 41.6781 18)
;; => [161421 97171]
top
(log-scale x1 x2 y1 y2 x)
Will calculate log scaling (mapping) from one metric into another
Usage:
(require '[thereisnodot.utils.scale :refer [log-scale]])
(map int (map (partial log-scale 1 5 10 50) (range 1 6)))
;; => (list 10 14 22 33 49)
top
(scale A B C D X)
Will calculate linear scaling (mapping) from one metric into
Usage:
(require '[thereisnodot.utils.scale :refer [scale]])
(map (partial scale 1 5 10 50) (range 1 6))
;; => (list 10 20N 30N 40N 50)
top
(log-scale-round x1 x2 y1 y2 x)
Will calculate rounded log scale
Usage:
(require '[thereisnodot.utils.scale :refer [log-scale-round]])
(map (partial log-scale-round 1 5 10 50) (range 1 6))
;; => (list 10.0 14.0 22.0 33.0 49.0)
top
(golden-ratio size step)
Will calculate golden ratio
Usage:
(require '[thereisnodot.utils.scale :refer [golden-ratio]])
(map (partial golden-ratio 1) (range 1 10))
;; => (list 1 2 4 6 11 17 29 46 75)
(map (partial golden-ratio 5) (range 1 10))
;; => (list 8 13 21 34 55 89 145 234 379)
top
(euclidean-distance vec-a vec-b)
Will calculate Euclidean distance between two vectors of the same size.
Usage:
(require '[thereisnodot.utils.scale :refer [euclidean-distance]])
(euclidean-distance [1 2 3 4] [5 6 7 8])
;; => 8.0
top
(font-size-in-a-tag-cloud min-font-size max-font-size items-in-the-biggest-tag items)
Will linearly calculate font size of a tag in a tag cloud. Courtesy of: https://stackoverflow.com/a/3717340/3362518
Usage:
(require '[thereisnodot.utils.scale :refer [font-size-in-a-tag-cloud]])
(map (partial font-size-in-a-tag-cloud 10 30 6) (range 1 5))
;; => (list 5N 10N 15N 20N)
top
(tag-font-log-normalized items-in-the-biggest-tag items)
Will non linearly calculate font size of a tag in a tag cloud
Usage:
(require '[thereisnodot.utils.scale :refer [tag-font-log-normalized]])
(map (partial tag-font-log-normalized 10) (range 1 10))
;; => (list 0.33 0.53 0.65 0.73 0.79 0.85 0.89 0.93 0.96)
top
(haversine lat-1 lng-1 lat-2 lng-2)
(haversine lat-1 lng-1 lat-2 lng-2 radius)
Will calculate Haversine distance between two points on a shphere Correctness checked at: https://www.vcalc.com/wiki/vCalc/Haversine+-+Distance
Usage:
(require '[thereisnodot.utils.scale :refer [haversine]])
(haversine 42.1438 41.6781 42.144 41.678)
;; => 0.0237180780670015
top
(truncate-words-by-chars amount input)
(truncate-words-by-chars amount input ending)
will intelligently truncate (without splitting words, with appending ... in the end, if exists)
Usage:
(require '[thereisnodot.utils.strings :refer [truncate-words-by-chars]])
(truncate-words-by-chars 40 "This is a beautiful sunny day")
;; => "This is a beautiful sunny day"
(truncate-words-by-chars 30 "This is a beautiful sunny day")
;; => "This is a beautiful sunny ..."
(truncate-words-by-chars 20 "This is a beautiful sunny day")
;; => "This is a ..."
(truncate-words-by-chars 10 "This is a beautiful sunny day")
;; => "This ..."
top
(number->roman number-int)
Number to Roman
Usage:
(require '[thereisnodot.utils.strings :refer [number->roman]])
(number->roman 3)
;; => "III"
top
(human-date year month day)
Will make a human readable date
Usage:
(require '[thereisnodot.utils.strings :refer [human-date]])
(human-date 2017 12 12)
;; => "Twelfth of December, 2017"
(human-date 2000 10 10)
;; => "Tenth of October, 2000"
(human-date 2000 1 1)
;; => "First of January, 2000"
top
(pluralize->as-ies root-str number-int)
Pluralize English with -ies suffix
Usage:
(require '[thereisnodot.utils.strings :refer [pluralize->as-ies]])
(pluralize->as-ies "strawberr" 1)
;; => "strawberry"
(pluralize->as-ies "strawberr" 2)
;; => "strawberries"
top
(number-ordinal->english number-int)
Number ordinal to English
Usage:
(require '[thereisnodot.utils.strings :refer [number-ordinal->english]])
(number-ordinal->english 3)
;; => "third"
top
(slugify some-text)
(slugify some-text split-kind)
Will slugify given string. Will remove non ASCII characters
Usage:
(require '[thereisnodot.utils.strings :refer [slugify]])
(slugify "Will slugify given string.")
;; => "will-slugify-given-string"
(slugify "Это не работает")
;; => ""
(slugify "whatever whoever" "_")
;; => "whatever_whoever"
top
(lorem-ipsum amount-of-words)
(lorem-ipsum amount-of-words rand-fn)
Generate lorem ipsum of words of a given size Accepts second parameter as a source of randomness. Default rand-int
Usage:
(require '[thereisnodot.utils.strings :refer [lorem-ipsum]])
(lorem-ipsum 5 (fn [_] 0))
;; => (list "sed" "sed" "sed" "sed" "sed")
top
(remove-new-lines datum)
Will remove new lines from text
Usage:
(require '[thereisnodot.utils.strings :refer [remove-new-lines]])
(remove-new-lines "Hello\n world")
;; => "Hello world"
top
(pluralize->as-s root-str number-int)
Pluralize English with -s suffix
Usage:
(require '[thereisnodot.utils.strings :refer [pluralize->as-s]])
(pluralize->as-s "friend" 1)
;; => "friend"
(pluralize->as-s "friend" 2)
;; => "friends"
top
(number->english number-int)
Number to English
Usage:
(require '[thereisnodot.utils.strings :refer [number->english]])
(number->english 3)
;; => "three"
top
(dress-minute minute-int)
Turns digit into human readable minute
Usage:
(require '[thereisnodot.utils.reading-time :refer [dress-minute]])
(dress-minute 12)
;; => "less than twelve minutes"
(dress-minute 1)
;; => "less than one minute"
top
(dress-minute-small minute-int)
Same as dress-minute, but shorter version
Usage:
(require '[thereisnodot.utils.reading-time :refer [dress-minute-small]])
(dress-minute-small 1)
;; => "1 minute"
(dress-minute-small 12)
;; => "12 minutes"
top
(calculate text)
(calculate text average-words-per-minute)
(1/(words per minute)) * (amount of words) = (amount of minutes)
Usage:
(require '[thereisnodot.utils.reading-time :refer [calculate]])
(calculate "Hello world")
;; => 1
(calculate (apply str (repeat 1000 " huge text ")))
;; => 10
(calculate (apply str (repeat 256 " middle text ")))
;; => 3
(calculate (apply str (repeat 256 " middle text ")) 1)
;; => 512
top
(calculate-multiformat text wpm)
(calculate-multiformat text)
Will return result in three different formats: numeric/short/long
Usage:
(require '[thereisnodot.utils.reading-time :refer [calculate-multiformat]])
(calculate-multiformat (apply str (repeat 256 " middle text ")))
;; => [3 "3 minutes" "less than three minutes"]
top
(number->duration frames)
(number->duration frames frame-rate)
Will take the amount of frames and frame rate.
Will output the resulting duration in the format
of:
:hours
, :minutes
, :seconds
, and :frames
Usage:
(require '[thereisnodot.utils.framerate :refer [number->duration]])
(number->duration 1234 25)
;; => {:frames 9.0, :hours 0.0, :minutes 0.0, :seconds 49.0}
(number->duration 0 25)
;; => {:frames 0.0, :hours 0.0, :minutes 0.0, :seconds 0.0}
(number->duration 25 25)
;; => {:frames 0.0, :hours 0.0, :minutes 0.0, :seconds 1.0}
(number->duration (* 60 25) 25)
;; => {:frames 0.0, :hours 0.0, :minutes 1.0, :seconds 0.0}
(number->duration (* 60 60 25) 25)
;; => {:frames 0.0, :hours 1.0, :minutes 0.0, :seconds 0.0}
top
(duration->string item)
Will format framerate into a string
Usage:
(require '[thereisnodot.utils.framerate :refer [duration->string]])
(duration->string {:hours 1, :minutes 12, :seconds 13, :frames 11})
;; => "01h 12m 13s 11fr"
(duration->string {:hours 0, :minutes 0, :seconds 0, :frames 0})
;; => "00:00"
(duration->string {:hours 0, :minutes 0, :seconds 250, :frames 0})
;; => "250s"
top
(styles-map->string data)
Will turn a map style of CSS into an inline style of CSS
Usage:
(require '[thereisnodot.utils.html :refer [styles-map->string]])
(styles-map->string {:background "green", :color "white", :font-weight "900"})
;; => "background:green; color:white; font-weight:900;"
top
(gen-layout-class pivot a b c)
Will generate position specific class. For example: For the pivot 3 classes are: text-align:left; text-align:center; text-align:right; Useful when implementing something on CSS grid
Usage:
(require '[thereisnodot.utils.html :refer [gen-layout-class]])
(take 9 (gen-layout-class 3 "left" "justify" "right"))
;; => (list "left"
;; "justify" "right"
;; "left" "justify"
;; "right" "left"
;; "justify" "right")
top
(backlet text class-item)
Will change last letter in hiccup form
Usage:
(require '[thereisnodot.utils.html :refer [backlet]])
(backlet "Hello" "blab")
;; => [:span "Hell" [:span {:class "blab"} "o"]]
top
(grid-amount size amount)
Percentage on classical grid. Size is the amount of blocks in a grid
Usage:
(require '[thereisnodot.utils.html :refer [grid-amount]])
(map (partial grid-amount 16) (range 16))
;; => (list "0.0%" "6.25%"
;; "12.5%" "18.75%"
;; "25.0%" "31.25%"
;; "37.5%" "43.75%"
;; "50.0%" "56.25%"
;; "62.5%" "68.75%"
;; "75.0%" "81.25%"
;; "87.5%" "93.75%")
top
(style link)
Will make style in a Hiccup syntax
Usage:
(require '[thereisnodot.utils.html :refer [style]])
(style "some-link.css")
;; => [:link {:href "some-link.css", :rel "stylesheet", :type "text/css"}]
top
(parse-sorting-field input)
Will parse sorting field like this: (year | -year) (price | -price) (age | -age) e.t.c. (parse-sorting-field "-age") => {:inverse? true, :field :age}
Usage:
(require '[thereisnodot.utils.html :refer [parse-sorting-field]])
(parse-sorting-field "-age")
;; => {:field :age, :inverse? true}
(parse-sorting-field "age")
;; => {:field :age, :inverse? false}
(parse-sorting-field "blab")
;; => {:field :blab, :inverse? false}
top
(inlet text text-class)
Will change first letter in hiccup form
Usage:
(require '[thereisnodot.utils.html :refer [inlet]])
(inlet "Hello" "blab")
;; => [:span [:span {:class "blab"} "H"] "ello"]
top
(cyrillic-str->latin phrase-str)
Primitive transliteration of cyrillic to latin.
Usage:
(require '[thereisnodot.utils.transliterate :refer [cyrillic-str->latin]])
(cyrillic-str->latin "Хелло ворлд")
;; => "Hello world"
(cyrillic-str->latin "Нотхинг воркс")
;; => "Nothing worx"
(cyrillic-str->latin "Фоо бар")
;; => "Foo bar"
top
(latin-str->cyrillic phrase-str)
Primitive transliteration of latin to cyrillic
Usage:
(require '[thereisnodot.utils.transliterate :refer [latin-str->cyrillic]])
(latin-str->cyrillic "Hello world")
;; => "Хелло ворлд"
(latin-str->cyrillic "Nothing works")
;; => "Нотхинг воркс"
(latin-str->cyrillic "Foo bar")
;; => "Фоо бар"
top
(temp-file)
(temp-file prefix extension)
Will return temp file handler without actually making it
Usage:
(require '[thereisnodot.utils.fs :refer [temp-file]])
(str (temp-file))
;; => "/tmp/cljtmpfile1555885885588503551"
top
(zip-dir archive-name directory)
will zip directory into a folder
Usage:
(require '[thereisnodot.utils.fs :refer [zip-dir]])
(zip-dir "/home/mik/Downloads/alacritty.zip" "/home/mik/Downloads/alacritty")
;; => nil
top
(text->html text)
(text->html text params)
Will translate markdown text into HTML. This is a thin wrapper over: https://github.com/atlassian/commonmark-java The following extensions are enabled by default:
YamlFrontMatterExtension
InsExtension
. Underlining of text by enclosing it in ++.HeadingAnchorExtension
StrikethroughExtension
AutolinkExtension
The main reason behind using wrapper because commonmark implementation doesn't have problems with embedded HTML parsing.
The parameters currently only encode :keywordize-keys?
field
Usage:
(require '[thereisnodot.utils.markdown :refer [text->html]])
(text->html
"\n---\nhello: world\nblab: blip\nblop: blop\n---\n# This is a library\n## And here is its link\n\nhttps://github.com/MichaelLeachim/utils\n")
;; => {:html
;; "<h1 id=\"this-is-a-library\">This is a library</h1>\n<h2 id=\"and-here-is-its-link\">And here is its link</h2>\n<p><a href=\"https://github.com/MichaelLeachim/utils\">https://github.com/MichaelLeachim/utils</a></p>\n",
;; :meta {:blab ["blip"], :blop ["blop"], :hello ["world"]}}
top
(inline-css-of-a-html html-string)
(inline-css-of-a-html html-string params)
The implementation is based upon: https://stackoverflow.com/a/4521740/3362518
Will inline css of a given HTML string
Does not take into account linked CSS (CSS that is passed through link
HTML tag)
Available params are: :silent?
, :strip-class?
, :delete-style?
:silent?
(true
by default) will suppress potential errors e.g. (@media selectors),
and continue inlining. When set to false
will throw SelectorParseException
:strip-class?
(true
by default) will remove classes from the html:delete-style?
(true
by default) will remove style
tags from the sourceIn case of :silent?
will return a vector of two. First with inlined HTML, second
with errors that occured during inlining
Usage:
(require '[thereisnodot.utils.css :refer [inline-css-of-a-html]])
(first
(inline-css-of-a-html
"<style>.demo-class {background:green;}</style>\n<div class='demo-class'>Hello</div>"))
;; => "<html>\n <head> \n </head>\n <body>\n <div style=\"background:green\">\n Hello\n </div>\n </body>\n</html>"
This will clone the repo and start running REPL and a test watcher/runner
git clone github.com/MichaelLeachim/utils;
cd utils;
tmuxinator .
Copyright © 2018 Michael Leahcim
Distributed under the Eclipse Public License
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close