Writes the appropriate files for creating an HTML index page for human navigation of the user data export.
761109
protected function write_html_data() {
        global $PAGE, $SITE, $USER, $CFG;

        // Do this first before adding more files to $this->files.
        list($tree, $treekey, $allfiles) = $this->prepare_for_export();
        // Add more detail to the tree such as contexts.
        $richtree = $this->make_tree_object($tree, $treekey);
        // Now that we have more detail we can use that to sort it.
        $this->sort_my_list($richtree);

        // Copy over the JavaScript required to display the html page.
        $jspath = ['privacy', 'export_files', 'general.js'];
        $targetpath = ['js', 'general.js'];
        $this->copy_data($jspath, $targetpath);

        $jquery = ['lib', 'jquery', 'jquery-3.2.1.min.js'];
        $jquerydestination = ['js', 'jquery-3.2.1.min.js'];
        $this->copy_data($jquery, $jquerydestination);

        $requirecurrentpath = ['lib', 'requirejs', 'require.min.js'];
        $destination = ['js', 'require.min.js'];
        $this->copy_data($requirecurrentpath, $destination);

        $treepath = ['lib', 'amd', 'build', 'tree.min.js'];
        $destination = ['js', 'tree.min.js'];
        $this->copy_data($treepath, $destination);

        // Icons to be used.
        $expandediconpath = ['pix', 't', 'expanded.svg'];
        $this->copy_data($expandediconpath, ['pix', 'expanded.svg']);
        $collapsediconpath = ['pix', 't', 'collapsed.svg'];
        $this->copy_data($collapsediconpath, ['pix', 'collapsed.svg']);
        $naviconpath = ['pix', 'i', 'navigationitem.svg'];
        $this->copy_data($naviconpath, ['pix', 'navigationitem.svg']);
        $moodleimgpath = ['pix', 'moodlelogo.svg'];
        $this->copy_data($moodleimgpath, ['pix', 'moodlelogo.svg']);

        // Additional required css.
        $csspath = ['theme', 'boost', 'style', 'moodle.css'];
        $destination = ['moodle.css'];
        $this->copy_data($csspath, $destination);

        $csspath = ['privacy', 'export_files', 'general.css'];
        $destination = ['general.css'];
        $this->copy_data($csspath, $destination);

        // Create an index file that lists all, to be newly created, js files.
        $encoded = json_encode($allfiles,  JSON_PRETTY_PRINT);
        $encoded = 'var user_data_index = ' . $encoded;

        $path = 'js' . DIRECTORY_SEPARATOR . 'data_index.js';
        $this->write_data($path, $encoded);

        $output = $PAGE->get_renderer('core_privacy');
        $navigationpage = new \core_privacy\output\exported_navigation_page(current($richtree));
        $navigationhtml = $output->render_navigation($navigationpage);

        $systemname = $SITE->fullname;
        $fullusername = fullname($USER);
        $siteurl = $CFG->wwwroot;

        // Create custom index.html file.
        $rtl = right_to_left();
        $htmlpage = new \core_privacy\output\exported_html_page($navigationhtml, $systemname, $fullusername, $rtl, $siteurl);
        $outputpage = $output->render_html_page($htmlpage);
        $this->write_data('index.html', $outputpage);
    }
1323690
def write_files(self, jdoc, output_dir):
        ''''''

        #get all distinct schema names from jdoc:
        schemas = [j for j in jdoc if j.object_type == 'schema']
        schemas = [j for j in schemas if len([x for x in jdoc if x.object_type != 'schema' and x.schema_name == j.object_name]) > 0]
        if not os.path.exists(output_dir):
            os.makedirs(output_dir)
        try:
            shutil.copytree(self.template_dir + os.sep + 'styles',
                            output_dir + os.sep + 'styles')
        except FileExistsError:
            None
        for schema in schemas:
            with open(output_dir + os.sep + schema.object_name + '.html', 'w') as f:
                f.write(self.generate_html(jdoc, schema, schemas))
        with open(output_dir + os.sep + 'index.html', 'w') as f:
            f.write(self.generate_index(schemas))
