mirror of
https://github.com/ganelson/inform.git
synced 2024-06-17 07:40:47 +03:00
Added platform selection to HTML preprocessing
This commit is contained in:
parent
bcf3b5561f
commit
cfe81eaec2
|
@ -16,6 +16,7 @@ inbuild_nest *destination_nest = NULL;
|
|||
inbuild_registry *selected_registry = NULL;
|
||||
text_stream *filter_text = NULL;
|
||||
pathname *preprocess_HTML_destination = NULL;
|
||||
text_stream *preprocess_HTML_app = NULL;
|
||||
|
||||
@h Main routine.
|
||||
When Inbuild is called at the command line, it begins at |main|, like all C
|
||||
|
@ -317,6 +318,7 @@ other options to the selection defined here.
|
|||
@e BUILD_REGISTRY_CLSW
|
||||
@e PREPROCESS_HTML_CLSW
|
||||
@e PREPROCESS_HTML_TO_CLSW
|
||||
@e PREPROCESS_APP_CLSW
|
||||
|
||||
@<Read the command line@> =
|
||||
CommandLine::declare_heading(
|
||||
|
@ -370,6 +372,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);
|
||||
|
@ -420,12 +424,15 @@ void Main::option(int id, int val, text_stream *arg, void *state) {
|
|||
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);
|
||||
|
|
|
@ -670,11 +670,26 @@ use congenial fonts, and so on.
|
|||
We preprocess from |F| to |T|:
|
||||
|
||||
=
|
||||
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);
|
||||
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");
|
||||
}
|
||||
|
|
|
@ -864,15 +864,15 @@ $(INTERNALEXEMPLUM): \
|
|||
# agree with that.
|
||||
|
||||
{define: compile-inapp-advice}
|
||||
ifdef ADVICEHTML
|
||||
ifdef ADVICEHTML
|
||||
mkdir -p $(ADVICEHTML)
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-html resources/Documentation/Advice/AdviceCredits.html
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-html resources/Documentation/Advice/AdviceKeyboardShortcuts.html
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-html resources/Documentation/Advice/AdviceMaterialsFolder.html
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-html resources/Documentation/Advice/AdviceNewToInform.html
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-html resources/Documentation/Advice/AdviceUpgrading.html
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-html resources/Documentation/Advice/TestingTemplate.html
|
||||
endif
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-app $(HTMLPLATFORM) -preprocess-html resources/Documentation/Advice/AdviceCredits.html
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-app $(HTMLPLATFORM) -preprocess-html resources/Documentation/Advice/AdviceKeyboardShortcuts.html
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-app $(HTMLPLATFORM) -preprocess-html resources/Documentation/Advice/AdviceMaterialsFolder.html
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-app $(HTMLPLATFORM) -preprocess-html resources/Documentation/Advice/AdviceNewToInform.html
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-app $(HTMLPLATFORM) -preprocess-html resources/Documentation/Advice/AdviceUpgrading.html
|
||||
$(INBUILDX) -preprocess-html-to $(ADVICEHTML) -preprocess-app $(HTMLPLATFORM) -preprocess-html resources/Documentation/Advice/TestingTemplate.html
|
||||
endif
|
||||
{end-define}
|
||||
|
||||
.PHONY: forcetransferadvice
|
||||
|
|
Loading…
Reference in a new issue