HtmlExportVisitor
in package
implements
VisitorInterface
Transforms a song into HTML code.
Interfaces, Classes, Traits and Enums
- VisitorInterface
- Visitor pattern for song objects.
Table of Contents
- CHORD_CLASSNAME = 'chord'
- HTML class of a chord element.
- PARAGRAPH_CLASSNAME = 'song-paragraph'
- HTML class of a paragraph.
- REPEAT_CLASSNAME = 'repeat-marker'
- HTML class of a repeat marker.
- REPEAT_COUNT_DEFAULT = 2
- Default repeat count.
- REPEAT_COUNT_FORMAT = '%d×'
- Repeat count formatting string.
- REPEAT_END = ' :]'
- Repeat marker end.
- REPEAT_START = '[: '
- Repeat marker start.
- STROPHE_LABEL_CLASSNAME = 'strophe-label'
- HTML class of strophe label.
- STROPHE_LABEL_FORMAT = '%s '
- Strophe label formatting string.
- STROPHE_LABEL_REPEAT_FORMAT = '%s (%d×) '
- Strophe label with repeat indicator formatting string.
- STROPHE_REFERENCE_CLASSNAME = 'strophe-reference'
- HTML class of strophe reference.
- STROPHE_REFERENCE_FORMAT = '%s'
- Strophe reference formatting string.
- STROPHE_REFERENCE_REPEAT_FORMAT = '%s %d×'
- Strophe reference with repeat indicator formatting string.
- $html : array<string|int, string>
- Lines of HTML code.
- $label : string|null
- Label of the currently processed strophe.
- $repeat : int|null
- Repeat count of the currently processed node.
- $row : array<string|int, array<string|int, mixed>>|null
- Chunks in the current line.
- saveHtml() : string
- Returns the built HTML.
- visitChord() : void
- Process a chord.
- visitParagraph() : void
- Process a paragraph.
- visitRepeat() : void
- Process a repeat.
- visitSong() : void
- Process entire song.
- visitSongInfo() : void
- Process song metadata.
- visitSongLyrics() : void
- Process song lyrics.
- visitStrophe() : void
- Process a strophe.
- visitStropheReference() : void
- Process a strophe reference.
- visitText() : void
- Process plain text.
- visitVerse() : void
- Process a verse.
Constants
CHORD_CLASSNAME
HTML class of a chord element.
private
string
CHORD_CLASSNAME
= 'chord'
PARAGRAPH_CLASSNAME
HTML class of a paragraph.
private
string
PARAGRAPH_CLASSNAME
= 'song-paragraph'
REPEAT_CLASSNAME
HTML class of a repeat marker.
private
string
REPEAT_CLASSNAME
= 'repeat-marker'
REPEAT_COUNT_DEFAULT
Default repeat count.
private
int
REPEAT_COUNT_DEFAULT
= 2
REPEAT_COUNT_FORMAT
Repeat count formatting string.
private
string
REPEAT_COUNT_FORMAT
= '%d×'
REPEAT_END
Repeat marker end.
private
string
REPEAT_END
= ' :]'
REPEAT_START
Repeat marker start.
private
string
REPEAT_START
= '[: '
STROPHE_LABEL_CLASSNAME
HTML class of strophe label.
private
string
STROPHE_LABEL_CLASSNAME
= 'strophe-label'
STROPHE_LABEL_FORMAT
Strophe label formatting string.
private
string
STROPHE_LABEL_FORMAT
= '%s '
STROPHE_LABEL_REPEAT_FORMAT
Strophe label with repeat indicator formatting string.
private
string
STROPHE_LABEL_REPEAT_FORMAT
= '%s (%d×) '
STROPHE_REFERENCE_CLASSNAME
HTML class of strophe reference.
private
string
STROPHE_REFERENCE_CLASSNAME
= 'strophe-reference'
STROPHE_REFERENCE_FORMAT
Strophe reference formatting string.
private
string
STROPHE_REFERENCE_FORMAT
= '%s'
STROPHE_REFERENCE_REPEAT_FORMAT
Strophe reference with repeat indicator formatting string.
private
string
STROPHE_REFERENCE_REPEAT_FORMAT
= '%s %d×'
Properties
$html
Lines of HTML code.
private
array<string|int, string>
$html
= []
$label
Label of the currently processed strophe.
private
string|null
$label
= null
$repeat
Repeat count of the currently processed node.
private
int|null
$repeat
= null
$row
Chunks in the current line.
private
array<string|int, array<string|int, mixed>>|null
$row
= null
Contains arrays with chord and text keys.
Methods
saveHtml()
Returns the built HTML.
public
saveHtml() : string
Return values
string —HTML
visitChord()
Process a chord.
public
visitChord(Chord $chord) : void
Parameters
- $chord : Chord
-
chord
Tags
Return values
void —visitParagraph()
Process a paragraph.
public
visitParagraph(Paragraph $paragraph) : void
Parameters
- $paragraph : Paragraph
-
paragraph
Tags
Return values
void —visitRepeat()
Process a repeat.
public
visitRepeat(Repeat $repeat) : void
Parameters
- $repeat : Repeat
-
repeat
Tags
Return values
void —visitSong()
Process entire song.
public
visitSong(Song $song) : void
Parameters
- $song : Song
-
song
Tags
Return values
void —visitSongInfo()
Process song metadata.
public
visitSongInfo(SongInfo $info) : void
Parameters
- $info : SongInfo
-
metadata
Tags
Return values
void —visitSongLyrics()
Process song lyrics.
public
visitSongLyrics(SongLyrics $lyrics) : void
Parameters
- $lyrics : SongLyrics
-
lyrics
Tags
Return values
void —visitStrophe()
Process a strophe.
public
visitStrophe(Strophe $strophe) : void
Parameters
- $strophe : Strophe
-
strophe
Tags
Return values
void —visitStropheReference()
Process a strophe reference.
public
visitStropheReference(StropheReference $reference) : void
Parameters
- $reference : StropheReference
-
strophe reference
Tags
Return values
void —visitText()
Process plain text.
public
visitText(Text $text) : void
Parameters
- $text : Text
-
text
Tags
Return values
void —visitVerse()
Process a verse.
public
visitVerse(Verse $verse) : void
Parameters
- $verse : Verse
-
verse