function main() { BoostSiteTools\CommandLineOptions::parse(NEW_LIBRARIES_USAGE); $libraries = BoostLibraries::load(); $master = $libraries->get_for_version('master'); $unreleased_libs = array(); foreach ($master as $lib) { if ($lib['boost-version']->is_unreleased()) { $unreleased_libs[$lib['name']] = $lib; } } if ($unreleased_libs) { ksort($unreleased_libs, SORT_NATURAL | SORT_FLAG_CASE); $count = count($unreleased_libs); echo "For release notes:\n\n"; echo "[section New Libraries]\n\n"; foreach ($unreleased_libs as $lib) { echo "* [phrase library..[@/{$lib['documentation']} {$lib['name']}]:]\n"; echo " {$lib['description']}\n\n"; } echo "[endsection]\n\n"; } else { echo "No new libraries yet.\n"; } }
function main() { $libraries = BoostLibraries::load(); $master = $libraries->get_for_version('master'); $unreleased_libs = []; foreach ($master as $lib) { if ($lib['boost-version']->is_unreleased()) { $unreleased_libs[$lib['name']] = $lib; } } if ($unreleased_libs) { ksort($unreleased_libs, SORT_NATURAL | SORT_FLAG_CASE); $count = count($unreleased_libs); echo "For release notes:\n\n"; echo "[section New Libraries]\n\n"; foreach ($unreleased_libs as $lib) { echo "* [phrase library..[@/{$lib['documentation']} {$lib['name']}]:]\n"; echo " {$lib['description']}\n\n"; } echo "[endsection]\n\n"; echo "For root index file:\n\n"; $library_links = []; foreach ($unreleased_libs as $lib) { $library_links[] = "<a href=\"" . filesystem_doc_link($lib) . "\">{$lib['name']}</a>"; } echo " <p>The release includes {$count} new " . ($count === 1 ? "library" : "libraries") . "\n"; echo " (" . implode(",\n ", $library_links) . "),\n"; } }
function display() { // TODO: Specifying the version only works *after* a release, as // new libraries will still have develop/master as their // version. This works for now as version is always // master/develop, but might change in the future. $version = BoostVersion::from(array_key_exists('version', $this->args) ? $this->args['version'] : 'master'); $page = $this->args['page']; $libs = BoostLibraries::load(); $categorized = $libs->get_categorized_for_version($version, 'name', 'BoostLibraries::filter_released'); // TODO: Shouldn't really have to sort this here. uasort($categorized, function ($a, $b) { $a = $a['title']; $b = $b['title']; if ($a === 'Miscellaneous') { $a = 'ZZZZZZZZ'; } if ($b === 'Miscellaneous') { $b = 'ZZZZZZZZ'; } return $a > $b ?: ($a < $b ? -1 : 0); }); $alphabetic = $libs->get_for_version($version, 'name', 'BoostLibraries::filter_released'); $params = array('categorized' => array(), 'alphabetic' => array(), 'unreleased_libs' => array(), 'unreleased_lib_count' => 0); foreach ($categorized as $category) { $template_value = $category; $template_value['libraries'] = array(); foreach ($category['libraries'] as $index => $library) { $template_value['libraries'][] = $this->rewrite_library($library, $index); } $params['categorized'][] = $template_value; } foreach ($alphabetic as $index => $library) { $params['alphabetic'][] = $this->rewrite_library($library, $index); } if ($version->is_unreleased()) { $index = 0; foreach ($alphabetic as $library) { if ($library['boost-version']->is_unreleased() || $library['boost-version']->is_beta()) { $params['unreleased_libs'][] = $this->rewrite_library($library, $index++); } } } else { $index = 0; foreach ($alphabetic as $library) { if ($library['boost-version']->major() == $version->major() && $library['boost-version']->minor() == $version->minor()) { $params['unreleased_libs'][] = $this->rewrite_library($library, $index++); } } } $params['unreleased_lib_count'] = count($params['unreleased_libs']); // Better support for other branches? $template_dir = BOOST_REPOS_DIR . '/boost-' . ((string) $version == 'develop' ? 'develop' : 'master') . '/' . $page; echo BoostSimpleTemplate::render(file_get_contents($template_dir), $params); }
if (is_string($v) && $v != '') { $url_params .= $url_params ? '&' : '?'; $url_params .= urlencode($k) . '=' . urlencode($v); } } echo '<a href="' . html_encode($this->base_uri . $url_params) . '">', html_encode($description), '</a>'; } } function category_link($name) { $category = $this->categories[$name]; $this->option_link(isset($category['title']) ? $category['title'] : $name, 'view', 'category_' . $name); } } // Page variables $library_page = new LibraryPage($_GET, BoostLibraries::load()); if (BoostVersion::page()->is_numbered_release() && $library_page->libs->latest_version && BoostVersion::page()->compare($library_page->libs->latest_version) > 0) { BoostWeb::error_404($_SERVER['REQUEST_URI']); return; } // To avoid confusion, only show this page when there is actual documentation. // TODO: Maybe for versions without documentation, could display the list // with no links. // TODO: This duplicates the BoostDocumentation object in display_libs. $archive = new BoostDocumentation(array('fix_dir' => dirname(__FILE__) . '/fixes', 'archive_dir' => STATIC_DIR, 'use_http_expire_date' => true)); if (!is_dir($archive->documentation_dir())) { BoostWeb::error_404($_SERVER['REQUEST_URI']); return; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <?php // Returns true if the library is part of the current release of boost. function xmlentities($text) { return str_replace(array('&', '<', '>', '"', "'"), array('&', '<', '>', '"', '''), $text); } function echo_sitemap_url($loc, $priority, $freq) { $loc_xml = isset($_SERVER['HTTP_HOST']) ? xmlentities("http://{$_SERVER['HTTP_HOST']}/{$loc}") : xmlentities("http://www.boost.org/{$loc}"); echo <<<EOL <url> <loc>{$loc_xml}</loc> <priority>{$priority}</priority> <changefreq>{$freq}</changefreq> </url> EOL; } // Library list echo_sitemap_url("doc/libs/", '1.0', 'daily'); // Library 'home pages' $libs = BoostLibraries::load(); // TODO: Include hidden libraries? Or not? foreach ($libs->get_for_version(BoostVersion::current()) as $lib) { echo_sitemap_url("doc/libs/release/{$lib['documentation']}", '1.0', 'daily'); } ?> </urlset>
<?php require_once __DIR__ . '/../common/code/bootstrap.php'; if (isset($_GET['version'])) { try { $version = BoostVersion::from($_GET['version']); } catch (BoostVersion_Exception $e) { header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500); echo json_encode(array('error' => $e->getMessage())); exit(0); } } else { $version = BoostVersion::current(); } // TODO: This is a bit awkard, should probably have an alternative // to 'get_for_version' which returns a BoostLibraries instance // rather than an array. // TODO: Include hidden libraries. $version_libs = array_map(function ($lib) { return new BoostLibrary($lib); }, BoostLibraries::load()->get_for_version($version)); header('Content-type: application/json'); echo BoostLibrary::get_libraries_json($version_libs); echo $version_libs->to_json();