function make_reader() { //Partial Rendering $idlist = Config::render_ids() + Config::skip_ids(); if (!empty($idlist)) { v("Running partial build", VERBOSE_RENDER_STYLE); $reader = new Reader_Partial(); } else { v("Running full build", VERBOSE_RENDER_STYLE); $reader = new Reader(); } return $reader; }
public function __construct() { parent::__construct(); $render_ids = Config::render_ids(); if ($render_ids !== NULL) { if (is_array($render_ids)) { $this->partial = $render_ids; } else { $this->partial[$render_ids] = 1; } $skip_ids = Config::skip_ids(); if ($skip_ids !== NULL) { if (is_array($skip_ids)) { $this->skip = $skip_ids; } else { $this->skip[$skip_ids] = 1; } } } else { throw new \Exception("Didn't get any IDs to seek"); } $parents = array(); if (file_exists(Config::output_dir() . "index.sqlite")) { $sqlite = new \SQLite3(Config::output_dir() . "index.sqlite"); // Fetch all ancestors of the ids we should render foreach ($render_ids as $p => $v) { do { $id = $sqlite->escapeString($p); $row = $sqlite->query("SELECT parent_id FROM ids WHERE docbook_id = '{$id}'")->fetchArray(SQLITE3_ASSOC); if ($row["parent_id"]) { $parents[] = $p = $row["parent_id"]; continue; } break; } while (1); } } $this->parents = $parents; }
public function __construct() { parent::__construct(); $render_ids = Config::render_ids(); if ($render_ids !== NULL) { if (is_array($render_ids)) { $this->partial = $render_ids; } else { $this->partial[$render_ids] = 1; } $skip_ids = Config::skip_ids(); if ($skip_ids !== NULL) { if (is_array($skip_ids)) { $this->skip = $skip_ids; } else { $this->skip[$skip_ids] = 1; } } } else { throw new \Exception("Didn't get any IDs to seek"); } }
public function option_skip($k, $v) { $skip_ids = Config::skip_ids(); foreach ((array) $v as $i => $val) { $recursive = true; if (strpos($val, "=") !== false) { list($val, $recursive) = explode("=", $val); if (!is_numeric($recursive) && defined($recursive)) { $recursive = constant($recursive); } $recursive = (bool) $recursive; } $skip_ids[$val] = $recursive; } Config::set_skip_ids($skip_ids); }
$readerOpts |= LIBXML_XINCLUDE; } // Indexing if (Index::requireIndexing()) { v("Indexing...", VERBOSE_INDEXING); // Create indexer $format = $render->attach(new Index()); $reader->open(Config::xml_file(), NULL, $readerOpts); $render->execute($reader); $render->detach($format); v("Indexing done", VERBOSE_INDEXING); } else { v("Skipping indexing", VERBOSE_INDEXING); } //Partial Rendering $idlist = Config::render_ids() + Config::skip_ids(); if (!empty($idlist)) { v("Running partial build", VERBOSE_RENDER_STYLE); $reader = new Reader_Partial(); } else { v("Running full build", VERBOSE_RENDER_STYLE); } foreach ((array) Config::package() as $package) { $factory = Format_Factory::createFactory($package); // Default to all output formats specified by the package if (count(Config::output_format()) == 0) { Config::set_output_format((array) $factory->getOutputFormats()); } // Register the formats foreach (Config::output_format() as $format) { $render->attach($factory->createFormat($format));