Generate sitemap XML index
167224
def render
      xml = Builder::XmlMarkup.new(:indent => 2)
      xml.instruct!(:xml, :version => '1.0', :encoding => 'UTF-8')
      xml.sitemapindex(XmlSitemap::INDEX_SCHEMA_OPTIONS) { |s|
        @maps.each do |item|
          s.sitemap do |m|
            m.loc        item[:loc]
            m.lastmod    item[:lastmod]
          end
        end
      }.to_s
    end
1265719
def generate(basename, xml):
    ''''''
    if basename.endswith('.lua'):
        filename = basename
    else:
        filename = basename + '.lua'

    msgs = []
    enums = []
    filelist = []
    for x in xml:
        msgs.extend(x.message)
        enums.extend(x.enum)
        filelist.append(os.path.basename(x.filename))

    for m in msgs:
        if xml[0].little_endian:
            m.fmtstr = '<'
        else:
            m.fmtstr = '>'
        for f in m.ordered_fields:
            m.fmtstr += mavfmt(f)
        m.order_map = [ 0 ] * len(m.fieldnames)
        for i in range(0, len(m.fieldnames)):
            m.order_map[i] = m.ordered_fieldnames.index(m.fieldnames[i])

    print("Generating %s" % filename)
    outf = open(filename, "w")
    generate_preamble(outf)
    generate_msg_table(outf, msgs)
    generate_body_fields(outf)
    
    for m in msgs:
        generate_msg_fields(outf, m)
    
    for m in msgs:
        generate_payload_dissector(outf, m)
    
    generate_packet_dis(outf)
#    generate_enums(outf, enums)
#    generate_message_ids(outf, msgs)
#    generate_classes(outf, msgs)
#    generate_mavlink_class(outf, msgs, xml[0])
#    generate_methods(outf, msgs)
    generate_epilog(outf)
    outf.close()
    print("Generated %s OK" % filename)
231025
function SiteBuilder(config, fileMap) {
  this.config = config;
  this.root = config.root;

  var helperFile = path.join(this.root, '_lib', 'helpers.js');
  if (existsSync(helperFile)) {
    userHelpers = require(helperFile);
  }

  var filterFile = path.join(this.root, '_lib', 'filters.js');
  if (existsSync(filterFile)) {
    userFilters = require(filterFile);
  }

  var postFilterFile = path.join(this.root, '_lib', 'post-filters.js');
  if (existsSync(postFilterFile)) {
    userPostFilters = require(postFilterFile);
  }

  this.outputRoot = config.output;
  this.fileMap = fileMap;
  this.posts = [];
  this.helpers = helpers;
  this.events = new EventEmitter();
  this.includes = {};

  this.loadPlugins();
}
1076905
public static function writeSitemap( $links, $fileName = "sitemap.xml", $baseUrl = "" )
	{
		$xml	= XML_DOM_GoogleSitemapBuilder::buildSitemap( $links, $baseUrl );
		$file	= new FS_File_Writer( $fileName );
		return $file->writeString( $xml );
	}
302672
def generateIndex(self, refresh=0, refresh_index=0):
        """"""
        open(self.index_file, "wt").write(self.renderIndex(refresh=refresh, refresh_index=refresh_index))
1160807
def create_sitemap(app, exception):
    """"""
    site_url = app.builder.config.site_url or app.builder.config.html_baseurl
    if not site_url:
        print("sphinx-sitemap error: neither html_baseurl nor site_url "
              "are set in conf.py. Sitemap not built.")
        return
    if (not app.sitemap_links):
        print("sphinx-sitemap warning: No pages generated for sitemap.xml")
        return

    ET.register_namespace('xhtml', "http://www.w3.org/1999/xhtml")

    root = ET.Element("urlset")
    root.set("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9")

    get_locales(app, exception)

    if app.builder.config.version:
        version = app.builder.config.version + '/'
    else:
        version = app.builder.config.version

    for link in app.sitemap_links:
        url = ET.SubElement(root, "url")
        if app.builder.config.language is not None:
            ET.SubElement(url, "loc").text = site_url + \
                  app.builder.config.language + '/' + version + link
            if len(app.locales) > 0:
                for lang in app.locales:
                    linktag = ET.SubElement(
                        url,
                        "{http://www.w3.org/1999/xhtml}link"
                    )
                    linktag.set("rel", "alternate")
                    linktag.set("hreflang", lang)
                    linktag.set("href", site_url + lang + '/' + version + link)
        elif app.builder.config.version:
            ET.SubElement(url, "loc").text = site_url + version + link
        else:
            ET.SubElement(url, "loc").text = site_url + link

    filename = app.outdir + "/sitemap.xml"
    ET.ElementTree(root).write(filename,
                               xml_declaration=True,
                               encoding='utf-8',
                               method="xml")
    print("sitemap.xml was generated for URL %s in %s" % (site_url, filename))
