Skip to content

tailrecursion/boot-heredoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boot-heredoc

[tailrecursion/boot-heredoc "0.1.1"] ;; latest release

Boot task for adding multiline strings literals to Clojure

Example

(def lorem-ipsum
  ;;{{
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eget
  eleifend metus. Curabitur vitae vestibulum ligula, vel pulvinar nisl. Sed
  cursus ipsum id enim rutrum iaculis. Mauris non ullamcorper sem. In porttitor
  mi ut massa molestie, eu pharetra turpis aliquet. Ut fermentum varius tortor,
  sit amet maximus mi. Praesent et orci orci. Nullam auctor nisi eget sagittis
  pharetra. Sed ullamcorper mauris sit amet metus pulvinar, et pretium elit
  tincidunt.
  ;;}}
  )

;; becomes...

(def lorem-ipsum "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eget\neleifend metus. Curabitur vitae vestibulum ligula, vel pulvinar nisl. Sed\ncursus ipsum id enim rutrum iaculis. Mauris non ullamcorper sem. In porttitor\nmi ut massa molestie, eu pharetra turpis aliquet. Ut fermentum varius tortor,\nsit amet maximus mi. Praesent et orci orci. Nullam auctor nisi eget sagittis\npharetra. Sed ullamcorper mauris sit amet metus pulvinar, et pretium elit\ntincidunt.")

Usage

Add boot-heredoc to your build.boot dependencies and require the namespace.

Note: the boot-heredoc dependency is only needed at when compiling source files. So you should add boot-heredoc with the test scope.

(merge-env!
  :dependencies '[[tailrecursion/boot-heredoc "X.Y.Z" :scope "test"]])
(require '[boot.heredoc :refer [heredoc]])

By default the multiline string literals starts with ;;{{ and ends with ;;}} and it replaces those blocks on .hl files. Those are customizable using options.

You can see the options available on the command line:

boot heredoc -h

or in the REPL:

boot.user=> (doc heredoc)

License

Copyright © 2015 Marcelo Nomoto

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

Parse files and replace string blocks with a Clojure string.

Resources

Stars

Watchers

Forks

Packages

No packages published