1129911
def write_multiple_files(args, base_dir, crawler):
    """"""
    for i, query in enumerate(args['query']):
        if query in args['files']:
            # Write files
            if args['out'] and i < len(args['out']):
                outfilename = args['out'][i]
            else:
                outfilename = '.'.join(query.split('.')[:-1])
            write_files(args, [query], outfilename)
        elif query in args['urls']:
            # Scrape/crawl urls
            domain = utils.get_domain(query)
            if args['html']:
                # Create a directory to save PART.html files in
                if not args['quiet']:
                    print('Storing html files in {0}/'.format(domain))
                utils.mkdir_and_cd(domain)

            if args['crawl'] or args['crawl_all']:
                # Crawl and save HTML files/image files to disk
                infilenames = crawler.crawl_links(query)
            else:
                raw_resp = utils.get_raw_resp(query)
                if raw_resp is None:
                    return False

                # Saves page as PART.html file
                prev_part_num = utils.get_num_part_files()
                utils.write_part_file(args, query, raw_resp)
                curr_part_num = prev_part_num + 1
                infilenames = utils.get_part_filenames(curr_part_num, prev_part_num)

            # Convert output or leave as PART.html files
            if args['html']:
                # HTML files have been written already, so return to base dir
                os.chdir(base_dir)
            else:
                # Write files to text or pdf
                if infilenames:
                    if args['out'] and i < len(args['out']):
                        outfilename = args['out'][i]
                    else:
                        outfilename = utils.get_outfilename(query, domain)
                    write_files(args, infilenames, outfilename)
                else:
                    sys.stderr.write('Failed to retrieve content from {0}.\n'
                                     .format(query))
    return True
981639
public function actionExport() {
        // Initialize export array.
        $data = [
            'siteGroups' => [],
            'sites' => [],
            'routes' => [],
            'fieldGroups' => [],
            'volumes' => [],
            'transforms' => [],
            'tagGroups' => [],
            'categoryGroups' => [],
            'sections' => [],
            'fields' => [],
            'entryTypes' => [],
            'globalSets' => [],
            'userGroups' => [],
            'users' => [],
        ];
        // The list of exportable items.
        $exportList = [
            'sites' => [
                'bodyParam' => 'siteSelection',
                'postProcess' => [
                    'groupId' => 'siteGroups'
                ],
            ],
            'sections' => [
                'bodyParam' => 'sectionSelection',
                'postProcess' => [
                    'entryTypes' => 'entryTypes'
                ],
            ],
            'routes' => [
                'bodyParam' => 'routeSelection',
            ],
            'volumes' => [
                'bodyParam' => 'volumeSelection',
            ],
            'transforms' => [
                'bodyParam' => 'assetTransformSelection',
            ],
            'tagGroups' => [
                'bodyParam' => 'tagSelection',
            ],
            'categoryGroups' => [
                'bodyParam' => 'categorySelection',
            ],
            'fields' => [
                'bodyParam' => 'fieldSelection',
                'postProcess' => [
                    'groupId' => 'fieldGroups'
                ],
            ],
            'globalSets' => [
                'bodyParam' => 'globalSelection',
            ],
            'userGroups' => [
                'bodyParam' => 'userGroupSelection',
            ],
            'users' => [
                'bodyParam' => 'userSelection',
            ]
        ];

        foreach ($exportList as $processorName => $processorInfo) {
            $exportIds = Craft::$app->request->getBodyParam($processorInfo['bodyParam']);
            if ($exportIds) {
                foreach ($exportIds as $exportId) {
                    if ($processorName === 'routes') {
                        $exportObj = Architect::$processors->$processorName->exportByUid($exportId);
                    } else {
                        $exportObj = Architect::$processors->$processorName->exportById($exportId);
                    }

                    if (isset($processorInfo['postProcess'])) {
                        foreach ($processorInfo['postProcess'] as $postProcessKey => $postProcessorName) {
                            switch ($postProcessKey) {
                                case 'groupId':
                                    $groupName = Architect::$processors->$postProcessorName->exportById($exportObj[$postProcessKey]);
                                    if (\in_array($groupName, $data[$postProcessorName], false) === false) {
                                        $data[$postProcessorName][] = $groupName;
                                    }
                                    unset($exportObj[$postProcessKey]);
                                    break;
                                case 'entryTypes':
                                    if (isset($exportObj[$postProcessKey]) && \is_array($exportObj[$postProcessKey])) {
                                        $data[$postProcessorName] = array_merge($data[$postProcessorName], $exportObj[$postProcessKey]);
                                        unset($exportObj[$postProcessKey]);
                                    }
                                    break;
                            }
                        }
                    }

                    $data[$processorName][] = $exportObj;
                }
            }
        }

        foreach ($data as $key => $value) {
            if (\count($value) <= 0) {
                unset($data[$key]);
            }
        }

        $this->renderTemplate('architect/export_results', [ 'dump' => json_encode($data, JSON_PRETTY_PRINT) ]);
    }