155312
function Generate()
    {
        if ($this->cacher->MustUseCache())
        {
            $this->xml = $this->cacher->GetFromCache();
            return;
        }
        $this->AddAllPages();
        $this->xml = $this->sitemap->SaveXml();
        if ($this->cacher->MustStoreToCache())
        {
            $this->cacher->StoreToCache($this->xml);
        }
    }
912903
function publishSiteMaps () {
    var path = 'sitemap.xml';

    return publishRobotsTxt ()
        .then(function () {
            return fs.statAsync(path);
        })
        .then(function (pStat) {
            if (pStat.isFile()) {
                // file exists; throw Error to proceed with creating of sitemaps for posts and tags
                return publishPostsSiteMap()
                    .then(function () {
                        return publishTagsSiteMap();
                    })
                    .catch(log.error);
            }
            else {
                // create sitemap.xml file
                throw new Error();
            }
        })
        .catch(function () {
            var sitemap = sm.createSitemap ({
                hostname: config.siteUrl,
                cacheTime: 600000,        // 600 sec - cache purge period
                urls: [{
                        url: '/sitemap-posts.xml',
                        changeFreq: 'weekly',
                        priority: 0.8,
                        lastmodrealtime: true
                    },
                    {
                        url: '/sitemap-tags.xml',
                        changeFreq: 'weekly',
                        priority: 0.8,
                        lastmodrealtime: true
                    }]
            });

            return fs
                .openAsync(path, 'w')
                .then(function () {
                    return fs
                        .writeFileAsync(path, sitemap.toString())
                        .then(function () {
                            // file exists; throw Error to proceed with creating of sitemaps for posts and tags
                            return publishPostsSiteMap().then(function () {
                                return publishTagsSiteMap().catch(log.error);
                            });
                        })
                        .catch(log.error);
                })
                .catch(log.error);
        });
}
1118661
public function generateSitemap(ReadSiteInterface $site)
    {
        $nodes = $this->getSitemapNodesFromSite($site);
        $filename = $site->getSiteId() . '/sitemap.xml';

        $map['url'] = $nodes;

        $xmlContent = str_replace(
            array('</response>', '<response>'),
            array('</urlset>', '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'),
            $this->serializer->serialize($map, 'xml')
        );
        $this->filesystem->dumpFile('web/' . $filename, $xmlContent);

        return $filename;
    }
772107
private function CreateUrlset()
    {
        $this->urlset = $this->domDoc->createElement("urlset");
        $this->SetAttribute($this->urlset, "xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9");
    }
276832
private function make_list_by_sitemap(){
		$sitemap = $this->px->site()->get_sitemap();
		foreach( $sitemap as $page_info ){
			set_time_limit(30);
			$href = $this->px->href( $page_info['path'] );
			if( preg_match('/^(?:[a-zA-Z0-9]+\:)?\/\//', $href) ){
				// プロトコル名、またはドメイン名から始まるリンク先はスキップ
				continue;
			}
			$href = preg_replace( '/\/$/s', '/'.$this->px->get_directory_index_primary(), $href );
			$href = preg_replace( '/^'.preg_quote($this->px->get_path_controot(), '/').'/s', '/', $href );
			$this->add_queue( $href );
		}
		return true;
	}
1241845
private function sendSitemap(): void
    {
        $this->addUrl(hu);

        $rs = safe_rows_start(
            'name',
            'txp_section',
            "name != 'default' and rah_sitemap_include_in = 1 order by name asc"
        );

        if ($rs) {
            while ($a = nextRow($rs)) {
                $this->addUrl(pagelinkurl(['s' => $a['name']]));
            }
        }

        $rs = safe_rows_start(
            'name, type',
            'txp_category',
            "name != 'root' and rah_sitemap_include_in = 1 order by name asc"
        );

        if ($rs) {
            while ($a = nextRow($rs)) {
                $this->addUrl(pagelinkurl([
                    'c' => $a['name'],
                    'context' => $a['type'],
                ]));
            }
        }

        $sql = ['Status >= 4'];

        foreach (do_list(get_pref('rah_sitemap_exclude_fields')) as $field) {
            if ($field) {
                $f = explode(':', $field);
                $n = strtolower(trim($f[0]));

                if (isset($this->articleFields[$n])) {
                    $sql[] = $this->articleFields[$n]." NOT LIKE '".doSlash(trim(implode(':', array_slice($f, 1))))."'";
                }
            }
        }

        if (get_pref('rah_sitemap_exclude_sticky_articles')) {
            $sql[] = 'Status != 5';
        }

        if (!get_pref('rah_sitemap_future_articles')) {
            $sql[] = 'Posted <= now()';
        }

        if (!get_pref('rah_sitemap_past_articles')) {
            $sql[] = 'Posted >= now()';
        }

        if (!get_pref('rah_sitemap_expired_articles')) {
            $sql[] = "(Expires = ".NULLDATETIME." or Expires >= now())";
        }

        $rs = safe_rows_start(
            '*, unix_timestamp(Posted) as posted, unix_timestamp(LastMod) as uLastMod',
            'textpattern',
            implode(' and ', $sql) . ' order by Posted desc'
        );

        if ($rs) {
            while ($a = nextRow($rs)) {
                $this->addUrl(permlinkurl($a), (int) max($a['uLastMod'], $a['posted']));
            }
        }

        foreach (do_list(get_pref('rah_sitemap_urls')) as $url) {
            if ($url) {
                $this->addUrl($url);
            }
        }

        $urlset = [];
        callback_event_ref('rah_sitemap.urlset', '', 0, $urlset);

        if ($urlset && is_array($urlset)) {
            foreach ($urlset as $url => $lastmod) {
                $this->addUrl($url, $lastmod);
            }
        }

        $xml =
            '<?xml version="1.0" encoding="utf-8"?>'.
            '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'.
            implode('', array_slice($this->addUrlset, 0, self::URL_LIMIT)).
            '</urlset>';

        ob_clean();
        txp_status_header('200 OK');
        header('Content-type: text/xml; charset=utf-8');

        if (get_pref('rah_sitemap_compress') &&
            strpos(serverSet('HTTP_ACCEPT_ENCODING'), 'gzip') !== false
        ) {
            header('Content-Encoding: gzip');
            $xml = gzencode($xml);
        }

        echo $xml;
        exit;
    }
