nowdoc: Here document without variable expansion like PHP Nowdoc

[ bsd3, library, text ] [ Propose Tags ] [ Report a vulnerability ]

Please see the README on GitHub at https://github.com/YoshikuniJujo/nowdoc#readme


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.1.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), template-haskell [details]
License BSD-3-Clause
Copyright 2018 Yoshikuni Jujo
Author Yoshikuni Jujo
Maintainer PAF01143@nifty.ne.jp
Category Text
Home page https://github.com/YoshikuniJujo/nowdoc#readme
Bug tracker https://github.com/YoshikuniJujo/nowdoc/issues
Source repo head: git clone https://github.com/YoshikuniJujo/nowdoc
Uploaded by YoshikuniJujo at 2018-09-03T06:59:03Z
Distributions LTSHaskell:0.1.1.0, NixOS:0.1.1.0, Stackage:0.1.1.0
Reverse Dependencies 3 direct, 2 indirect [details]
Downloads 3317 total (27 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-09-03 [all 1 reports]

Readme for nowdoc-0.1.0.4

[back to package description]

nowdoc

Simplest here document. Only two transformation.

  • remove head newline if exist
  • remove one space from '|', space, space, ..., ']'

short examples

hello = [nowdoc|
abc
def
ghi
|]

is

hello = "abc\ndef\nghi\n"

,

hello = [nowdoc|hello|]

is

hello = "hello"

and

hello = [nowdoc|
hello | ]
world |  ]
! |   ]
|]

is

hello = "hello |]\nworld| ]\n! |  ]"

run perl

{-# LANGUAGE QuasiQuotes #-}

import System.Process
import Text.Nowdoc

main :: IO ()
main = () <$ rawSystem "perl" ["-e", [nowdoc|
use strict;
use warnings;

my $hello = "Hello, world!\n";
print $hello;
|]]

ASCII art

{-# LANGUAGE QuasiQuotes #-}

import Text.Nowdoc

main :: IO ()
main = putStr [nowdoc|
            ______             
       .d$$$******$$$$c.       
    .d$P"            "$$c      
   $$$$$.           .$$$*$.    
 .$$ 4$L*$$.     .$$Pd$  '$b   
 $F   *$. "$$e.e$$" 4$F   ^$b  
d$     $$   z$$$e   $$     '$. 
$P     `$L$$P` `"$$d$"      $$ 
$$     e$$F       4$$b.     $$ 
$b  .$$" $$      .$$ "4$b.  $$ 
$$e$P"    $b     d$`    "$$c$F 
'$P$$$$$$$$$$$$$$$$$$$$$$$$$$  
 "$c.      4$.  $$       .$$   
  ^$$.      $$ d$"      d$P    
    "$$c.   `$b$F    .d$P"     
      `4$$$c.$$$..e$$P"        
          `^^^^^^^`
|]