diff --git a/README.md b/README.md index 732e3d8a2..6c07f3691 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Inform 7 -[Version](notes/versioning.md): 10.1.0-beta+6V40 'Krypton' (12 August 2022) +[Version](notes/versioning.md): 10.1.0-beta+6V41 'Krypton' (15 August 2022) ## About Inform diff --git a/build.txt b/build.txt index 505a8bb6d..d07f24cd1 100644 --- a/build.txt +++ b/build.txt @@ -1,3 +1,3 @@ Prerelease: beta -Build Date: 12 August 2022 -Build Number: 6V40 +Build Date: 15 August 2022 +Build Number: 6V41 diff --git a/docs/inbuild/1-mn.html b/docs/inbuild/1-mn.html index cfc61490c..83bff994e 100644 --- a/docs/inbuild/1-mn.html +++ b/docs/inbuild/1-mn.html @@ -74,6 +74,7 @@ function togglePopup(material_id) { inbuild_registry *selected_registry = NULL; text_stream *filter_text = NULL; pathname *preprocess_HTML_destination = NULL; +text_stream *preprocess_HTML_app = NULL;

§2. Main routine. When Inbuild is called at the command line, it begins at main, like all C programs. @@ -401,6 +402,7 @@ other options to the selection defined here. enum BUILD_REGISTRY_CLSW enum PREPROCESS_HTML_CLSW enum PREPROCESS_HTML_TO_CLSW +enum PREPROCESS_APP_CLSW

Read the command line2.8 =

@@ -457,6 +459,8 @@ other options to the selection defined here. L"construct HTML page based on X"); CommandLine::declare_switch(PREPROCESS_HTML_TO_CLSW, L"preprocess-html-to", 2, L"set destination for -preprocess-html to be X"); + CommandLine::declare_switch(PREPROCESS_APP_CLSW, L"preprocess-app", 2, + L"use CSS suitable for app platform X (macos, windows, linux)"); Supervisor::declare_options(); CommandLine::read(argc, argv, NULL, &Main::option, &Main::bareword); @@ -509,12 +513,15 @@ other options to the selection defined here. case PREPROCESS_HTML_TO_CLSW: preprocess_HTML_destination = Pathnames::from_text(arg); break; + case PREPROCESS_APP_CLSW: + preprocess_HTML_app = Str::duplicate(arg); + break; case PREPROCESS_HTML_CLSW: if (preprocess_HTML_destination == NULL) Errors::fatal("must specify -preprocess-html-to P to give destination path P first"); filename *F = Filenames::from_text(arg); filename *T = Filenames::in(preprocess_HTML_destination, Filenames::get_leafname(F)); - Registries::preprocess_HTML(T, F); + Registries::preprocess_HTML(T, F, preprocess_HTML_app); break; } Supervisor::option(id, val, arg, state); diff --git a/docs/inbuild/M-rc.html b/docs/inbuild/M-rc.html index 83e3fe68d..bfcd9b4c4 100644 --- a/docs/inbuild/M-rc.html +++ b/docs/inbuild/M-rc.html @@ -75,6 +75,7 @@ and those not documented in this manual are covered in that one. -graph show dependency graph of target(s) but take no action -inspect show target(s) but take no action -matching X apply to all works in nest(s) matching requirement X +-preprocess-app X use CSS suitable for app platform X (macos, windows, linux) -preprocess-html X construct HTML page based on X -preprocess-html-to X set destination for -preprocess-html to be X -rebuild completely rebuild target(s) diff --git a/docs/supervisor-module/2-rgs.html b/docs/supervisor-module/2-rgs.html index 5c9e96cb3..34fffdbc0 100644 --- a/docs/supervisor-module/2-rgs.html +++ b/docs/supervisor-module/2-rgs.html @@ -244,7 +244,7 @@ through exactly as written. TRUE, Registries::scan_line, NULL, PPS); } -void Registries::scan_line(text_stream *line, text_file_position *tfp, void *X) { +void Registries::scan_line(text_stream *line, text_file_position *tfp, void *X) { preprocessor_state *PPS = (preprocessor_state *) X; WRITE_TO(PPS->dest, "%S\n", line); } @@ -270,7 +270,7 @@ files for the named platform. It's an -void Registries::css_expander(preprocessor_macro *mm, preprocessor_state *PPS, +void Registries::css_expander(preprocessor_macro *mm, preprocessor_state *PPS, text_stream **parameter_values, preprocessor_loop *loop, text_file_position *tfp) { text_stream *platform = parameter_values[0]; filename *prototype = InstalledFiles::filename_for_platform(CSS_SET_BY_PLATFORM_IRES, platform); @@ -761,17 +761,43 @@ they may need platform-specific CSS in order to display properly in Dark Mode, use congenial fonts, and so on.

-

We preprocess from F to T: +

We preprocess from F to T, except that we look to see if there's a platform +variant of the file F first: for example, if F is Fruits/bananas.html, and +the platform is wii, then we look for Fruits/bananas-wii.html and use that +instead. (If not, we just use F.) In practice, for example, this allows the +file in the apps which lists keyboard shortcuts to vary with platform.

-void Registries::preprocess_HTML(filename *T, filename *F) {
+void Registries::preprocess_HTML(filename *T, filename *F, text_stream *platform) {
     linked_list *ML = NEW_LINKED_LIST(preprocessor_macro);
     Preprocessor::new_macro(ML, I"include-css", I"?platform: PLATFORM",
-        Registries::css_expander, NULL);
+        Registries::preprocess_css_expander, NULL);
+    TEMPORARY_TEXT(variant)
+    Filenames::write_unextended_leafname(variant, F);
+    WRITE_TO(variant, "-%S", platform);
+    Filenames::write_extension(variant, F);
+    filename *variant_F = Filenames::in(Filenames::up(F), variant);
+    if (TextFiles::exists(variant_F)) F = variant_F;
+    DISCARD_TEXT(variant)
     WRITE_TO(STDOUT, "%f -> %f\n", F, T);
     Preprocessor::preprocess(F, T, NULL, ML,
-        NULL_GENERAL_POINTER, '#', UTF8_ENC);
+        STORE_POINTER_text_stream(platform), '#', UTF8_ENC);
+}
+
+void Registries::preprocess_css_expander(preprocessor_macro *mm, preprocessor_state *PPS,
+    text_stream **parameter_values, preprocessor_loop *loop, text_file_position *tfp) {
+    text_stream *platform = parameter_values[0];
+    if (Str::len(platform) == 0) platform = RETRIEVE_POINTER_text_stream(PPS->specifics);
+    filename *prototype = InstalledFiles::filename_for_platform(CSS_SET_BY_PLATFORM_IRES, platform);
+    WRITE_TO(PPS->dest, "<style type=\"text/css\">\n");
+    WRITE_TO(PPS->dest, "<!--\n");
+    TextFiles::read(prototype, FALSE, "can't open include file",
+        TRUE, Registries::scan_line, NULL, PPS);
+    prototype = InstalledFiles::filename_for_platform(CSS_FOR_STANDARD_PAGES_IRES, platform);
+    TextFiles::read(prototype, FALSE, "can't open include file",
+        TRUE, Registries::scan_line, NULL, PPS);
+    WRITE_TO(PPS->dest, "--></style>\n");
 }