336017
def generate
      sitemaps.group_by(&:folder).each do |folder, sitemaps|
        index_path = "#{DynamicSitemaps.temp_path}/#{folder}/#{DynamicSitemaps.index_file_name}"

        if !DynamicSitemaps.always_generate_index && sitemaps.count == 1 && sitemaps.first.files.count == 1
          file_path = "#{DynamicSitemaps.temp_path}/#{folder}/#{sitemaps.first.files.first}"
          FileUtils.copy file_path, index_path
          File.delete file_path
        else
          File.open(index_path, "w") do |file|
            write_beginning(file)
            write_sitemaps(file, sitemaps)
            write_end(file)
          end
        end
      end
    end
1172077
function createPinDateMapFromRssXmlObject(xmlObject) {
    var pinDateMap;

    try {
        pinDateMap = {};
        var pins = xmlObject.rss.channel[0].item;
        for (var i = 0; i < pins.length; i++) {
            var publishDate = new Date(pins[i].pubDate[0]);
            var pinId = getPinIdFromUrl(pins[i].guid[0]);
            pinDateMap[pinId] = publishDate;
        }
    } catch (e) {
        pinDateMap = {};
    }

    return pinDateMap;
}
123612
public function sitemapIndex()
    {
        $pageLimit = 10000;

        if (isset($this->tsSetup['pageLimit']) && $this->tsSetup['pageLimit'] != '') {
            $pageLimit = (int)$this->tsSetup['pageLimit'];
        }

        $sitemaps  = array();
        $pageItems = count($this->sitemapPages);
        $pageCount = ceil($pageItems / $pageLimit);

        $linkConf = array(
            'parameter'        => GeneralUtility::getCurrentPid() . ',' . $GLOBALS['TSFE']->type,
            'additionalParams' => '',
            'useCacheHash'     => 1,
        );

        for ($i = 0; $i < $pageCount; $i++) {
            if ($this->indexPathTemplate) {
                $link = GeneralUtility::fullUrl(str_replace('###PAGE###', $i, $this->indexPathTemplate));

                $sitemaps[] = $link;
            } else {
                $linkConf['additionalParams'] = '&page=' . ($i + 1);

                $sitemaps[] = GeneralUtility::fullUrl($GLOBALS['TSFE']->cObj->typoLink_URL($linkConf));
            }
        }

        $ret = '<?xml version="1.0" encoding="UTF-8"?>';
        $ret .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" '
            . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"';
        $ret .= ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 '
            . 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';

        // Call hook
        GeneralUtility::callHookAndSignal(__CLASS__, 'sitemapXmlIndexSitemapList', $this, $sitemaps);

        foreach ($sitemaps as $sitemapPage) {
            $ret .= '<sitemap><loc>' . htmlspecialchars($sitemapPage) . '</loc></sitemap>';
        }

        $ret .= '</sitemapindex>';

        // Call hook
        GeneralUtility::callHookAndSignal(__CLASS__, 'sitemapXmlIndexOutput', $this, $ret);

        return $ret;
    }
1068645
def start_output (self):
        """"""
        super(SitemapXmlLogger, self).start_output()
        self.xml_start_output()
        attrs = {u"xmlns": u"http://www.sitemaps.org/schemas/sitemap/0.9"}
        self.xml_starttag(u'urlset', attrs)
        self.flush()
756351
function generateIndex(base, files) {
  var document = base.copy();
  var head = document.find().only().elem('head').toValue();

  // set title
  head.find()
      .only().elem('title').toValue()
      .setContent('Mocha Tests - all');

  // bind testcases
  Object.keys(files).forEach(function (relative) {
    head.append('<script src="/test' + relative + '"></script>');
  });

  return document.content;
}