User Tools

Site Tools


harlowe:collapsing_whitespace

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

harlowe:collapsing_whitespace [2017/10/09 20:39] (current)
Line 1: Line 1:
 +====Collapsing whitespace====
  
 +When working with macros, HTML tags and such, it's convenient for readability purposes to space and indent
 +the text. However, this [[harlowe:​whitespace|whitespace]] will also appear in the compiled passage text. You can get around this by
 +placing the text between ''​%%{%%''​ and ''​%%}%%''​ marks. Inside, all runs of consecutive whitespace (line breaks, spaces)
 +will be reduced to just one space.
 +
 +=== Example usage: ===
 +
 +<​code>​
 +{
 +    This sentence
 +    will be
 +    (set: $event to true)
 +    written on one line
 +    with only single spaces.
 +}
 +</​code>​
 +=== Details: ===
 +
 +You can nest this markup within itself - ''​%%{Good ​ { gumballs!}}%%''​ - but the inner pair won't behave any
 +differently as a result of being nested.
 +
 +Text inside macro calls (in particular, text inside strings provided to macro) will not be collapsed.
 +Neither will text //​outputted//​ by macro calls, either - ''​%%{(print:" ​  "​)}%%''​ will still print all 3 spaces,
 +and ''​%%{(display:"​Attic"​)}%%''​ will still display all of the whitespace in the "​Attic"​ passage.
 +
 +Also, text inside the verbatim syntax, such as ''​%%Thunder` ​  ​`hound%%'',​ will not be collapsed either.
 +
 +If the markup contains a [[harlowe:​replace|(replace:​)]] command attached to a hook, the hook will still have its whitespace
 +collapsed, even if it is commanded to replace text outside of the markup.
 +
 +If you only want to remove specific line breaks, consider the escaped line break markup.
harlowe/collapsing_whitespace.txt ยท Last modified: 2017/10/09 20:39 (external edit)