292777
def generate_xhtml(path, dirs, files):
    """"""
    # Prepare the path to display.
    if path != '/':
        dirs.insert(0, '..')
    if not path.endswith('/'):
        path += '/'

    def itemize(item):
        return '<a href="%s">%s</a>' % (item, path+item)
    dirs = [d + '/' for d in dirs]
    return """
    <html>
     <body>
      <h1>%s</h1>
       <pre>%s\n%s</pre>
     </body>
    </html>
    """ % (path, '\n'.join(itemize(dir) for dir in dirs), '\n'.join(itemize(file) for file in files))
615486
def write
      each_site_file do |item|
        item.write(dest) if regenerator.regenerate?(item)
      end
      regenerator.write_metadata
      Jekyll::Hooks.trigger :site, :post_write, self
    end
466037
def write_index(self):
        """"""
        self.fileobj.seek(self.last_offset)
        index = index_header.build(dict(entries=self.entries))
        self.fileobj.write(index)
        self.filesize = self.fileobj.tell()
1320682
private function createSinglePage()
    {
        if (isset($this->config['single_pages'])) {
            $themes = $this->config['single_pages'];
            foreach ($themes as $key => $v) {
                $theme_page = $this->source_dir.DIRECTORY_SEPARATOR . $v;
                if ( file_exists($theme_page) ) {
                    $file_path = $this->public_dir . DIRECTORY_SEPARATOR . $key . '/index.html';
                    $html = $this->renderArticle($theme_page, true);
                    $this->fileSys->create($file_path, $html);
                }
            }
        }
    }
1332642
public static void writeTo(String html, Writer writer) throws IOException {
		int index = html.indexOf('#');
		if (index == -1) {
			writer.write(html);
		} else {
			final ResourceBundle resourceBundle = getResourceBundle();
			int begin = 0;
			while (index != -1) {
				writer.write(html, begin, index - begin);
				final int nextIndex = html.indexOf('#', index + 1);
				final String key = html.substring(index + 1, nextIndex);
				writer.write(resourceBundle.getString(key));
				begin = nextIndex + 1;
				index = html.indexOf('#', begin);
			}
			writer.write(html, begin, html.length() - begin);
		}
	}
363278
def write(site_destination_dir)
      if modified?
        Files.copy_p(path, destination(site_destination_dir))
        @is_modified = false
        true
      else
        false
      end
    end
536643
public function Write()
    {
        $content = "";

        foreach($this->preferences as $key => $data)
        {
            if(is_array($data))
            {
                $is_section = true;

                foreach($data as $dataKey => $dataValues)
                {
                    if(is_long($dataKey))
                    {
                        $is_section = false;
                        break;
                    }
                }

                $content .= "\n";

                //Write global array value
                if(!$is_section)
                {
                    foreach($data as $dataKey => $dataValue)
                    {
                        $content .= $key . '[] = "' . $dataValue . '"' . "\n";
                    }
                }

                //Write section
                else
                {
                    $content .= "[" . $key . "]\n";

                    foreach($data as $dataKey => $dataValue)
                    {
                        if(is_array($dataValue))
                        {
                            foreach($dataValue as $dataInnerValue)
                            {
                                $content .= $dataKey . '[] = "' . $dataInnerValue . '"' . "\n";
                            }
                        }
                        else
                        {
                            $content .= $dataKey . ' = "' . $dataValue . '"' . "\n";
                        }
                    }
                }

                $content .= "\n";
            }

            //Write global value
            else
            {
                $content .= $key . ' = "' . $data . '"' . "\n";
            }
        }

        file_put_contents($this->file, $content);
    }
