From 003cc5a29d0cfabf8588b700a826b516d639a087 Mon Sep 17 00:00:00 2001 From: Keith Marshall Date: Mon, 2 Nov 2020 21:41:07 +0000 Subject: [PATCH 1/1] Adapt index.html to serve arbitrarily specified content. * index.html (onload): Delegate content retrieval to... (load_page): ...this new javascript function, passing URL. (page-title, page-subtitle): Rename place-holders, using... (as-page-title, as-page-subtitle): ...these alternative names. * site.js (load_page): New function; it consolidates... (new_page, load_page_overlay, load_page_content): ...these, but excluding "page-title" and "page-subtitle" assignment; do this... (load_content): ...here, using repeated invocations of... (update_page_content_header): ...this new function; it propagates any "page-title" and "page-subtitle" values from the loaded page fragment, to their corresponding "index.html" place-holders, calling... (no_break): ...this new function, to substitute non-breaking hyphens in place of any included ASCII hyphen characters. * header.html (navbar): Use fully qualified "href" URL links on all tabs, replacing "onclick" actions. * about.html fdl.html terms.html (page-title, page-subtitle): Assign them to hidden
elements, (in
blocks), whence they may be propagated, via javascript executed on loading of the page fragment, to their visible "index.html" place-holders. * terms.html: Additionally, use a fully qualified "href" link, for reference to "fdl.html". * missing.html (page-title): Add hidden
entry. * site.css (dl.masthead): Define new style, to conceal the
assignments for "page-title", and "page-subtitle"; adjust top margin spacing for any immediately following paragraph. --- about.html | 13 +++++++++++++ fdl.html | 10 ++++++++++ header.html | 35 +++++------------------------------ index.html | 6 +++--- missing.html | 9 +++++++++ site.css | 17 +++++++++++++++++ site.js | 58 ++++++++++++++++++++++++++++++++-------------------------- terms.html | 14 +++++++++++--- 8 files changed, 100 insertions(+), 62 deletions(-) diff --git a/about.html b/about.html index 5978eb9..80c9ac3 100644 --- a/about.html +++ b/about.html @@ -2,6 +2,9 @@ * * about.html * + * Default landing page content for the MinGW.org web-site. + * + * * $Id$ * * Written by Keith Marshall @@ -45,6 +48,16 @@ * ” right (closing) typographic double quote * --> +
+ +
Welcome to MinGW.org
+
Home of the MinGW and MSYS Projects
+

MinGW, a contraction of “Minimalist GNU for Windows”, is a minimalist development environment diff --git a/fdl.html b/fdl.html index 185a4c2..a99d4e2 100644 --- a/fdl.html +++ b/fdl.html @@ -40,6 +40,16 @@ * DAMAGE. * --> +

+ +
MinGW.org Licensing
+
The MinGW Free Documentation Licence
+

Copyright © 2020, MinGW.org Project

