Sage
Welcome to Sage
Volume (20%) Hide Volume
Topics
Paragraph, Line, and Word Breaks

This section discusses how Sage manages paragraph breaks, line breaks, and word breaks.

Paragraphs

In Sage, a blank line creates a paragraph break. Within a paragraph, text is word-wrapped by the web browser. The browser breaks only on whitespace, dashes, and question marks.

For example:

This is the first paragraph, which consists of several adjacent lines in the source file, which will all be combined into a single paragraph, word-wrapped by the web browser. The blank line above causes this sentence to start a new paragraph. It too can be as long as needed. A third paragraph, but note that multiple blank lines in a row are no different than a single one. [//] A line comment doesn't make a new paragraph This is still the third paragraph, because line comments do not break paragraphs. [{] nor do block comments [}] This is still the third paragraph! A short paragraph. Shorter still!

The above Sage content produces the following output:


This is the first paragraph, which consists of several adjacent lines in the source file, which will all be combined into a single paragraph, word-wrapped by the web browser.

The blank line above causes this sentence to start a new paragraph. It too can be as long as needed.

A third paragraph, but note that multiple blank lines in a row are no different than a single one. This is still the third paragraph, because line comments do not break paragraphs. This is still the third paragraph!

A short paragraph.

Shorter still!


The [pre] Tag

The [pre] tag creates a section of text where all whitespace, including line breaks, are significant. This is very similar to the <pre> tag in HTML. For example:

This is a normal paragraph, word-wrapped by the browser. [pre]Here, though, multiple spaces are significant! Also, line breaks happen based on the source code, and no word wrapping is used [--] so watch out for long lines![end] Now we are out of the "pre" block, and back to normal Sage whitespace handling.

The above example produces this output:


This is a normal paragraph, word-wrapped by the browser.

Here, though, multiple spaces are significant! Also, line breaks happen based on the source code, and no word wrapping is used — so watch out for long lines!

Now we are out of the "pre" block, and back to normal Sage whitespace handling.


Compared to HTML's <pre> tag, Sage's [pre] tag is more flexible in terms of formatting the source code. In Sage, if the content of a [pre] begins and ends with blank lines, those blank lines will be removed. Thus, the above example could also be done like this…

This is a normal paragraph, word-wrapped by the browser. [pre] Here, though, multiple spaces are significant! Also, line breaks happen based on the source code, and no word wrapping is used [--] so watch out for long lines! [end] Now we are out of the "pre" block, and back to normal Sage whitespace handling.

This produces the same results as before, but with nicer formatting in the source code.

The [br] Tag

To force a line break, without making a new paragraph, use the [br] tag. For example:

This is a short line,[br] but only because of the `|[br]` tag!

The above example produces the following…


This is a short line,
but only because of the [br] tag!


The [br?] Tag

The [br] tag gives the browser the option to break a long line of text at a spot where it wouldn't otherwise do so. For example…

`C:\Windows\Users\DefaultUser\[br?]AppData\Settings\Microsoft\`

The above example produces the following…


C:\Windows\Users\DefaultUser\AppData\Settings\Microsoft\


If the above example appears on a single line, reduce the width of your browser window – eventually, the browser will wrap the line just before "AppData". Without the [br?] tag, the browser would not break the line at all (because there are no spaces, dashes, or question marks).

See also: The [-?] Tag.

The [-?] Tag

The [-?] tag represents a soft hyphen, which allows the browser to break a long line, inserting a hyphen if (and only if) it does so. For example…

`C:\Windows\Users\DefaultUser\App[-?]lications\Settings\Microsoft\`

The above example produces the following…


C:\Windows\Users\DefaultUser\App­lications\Settings\Microsoft\


If the above example appears on a single line, reduce the width of your browser window – eventually, the browser will wrap the line after "App" but before "lications", adding a hyphen after "App". Without the [-?] tag, the browser would not break the line at all (because there are no spaces, dashes, or question marks).

See also: the [br?] Tag.

The [_] Tag

A tag consisting of one or more underscores indicates that many non-breaking spaces. This can be useful to prevent the browser form breaking long lines at inopportune places.

The [indent] Tag

The [indent][end] tag indents content. These tags may nest, of course. For example…

The `dir` command... [indent] *Displays a list of files and subdirectories in a directory.* [tt][plain][drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4] [drive:][path][filename][end][end] [indent] Specifies drive, directory, and/or files to list. [list] #* `|/A` Displays files with specified attributes. #* `|/B` Uses bare format (no heading information or summary). #* `|/C` Display the thousand separator in file sizes. This is the default. Use `|/-C` to disable display of separator. #* `|/D` Same as wide but files are list sorted by column. [end] [end] Switches may be preset in the DIRCMD environment variable. Override preset switches by prefixing any switch with - (hyphen) -- for example, `|/-W`. [end]

The above example produces…


The dir command...

Displays a list of files and subdirectories in a directory.

[drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4] [drive:][path][filename]

Specifies drive, directory, and/or files to list.

  • /A Displays files with specified attributes.
  • /B Uses bare format (no heading information or summary).
  • /C Display the thousand separator in file sizes. This is the default. Use /-C to disable display of separator.
  • /D Same as wide but files are list sorted by column.

Switches may be preset in the DIRCMD environment variable. Override preset switches by prefixing any switch with - (hyphen) -- for example, /-W.


The [box] tag is similar, in that it indents content, but unlike [indent], it surrounds content in a visible box.

The [\] Tag

This tag is a splice – it allows you to continue a long line onto the next line, without creating whitespace in the output. For example…

`C:\Windows\Users\DefaultUser\Applications\[\] Settings\Microsoft\Details.json`

This produces the following…


C:\Windows\Users\DefaultUser\Applications\Settings\Microsoft\Details.json


Notice how the browser makes this a single line, even though it was two lines in the Sage source file. The [\] tag is only allowed at the end of a line.

The [j] Tag

This tag's name is short for join, and it comes in two varieties: with and without a tag body.

Without Tag Body

Without a tag body, use the [j] tag immediately after a dash or question mark, when you don't want a word break. For example…

`C:\Windows\Users\DefaultUser\Application-[j]Data\Settings\Microsoft\`

The above example produces the following…


C:\Windows\Users\DefaultUser\Application-⁠Data\Settings\Microsoft\


Even as you reduce the width of your browser window, the path stays on one line, thanks to the [j] tag. Without this, the browser would break the line after the dash.

With Tag Body

With a tag body, the [j] tag ensures that an entire phrase remains free of word breaks. It accomplishes this by converting spaces to non-breaking spaces, and (in effect) inserting [j] tags (without tag bodies) after each dash and question mark. For example…

`[j C:\Windows\Users\All-Users\App Data\Microsoft\Web-Browsers\]`

The above example produces the following…


C:\Windows\Users\All-⁠Users\App Data\Microsoft\Web-⁠Browsers\


Even as you reduce the width of your browser window, the path stays on one line, thanks to the [j] tag. Without this, the browser would break the line after the space and/or the dashes.

Without this tag, we would have to resort to this kind of thing:

`C:\Windows\Users\All-[j]Users\App[_]Data\Microsoft\Web-[j]Browsers\]`

Note the mess made by the [_] and [j] tags.

The [j?] Tag

This tag is like the [j] tag, but with a twist: you can specify which characters to word break after. For example…

`[j? \ C:\Windows\Users\All-Users\App Data\Microsoft\Web-Browsers\]`

This produces…


C:\Windows\Users\All-⁠Users\App Data\Microsoft\Web-⁠Browsers\


If you reduce the width of the browser window, you'll notice that a word break opportunity comes after each backslash.

To include spaces in the set of word break characters, use a quoted string:

`[j? "\ " C:\Windows\Users\All-Users\App Data\Microsoft\Web-Browsers\]`

This produces…


C:\Windows\Users\All-⁠Users\App Data\Microsoft\Web-⁠Browsers\


Now the browser will break after backslashes and spaces (but not dashes).

Last Modified: 10/24 9:45:52 am
In this article (top)  View article's Sage markup
10/24 9:45:52 am