Generates the data that powers the index page
977
protected function generateIndex() {

		/**
			*  Handle missing index.html. Solves https://github.com/drupal-pattern-lab/patternlab-php-core/issues/14
			*  Could also be used to re-add missing styleguidekit assets with a few edits?
			*
			*  1. @TODO: Figure out a better way to future-proof path resolution for styleguidekit `dist` folder
			*  2. Recusirively copy files from styleguidekit to publicDir via https://stackoverflow.com/a/7775949
			*  3. Make sure we only try to create new directories if they don't already exist
			*  4. Only copy files if they are missing (vs changed, etc)
			*/
		if (!file_exists(Config::getOption("publicDir")."/index.html")) {
			$index = Console::getHumanReadablePath(Config::getOption("publicDir")).DIRECTORY_SEPARATOR."index.html";
			Console::writeWarning($index . " is missing. No biggie. Grabbing a fresh copy from your StyleguideKit...");

			$baseDir = Config::getOption("baseDir") . '/vendor';
			$finder = new Finder();

			// Locate the current theme's styleguidekit assets via the patternlab-styleguidekit `type` in composer.json
			$finder->files()->name("composer.json")->in($baseDir)->contains('patternlab-styleguidekit')->sortByName();

			foreach ($finder as $file) {
				$src = dirname($file->getRealPath()) . DIRECTORY_SEPARATOR . 'dist'; /* [1] */
				$dest= Config::getOption("publicDir");

				if (is_dir($src)){

					if(!is_dir($dest)) {
						mkdir($dest, 0755);
	        }

	        foreach ( /* [2] */
						$iterator = new \RecursiveIteratorIterator(
							new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item
					) {
						if ($item->isDir()) {
							if(!is_dir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName())) { /* [3] */
								mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
							}
						} else {
							if(!file_exists($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName())) { /* [4] */
								copy($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
							}
						}
					}
				}
			}
		}

		// set-up the dispatcher
		$dispatcherInstance = Dispatcher::getInstance();

		// note the start of the operation
		$dispatcherInstance->dispatch("builder.generateIndexStart");

		// default var
		$dataDir = Config::getOption("publicDir")."/styleguide/data";

		// double-check that the data directory exists
		if (!is_dir($dataDir)) {
			FileUtil::makeDir($dataDir);
		}

		$output = "";

		// load and write out the config options
		$config                         = array();
		$exposedOptions                 = Config::getOption("exposedOptions");
		foreach ($exposedOptions as $exposedOption) {
			$config[$exposedOption]     = Config::getOption($exposedOption);
		}
		$output     .= "var config = ".json_encode($config).";\n";

		// load the ish Controls
		$ishControls     = array();
		$controlsToHide  = array();
		$ishControlsHide = Config::getOption("ishControlsHide");
		if ($ishControlsHide) {
			foreach ($ishControlsHide as $controlToHide) {
				$controlsToHide[$controlToHide] = "true";
			}
		}
		$ishControls["ishControlsHide"] = $controlsToHide;
		$output      .= "var ishControls = ".json_encode($ishControls).";\n";

		// load and write out the items for the navigation
		$niExporter   = new NavItemsExporter();
		$navItems     = $niExporter->run();
		$output      .= "var navItems = ".json_encode($navItems).";\n";

		// load and write out the items for the pattern paths
		$patternPaths = array();
		$ppdExporter  = new PatternPathDestsExporter();
		$patternPaths = $ppdExporter->run();
		$output      .= "var patternPaths = ".json_encode($patternPaths).";\n";

		// load and write out the items for the view all paths
		$viewAllPaths = array();
		$vapExporter  = new ViewAllPathsExporter();
		$viewAllPaths = $vapExporter->run($navItems);
		$output      .= "var viewAllPaths = ".json_encode($viewAllPaths).";\n";

		// gather plugin package information
		$packagesInfo = array();
		$componentDir = Config::getOption("componentDir");
		if (!is_dir($componentDir)) {
			mkdir($componentDir);
		}
		$componentPackagesDir = $componentDir."/packages";
		if (!is_dir($componentDir."/packages")) {
			mkdir($componentDir."/packages");
		}
		$finder = new Finder();
		$finder->files()->name("*.json")->in($componentPackagesDir);
		$finder->sortByName();
		foreach ($finder as $file) {
			$filename = $file->getFilename();
			if ($filename[0] != "_") {
				$javascriptPaths = array();
				$packageInfo = json_decode(file_get_contents($file->getPathname()),true);
				foreach ($packageInfo["templates"] as $templateKey => $templatePath) {
					$templatePathFull = $componentDir."/".$packageInfo["name"]."/".$templatePath;
					$packageInfo["templates"][$templateKey] = (file_exists($templatePathFull)) ? file_get_contents($templatePathFull) : "";
				}
				foreach ($packageInfo["javascripts"] as $key => $javascriptPath) {
					$javascriptPaths[] = "patternlab-components/".$packageInfo["name"]."/".$javascriptPath;
				}
				$packageInfo["javascripts"] = $javascriptPaths;
				$packagesInfo[] = $packageInfo;
			}
		}
		$output .= "var plugins = ".json_encode($packagesInfo).";";

		// write out the data
		file_put_contents($dataDir."/patternlab-data.js",$output);
		// Structuring all the same data that went into `patternlab-data.js` and putting it into `patternlab-data.json` too
		$allPlData = array(
			'config' => $config,
			'ishControls' => $ishControls,
			'navItems' => $navItems,
			'patternPaths' => $patternPaths,
			'viewAllPaths' => $viewAllPaths,
			'plugins' => $packagesInfo,
		);
		file_put_contents($dataDir."/patternlab-data.json", json_encode($allPlData));

		// note the end of the operation
		$dispatcherInstance->dispatch("builder.generateIndexEnd");

	}
519301
def current_index(self):
        """"""
        i = self._parent.proxy_model.mapToSource(self._parent.currentIndex())
        return i
157196
def _display_data(self, index):
        """"""
        return to_qvariant(self._data[index.row()][index.column()])
697793
def get_index_pages(original_url, pagination_index, pagination_interval, options={})
      resps = []
      prev_url = nil
      while resps.empty? || !resps.last.empty?
        next_url = self.next_index_page_url(original_url, pagination_index)
        break if next_url.empty?
        
        next_url = resolve_url(next_url, original_url)
        break if next_url == prev_url

        next_resp = self.get_page(next_url, @index_debug, options).to_s
        prev_url = next_url
        pagination_index += pagination_interval
        resps << next_resp
      end
      resps
    end
299264
def requires(self):
        
        for url in NEWSPAPERS:
            yield IndexPage(url=url, date=self.date)
408382
function (pageIndex, options, callback) {

            if (pageIndex < 0) {
                throw "pageIndex must be >= 0";
            }

            var page = this.$pageCache[pageIndex];
            if (!page) {
                page = this.$pageCache[pageIndex] = new Page(null, this, pageIndex);
            }

            var self = this;
            options = _.extend(this.$, options);
            page.fetch(options, function (err, page) {
                // insert data into items if not already inserted
                if (!err && !page.itemsInsertedIntoCollection) {
                    page.itemsInsertedIntoCollection = true;

                    // add items to collection
                    self.add(page.$items, {
                        index: (pageIndex || 0) * self.$.pageSize
                    });
                }

                if (callback) {
                    callback(err, page, options);
                }
            });
        }
966919
public void generate()
		throws WikiApiException
	{
		Indexer data = null;
		try {
			data = new Indexer(config);

			System.out.println("GENERATING INDEX STARTED");

			long bufferSize = config.getBufferSize();
			Revision rev;
			long count = 0;
			long last = 0, now, start = System.currentTimeMillis();

			Iterator<Revision> it = new IndexIterator(config);
			while (it.hasNext()) {

				if (++count % bufferSize == 0) {
					now = System.currentTimeMillis() - start;
					System.out.println(Time.toClock(now) + "\t" + (now - last)
							+ "\tINDEXING " + count);
					last = now;
				}

				rev = it.next();
				data.index(rev);
			}

			System.out.println("GENERATING INDEX ENDED + ("
					+ Time.toClock(System.currentTimeMillis() - start) + ")");

		}
		catch (Exception e) {

			throw new WikiApiException(e);

		}
		finally {
			if (data != null) {
				data.close();
			}
		}
	}
1040390
function onPage(output, page) {
    var options = output.getOptions();

    // Inline assets
    return Modifiers.modifyHTML(page, [
        Modifiers.inlineAssets(options.get('root'), page.getFile().getPath())
    ])

    // Write page using website generator
    .then(function(resultPage) {
        return WebsiteGenerator.onPage(output, resultPage);
    });
}
376241
protected function manageIndex()
    {
        $postDatatable = $this->get($this->route_name.'_datatable');
        $postDatatable->buildDatatable();

        return $this->render($this->getIndexTemplate(), array(
            'datatable' => $postDatatable,
        ));
    }
203253
def index
      offset = params[:offset] || 0
      limit = params[:limit] || 20
      @runs = Run.order('id DESC').offset(offset).limit(limit)
      render json: @runs
    end
959260
public function actionIndex()
	{
		$model=$this->prepare();
		if($model->files!=array() && isset($_POST['generate'], $_POST['answers']))
		{
			$model->answers=$_POST['answers'];
			$model->status=$model->save() ? CCodeModel::STATUS_SUCCESS : CCodeModel::STATUS_ERROR;
		}

		$this->render('index',array(
			'model'=>$model,
		));
	}
952519
function logResults(data)
{
	var done,output,result;
	var nextIsReady = true;
	
	while (nextIsReady)
	{
		result = data.page.results[data.page.currentIndex];
		
		if (result !== undefined)
		{
			done = data.page.done===true && data.page.currentIndex>=data.page.results.length-1;
			
			output = logResult(result, done);
			
			if (output !== "") log(output);
			if (done === true) return;
			
			data.page.currentIndex++;
		}
		else
		{
			nextIsReady = false;
		}
	}
}
1018766
function generatePages(generator, output) {
    var pages = output.getPages();
    var logger = output.getLogger();

    // Is generator ignoring assets?
    if (!generator.onPage) {
        return Promise(output);
    }

    return Promise.reduce(pages, function(out, page) {
        var file = page.getFile();

        logger.debug.ln('generate page "' + file.getPath() + '"');

        return generatePage(out, page)
        .then(function(resultPage) {
            return generator.onPage(out, resultPage);
        })
        .fail(function(err) {
            logger.error.ln('error while generating page "' + file.getPath() + '":');
            throw err;
        });
    }, output);
}
1307355
def data(self, index, role=Qt.DisplayRole):
        

        if not index.isValid():
            return QVariant()

        if role == Qt.DisplayRole:
            return QVariant(self.__languages[index.row()].name)
        return QVariant()
946444
public function render_index_page(index_page $page) {
        $data = $page->export_for_template($this);
        return parent::render_from_template('core_group/index', $data);
    }
680216
public function actionIndex()
    {
        /**
         * @var Generator $generator
         */
        $generator = $this->module->generator;
        $response = Yii::$app->response;
        $response->format = yii\web\Response::FORMAT_RAW;
        $response->headers->set('Content-Type', 'text/plain');

        return $generator->render();
    }
592435
function () {
            var data = this._data;
            if (data.selectedIndex == -1) {
                // no item is selected
                return [];
            } else if (data.selectedIndex != null) {
                return [data.selectedIndex];
            } else {
                var retVal = [];
                // we iterate over the view, so that we return indexes in the order visible to the user:
                var view = data.itemsView;
                view.refresh(); // in case there are changes in the view, refresh it
                var items = view.items;
                for (var idx = 0, length = items.length; idx < length; idx++) {
                    if (items[idx].value.selected) {
                        // retVal.push(idx);
                        retVal.push(items[idx].initIndex);
                    }
                }
                return retVal;
            }
        }