Options
All
  • Public
  • Public/Protected
  • All
Menu

BracketInclude & MultiSingleAsterisk

BracketInclude & MultiSingleAsterisk

BUILD_INCLUDE

/**
 * [[include:replace01.txt]]
 */

Config

const bp = new BuildProcess();
const opt = {
  match: {
    kind: "bracketIncludeMulti"
  },
  comment: {
    type: "singleAsterisk"
  },
  breakstring: {
    width: 60,
    flags: "word"
  },
  match: {
    kind: "bracketIncludeMulti"
  },
  text: {
    indent: true
  }
};
const results = bp.buildInclude('','./includes/replace.txt', opt`);

Output

/**
 * The quick, brown fox jumps over a lazy dog. DJs flock by when
 * MTV ax quiz prog. Junk MTV quiz graced by fox whelps.Bawds jog,
 * flick quartz, vex nymphs. Waltz, bad nymph, for quick jigs vex!
 * Fox nymphs grab quick-jived waltz. Brick quiz whangs jumpy veldt
 * fox.Bright vixens jump; dozy fowl quack. Quick wafting zephyrs
 * vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged
 * fop blew my junk TV quiz.How quickly daft jumping zebras vex.
 * Two driven jocks help fax my big quiz. Quick, Baz, get my woven
 * flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled. Five
 * quacking zephyrs jolt my wax bed. Flummoxed by job, kvetching
 * W. zaps Iraq. Cozy sphinx waves quart jug of bad milk.A very
 * bad quack might jinx zippy fowls. Few quips galvanized the mock
 * jury box. Quick brown dogs jump over the lazy fox. The jay,
 * pig, fox, zebra, and my wolves quack!Blowzy red vixens fight
 * for a quick jump. Joaquin Phoenix was gazed by MTV for luck.
 * A wizard’s job is to vex chumps quickly in fog. Watch "Jeopardy!
 * ", Alex Trebek's fun TV quiz game. Woven silk pyjamas exchanged
 * for blue quartz.
 */

File replace01.txt is to be included in output file.

Comment in jsDoc style and remove padding between * and start of lines.

Options

Comment

The option comments allow for input file content to be treated as comments in the output.

Comment Type SingleAsterisk

{comment: { type: "singleAsterisk" }} or inline comment?type=singleAsterisk
Pads the left side of each line with * and a single space.
Useful for comment replacement that is required inline.

Example:
If you have the following.

/**
 * [[include:doc/myMarkdown.md]]
 */

The output would be similar to the following.

/**
 * my multi line comments
 * comments continue on this line
 */

See: Enum values for commentkind for possible types.

Breakstring

The various options of breakstring allow for the breaking of lines in different ways.
If the width option of breakstring is not set then width defaults to 80.

See: Interface for IOpt.breakstring

Breakstring break width

break=width break input base on width property determind by breakstring?width=# where as # is a whole number that Defaults to 80.

Break input base on width.
Default: 80.

See Also: Options Breakstring Break
See Also: Options Breakstring Break width

Breakstring break word

break=word break input base on width property determind by breakstring?width=# where as # is a whole number that Defaults to 80.

Determins that when the width is reached the line will not break until it is not on a word. This results in lines sometimes being longer than the value set by width due to lines breaking on a word and not character.

Break input base on width.
Default: 80.

See Also: Options width

Text

The option text allow for input file content to be manipulated in several ways before being outputed.

Text Indent

{text: {indent: true}} or inline text?indent=true
The option text?indent or text?indent=true will result in the output including the indent on each line that came before the BUILD_INCLUDE.

comment?padleft=0
Setting padleft to a value of 0 actually removes any padding between * and the input file line contents. This may not be perferable in most cases. The value can be increased to created more spaces other than the default of 1.

{match:{kind: "bracketIncludeMulti" }}

Matches the following

[[include:filepath]]
[[include:filepath]](options)  
* [[include:filepath]]  
* [[include:filepath]](options)  
// [[include:filepath]]  
// [[include:filepath]](options)

See Also: Class MatchBracketIncludeMulti

See Also: IOpt
See Also: regexKind for match kind options.

Generated using TypeDoc