The Tree of Widsdom

智慧の樹

PoemHere

^do( PoemHere, text, [author], [title], [url] )^

Type: Macro

Purpose: Adds a poem block with citation info and url

The PoemHere macro inserts a poem. It preserves all spacing. The 2nd arg is the author; 3rd, the title. Both are optional.

PoemHere plays nice with newlines at the start of text.

Because Tinderbox cannot test logical OR in a conditional when using the export code ^if^, I improvised a solution: testing each conditional separately and assigning all positives to a dedicated variable, $tmpNum1(bstVAR).

Hover below to reveal BoxPress code

^action($tmpNum1(bstVAR)=;if($2){$tmpNum1(bstVAR)=1};if($3){$tmpNum1(bstVAR)=1};$tmpStr1="$1".replace("(</p>|<p>|</blockquote>|<blockquote>)", ""))^<pre class="poem">^value($tmpStr1)^^if($tmpNum1(bstVAR))^<footer class="afterquote">^if(^value($2)^)^$2^if(^value($3)^)^, ^endIf^^endIf^^if(^value($3)^)^<cite>^if(^value($4)^)^<a href="$4"> $3</a>^else^$3^endIf^</cite>^endIf^</footer>^endIf^</pre>

PoemHere sample

This is the markup that is rendered below

^do(PoemHere, "
Man is so infinitely small
   In all these stars, determinate.
Maker and moulder of them all,
   Man is so infinitely great!", "Aleister Crowley", "At Sea", "https://books.google.com/books?id=wXJ8BwAAQBAJ&pg=PA80")^

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Man is so infinitely small
   In all these stars, determinate.
Maker and moulder of them all,
   Man is so infinitely great!

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Both author and title are optional, so you can do this:

This is the markup that is rendered below

^do(PoemHere, "
Black Phillip, Black Phillip 
King of sky and land.", "Author")^

^do(PoemHere, "
Black Phillip, Black Phillip 
King of sea and sand.",, "Title")^

^do(PoemHere, "
Black Phillip, Black Phillip 
King of sky and land.
Black Phillip, Black Phillip 
King of sea and sand.")^

Black Phillip, Black Phillip 
King of sky and land.
Author

Black Phillip, Black Phillip 
King of sea and sand.
Title

Black Phillip, Black Phillip 
King of sky and land.
Black Phillip, Black Phillip 
King of sea and sand.