$bible = Filter_Cli::argument(@$argv, 1); // Create folders for the information. $directory = Export_Logic::bibleDirectory($bible) . "/info"; if (!file_exists($directory)) { mkdir($directory, 0777, true); } // Filenames for the various types of OpenDocument files. $informationdFilename = "{$directory}/information.html"; $falloutFilename = "{$directory}/fallout.html"; $database_logs = Database_Logs::getInstance(); $database_config_bible = Database_Config_Bible::getInstance(); $database_bibles = Database_Bibles::getInstance(); $database_books = Database_Books::getInstance(); $stylesheet = $database_config_bible->getExportStylesheet($bible); $filter_text = new Filter_Text($bible); $books = $database_bibles->getBooks($bible); foreach ($books as $book) { $chapters = $database_bibles->getChapters($bible, $book); foreach ($chapters as $chapter) { $usfm = $database_bibles->getChapter($bible, $book, $chapter); $usfm = trim($usfm); // Use small chunks of USFM at a time for much better performance. $filter_text->addUsfmCode($usfm); } } // Go through USFM to find the info and fallout. $filter_text->run($stylesheet); // Save files. $filter_text->produceInfoDocument($informationdFilename); $filter_text->produceFalloutDocument($falloutFilename); $database_logs->log(Locale_Translate::_("Documents with information and fallout were created") . " {$bible}", Filter_Roles::TRANSLATOR_LEVEL);