Redistribution and use in source and 'compiled' forms (SGML, HTML, diff --git a/header.html b/header.html index 7d0c8ac..39e2ba1 100644 --- a/header.html +++ b/header.html @@ -39,41 +39,16 @@ * OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * - * - * Note: this page assumes browser support for the following numeric - * HTML entity codes: - * - * ‑ non-breaking hyphen - * ’ typographic apostrophe - * -->

Minimalist GNU for Windows

diff --git a/index.html b/index.html index 840ae87..3de3e67 100644 --- a/index.html +++ b/index.html @@ -49,12 +49,12 @@ - +
-

-

+

+


diff --git a/missing.html b/missing.html index 49a11fd..2fb995b 100644 --- a/missing.html +++ b/missing.html @@ -47,6 +47,15 @@ * ’ typographic apostrophe * --> +
+ +
MinGW.org Server Error
+

Page Not Found

The MinGW.org web‑site is undergoing an overhaul, whilst in the process of transferring to a new hosting provider. diff --git a/site.css b/site.css index 6db77ac..4ace8d6 100644 --- a/site.css +++ b/site.css @@ -212,6 +212,23 @@ p+ul */ margin: 0; padding-top: 1px; font-weight: normal; } +dl.masthead +{ /* On page overlays, we use a definition list to specify the + * page title, and subtitle, which are to be propagated to the + * masthead section within the page content; the content of the + * definition list, itself, should not be directly visible. + */ + display: none; +} +dl.masthead+p +{ /* The masthead section is separated from the remaining page + * content, by a horizontal rule; to keep white space balanced, + * above and below this rule, when it is immediately followed + * by a paragraph, with no intervening heading, we need to + * explicitly adjust the paragraph margin. + */ + margin-top: 1.3em; +} /* Supplementary formatting for sections with numbered headings * ============================================================ diff --git a/site.js b/site.js index c625c21..4c8cee2 100644 --- a/site.js +++ b/site.js @@ -39,6 +39,25 @@ function set_content( item, value ) if( element ) element.innerHTML = value; } +function no_break( text ) +{ /* Helper function to replace all occurrences of ASCII hyphen-minus, + * within "text", by substitution of HTML non-breaking hyphen. + */ + return text.replace( /-/g, "‑" ); +} + +function update_page_content_header( tag ) +{ /* Update the "page-title" and "page-subtitle" content-header text, + * by substitution into the "as-page-title" and "as-page-subtitle" + * place-holder elements, respectively. + */ + var element = document.getElementById( "page-".concat( tag )); + if( element ) + { if( tag == "title" ) document.title = element.innerHTML; + set_content( "as-page-".concat( tag ), no_break( element.innerHTML )); + } +} + function load_content( container, src ) { /* Set the content of the specified HTML "container" element, by * injection of the entire contents of an external file which is @@ -51,6 +70,8 @@ function load_content( container, src ) switch( this.status ) { case 200: set_content( container, this.responseText ); + update_page_content_header( "title" ); + update_page_content_header( "subtitle" ); break; case 404: load_content( container, "missing.html" ); @@ -60,34 +81,19 @@ function load_content( container, src ) request_handler.send(); } -function load_page_content( src, subtitle ) -{ /* Propagate the HTML document title to the "masthead" display, - * update the displayed page subtitle, (which may be null), and - * load the page content from the specified "src" file. - */ - set_content( "page-content", null ); - set_content( "page-title", document.title ); - set_content( "page-subtitle", subtitle ); - load_content( "page-content", src ); -} - -function load_page_overlay( src, title, subtitle ) -{ /* Replace the existing page content from the specified overlay - * "src" file, updating the page title, and subtitle, as may be - * appropriate. - */ - if( title ) document.title = title; - load_page_content( src, subtitle ); -} - -function new_page( src, subtitle ) -{ /* Create a new page display, starting from scratch; assign the - * displayed title from the HTML document title attribute, adding - * the specified subtitle, lay out the standard page header block, - * and load the page content from the "src" file. +function load_page( src ) +{ /* Load page content from the HTML fragment file, as determined + * from the specified "src" URL; if no alternative fragment name + * is specified, fall back to loading "about.html". */ + const ref = "?page="; + const div = "page-content"; + set_content( div, null ); load_content( "header", "header.html" ); - load_page_content( src, subtitle ); + if( src.includes( ref ) ) + src = src.substring( src.indexOf( ref ) + ref.length, src.length ); + else src = "about.html"; + load_content( div, src ); } /* $RCSfile$: end of file */ diff --git a/terms.html b/terms.html index d7461d9..5ab8347 100644 --- a/terms.html +++ b/terms.html @@ -49,6 +49,16 @@ * ” right (closing) typographic double quote * --> +

+ +
MinGW.org Licensing
+
Terms of Use for MinGW.org Products and Resources
+

Each of the various packages, which are distributed by MinGW.org, @@ -60,9 +70,7 @@ are as follows:—

MinGW.org Web‑Site Content

Publication of the content of this MinGW.org web‑site is subject to the terms of -this MinGW specific adaptation +this MinGW specific adaptation of the