408071
def export(path=None, user_content=False, context=None,
           username=None, password=None, render_offline=False,
           render_wide=False, render_inline=True, out_filename=None,
           api_url=None, title=None, quiet=False, grip_class=None):
    
    export_to_stdout = out_filename == '-'
    if out_filename is None:
        if path == '-':
            export_to_stdout = True
        else:
            filetitle, _ = os.path.splitext(
                os.path.relpath(DirectoryReader(path).root_filename))
            out_filename = '{0}.html'.format(filetitle)

    if not export_to_stdout and not quiet:
        print('Exporting to', out_filename, file=sys.stderr)

    page = render_page(path, user_content, context, username, password,
                       render_offline, render_wide, render_inline, api_url,
                       title, None, quiet, grip_class)

    if export_to_stdout:
        try:
            print(page)
        except IOError as ex:
            if ex.errno != 0 and ex.errno != errno.EPIPE:
                raise
    else:
        with io.open(out_filename, 'w', encoding='utf-8') as f:
            f.write(page)
192707
def write_files(template, destination='./dxf'):
    
    os.makedirs(destination)
    for key, value in template.items():
        with open(os.path.join(destination, key), 'w') as f:
            f.write(replace_whitespace(value, insert=False))
1349839
def Page(QLExportable):
  '''  '''
  def __init__(self, filename, page_id):
    self.id = page_id
    super(Page, self).__init__(filename)

  def export(self, export_format=ExportFormat.PNG):
    pass
1189959
def render_requests_data_to_html(self, data, file_name, context={}):
        """"""
        file_path = os.path.join(self.html_dir, file_name)
        logger.info('Rendering HTML file %s...' % file_path)
        data = format_data(data)
        data.update(context)
        data.update(domain=self.domain)
        with open(file_path, 'w') as fp:
            fp.write(render_template('realtime.html', data))
479873
protected void generateIndexFile() throws DocFileIOException {
        String title = configuration.getText("doclet.Window_Single_Index");
        HtmlTree body = getBody(true, getWindowTitle(title));
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
                ? HtmlTree.HEADER()
                : body;
        addTop(htmlTree);
        addNavLinks(true, htmlTree);
        if (configuration.allowTag(HtmlTag.HEADER)) {
            body.addContent(htmlTree);
        }
        HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
        divTree.addStyle(HtmlStyle.contentContainer);
        elements = new TreeSet<>(indexbuilder.getIndexMap().keySet());
        elements.addAll(configuration.tagSearchIndexKeys);
        addLinksForIndexes(divTree);
        for (Character unicode : elements) {
            if (configuration.tagSearchIndexMap.get(unicode) == null) {
                addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
            } else if (indexbuilder.getMemberList(unicode) == null) {
                addSearchContents(unicode, configuration.tagSearchIndexMap.get(unicode), divTree);
            } else {
                addContents(unicode, indexbuilder.getMemberList(unicode),
                        configuration.tagSearchIndexMap.get(unicode), divTree);
            }
        }
        addLinksForIndexes(divTree);
        body.addContent((configuration.allowTag(HtmlTag.MAIN))
                ? HtmlTree.MAIN(divTree)
                : divTree);
        if (configuration.allowTag(HtmlTag.FOOTER)) {
            htmlTree = HtmlTree.FOOTER();
        }
        addNavLinks(false, htmlTree);
        addBottom(htmlTree);
        if (configuration.allowTag(HtmlTag.FOOTER)) {
            body.addContent(htmlTree);
        }
        createSearchIndexFiles();
        printHtmlDocument(null, true, body);
    }
705911
def write(self):
        
        html = self.render()

        if self.file_type == 'pdf':
            self.write_pdf(html)
        else:
            with codecs.open(self.destination_file, 'w',
                             encoding='utf_8') as outfile:
                outfile.write(html)