A simple way to load, read, and present texts from various Source Text libraries.
This is a companion library to the Source Text Parser library.
- Quickly load one or many source text libraries
- Navigate to desired texts or segments and render them for display.
Install the composer package:
composer require UrbanMonastics/SourceTextLibrary
In the most simple approach you can pass text to be parsed.
$SourceTextLibrary = new /UrbanMonastics/SourceTextLibrary();
echo $SourceTextLibrary->text("Hello *Source Parser*!"); # prints: <p>Hello <em>Source Parser</em>!</p>
You can also take advantage of the structure of the source texts.
$SourceTextLibrary = new SourceTextLibrary();
// Load the source data into the parser
$Source = json_decode( file_get_contents('path/to/source.json'), true );
$SourceTextLibrary->loadSource( $Source );
$SourceTextLibrary->loadText();
echo $SourceTextLibrary->text("Hello *Source Parser*!"); # prints: <p>Hello <em>Source Parser</em>!</p>
// Clear the loaded Source and Texts - without altering other options
$SourceTextLibrary->clearSource();