1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-06-30 22:14:58 +03:00

Remove indoc javascript_paste_method, always use the MacOS/Linux method on Windows

This commit is contained in:
David Kinder 2022-04-30 06:27:37 +01:00
parent 0185571ae6
commit 56800ab736
7 changed files with 14 additions and 66 deletions

View file

@ -67,7 +67,6 @@ typedef struct settings_block {
int format; /* one of the |*_FORMAT| values above */
int XHTML; /* a flag: relevant only if |HTML_FORMAT| is chosen */
int javascript; /* a flag */
int javascript_paste_method; /* one of the |PASTEMDDE_*| values above */
int html_for_Inform_application;
int images_copy;
@ -130,7 +129,6 @@ settings_block *Instructions::clean_slate(void) {
settings->format = HTML_FORMAT;
settings->XHTML = FALSE;
settings->javascript = FALSE;
settings->javascript_paste_method = PASTEMODE_none;
settings->html_for_Inform_application = FALSE;
settings->images_copy = FALSE;
@ -442,12 +440,6 @@ taste). In a multiple-line value, each line is terminated with a newline.
else if (Str::eq_wide_string(key, L"inform_definitions_mode")) {
settings->inform_definitions_mode = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, L"javascript")) { settings->javascript = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, L"javascript_paste_method")) {
if (Str::eq_wide_string(val, L"none")) { settings->javascript_paste_method = PASTEMODE_none; }
else if (Str::eq_wide_string(val, L"Andrew")) { settings->javascript_paste_method = PASTEMODE_Andrew; }
else if (Str::eq_wide_string(val, L"David")) { settings->javascript_paste_method = PASTEMODE_David; }
else Errors::in_text_file("no such Javascript paste mode", tfp);
}
else if (Str::eq_wide_string(key, L"link_to_extensions_index")) {
settings->link_to_extensions_index = Str::duplicate(val); }
else if (Str::eq_wide_string(key, L"manifest_leafname")) { settings->manifest_leafname = Str::duplicate(val); }
@ -481,7 +473,6 @@ taste). In a multiple-line value, each line is terminated with a newline.
@<Reconcile any conflicting instructions@> =
if (settings->wrapper == WRAPPER_epub) {
settings->javascript = FALSE;
settings->javascript_paste_method = PASTEMODE_none;
if (settings->examples_mode == EXMODE_openable_internal) {
settings->examples_mode = EXMODE_open_internal;
}
@ -493,9 +484,6 @@ taste). In a multiple-line value, each line is terminated with a newline.
settings->ebook = Epub::new(I"untitled ebook", "");
}
if (settings->javascript_paste_method != PASTEMODE_none)
settings->javascript = TRUE;
if (settings->examples_granularity == SAME_AS_MAIN_GRANULARITY)
settings->examples_granularity = settings->granularity;
if (settings->toc_granularity == SAME_AS_MAIN_GRANULARITY)

View file

@ -353,11 +353,7 @@ void HTMLUtilities::paste_script(OUTPUT_STREAM, text_stream *content, int code_n
else WRITE("%d(code", code_num);
WRITE(") {\n");
if (indoc_settings->javascript_paste_method == PASTEMODE_Andrew)
WRITE(" var myProject = window.Project;\n");
if (indoc_settings->javascript_paste_method == PASTEMODE_David)
WRITE(" var myProject = external.Project;\n");
WRITE("\n");
WRITE(" var myProject = window.Project;\n");
WRITE(" myProject.selectView('source');\n");
WRITE(" myProject.pasteCode(");
if (Str::len(content) == 0) { WRITE("code"); }
@ -373,12 +369,7 @@ void HTMLUtilities::create_script(OUTPUT_STREAM, text_stream *content, int code_
else WRITE("%d(code", code_num);
WRITE(", title) {\n");
if (indoc_settings->javascript_paste_method == PASTEMODE_Andrew)
WRITE(" var myProject = window.Project;\n");
if (indoc_settings->javascript_paste_method == PASTEMODE_David)
WRITE(" var myProject = external.Project;\n");
WRITE("\n");
WRITE(" var myProject = window.Project;\n");
WRITE(" myProject.createNewProject(");
if (Str::len(content) == 0) WRITE("title");
else WRITE("'%S'", titling);

View file

@ -43,7 +43,6 @@ typedef struct formatted_file {
@ Miscellaneously:
=
int Javascript_paste_count = 0; /* used to make unique ID numbers for paste icons */
int index_to_examples = FALSE; /* used to index examples to particular sections */
int unique_code_pos_counter = 0; /* used to uniquely ID code samples */
example *code_example = NULL;
@ -405,15 +404,10 @@ see below.
Str::copy(raw, mr.exp[0]);
TEMPORARY_TEXT(right)
Str::copy(right, mr.exp[1]);
if (indoc_settings->javascript_paste_method == PASTEMODE_none) {
if (indoc_settings->javascript == FALSE) {
WRITE_TO(raw, "%S", right);
} else {
WRITE_TO(raw, "<a href=\"javascript:pasteCode");
if (indoc_settings->javascript_paste_method == PASTEMODE_David) {
Javascript_paste_count++;
WRITE_TO(raw, "%d", Javascript_paste_count);
}
WRITE_TO(raw, "(");
WRITE_TO(raw, "<a href=\"javascript:pasteCode(");
TEMPORARY_TEXT(J_text)
@<Determine the quoted J-text@>;
TEMPORARY_TEXT(titling)
@ -426,19 +420,15 @@ see below.
}
}
Renderer::apply_Inform_escape_characters(titling);
if (indoc_settings->javascript_paste_method == PASTEMODE_Andrew)
WRITE_TO(raw, "'%S\\n'", J_text);
WRITE_TO(raw, "'%S\\n'", J_text);
WRITE_TO(raw, ")\">");
if (indoc_settings->retina_images) HTMLUtilities::image_element_scaled(raw, I"paste@2x.png", 13, 13);
else HTMLUtilities::image_element(raw, I"paste.png");
WRITE_TO(raw, "</a> ");
if ((indoc_settings->support_creation) && (Str::len(titling) > 0)) {
WRITE_TO(raw, "<a href=\"javascript:createNewProject");
if (indoc_settings->javascript_paste_method == PASTEMODE_David)
WRITE_TO(raw, "%d", Javascript_paste_count);
WRITE_TO(raw, "(");
if (indoc_settings->javascript_paste_method == PASTEMODE_Andrew)
WRITE_TO(raw, "'%S\\n', '%S'", J_text, titling);
WRITE_TO(raw, "'%S\\n', '%S'", J_text, titling);
WRITE_TO(raw, ")\">");
if (indoc_settings->retina_images) {
HTMLUtilities::image_element_scaled(raw, I"create@2x.png", 26, 13);
@ -449,11 +439,6 @@ see below.
WRITE_TO(raw, "&nbsp;&nbsp; ");
}
WRITE_TO(raw, "%S", right);
if ((indoc_settings->javascript) &&
(indoc_settings->javascript_paste_method == PASTEMODE_David)) {
HTMLUtilities::paste_script(OUT, J_text, Javascript_paste_count);
HTMLUtilities::create_script(OUT, J_text, Javascript_paste_count, titling);
}
}
@ The rawtext is doing something like this:
@ -717,8 +702,7 @@ with a |<head>| we make ourselves.
HTML::end_head(OUT);
HTML::begin_body(OUT, I"paper papertint");
}
if ((indoc_settings->javascript) &&
(indoc_settings->javascript_paste_method == PASTEMODE_Andrew)) {
if (indoc_settings->javascript) {
HTMLUtilities::paste_script(OUT, NULL, 0);
HTMLUtilities::create_script(OUT, NULL, 0, NULL);
}

View file

@ -263,11 +263,6 @@ syntax for Inform phrases.
whetber Indoc is allowed to compile Javascript, or has to stick to inactive
HTML.
|javascript_paste_method| can be |none|, |Andrew| or |David|. The default
is |none|. The difference relates to how "paste Inform source" links are
implemented inside the Inform application: |Andrew| mode is suitable for
most platforms, but |David| is needed for Windows.
|link_to_extensions_index| is meaningful only if |html_for_Inform_application|
is set, and specifies the URL of the Extensions index inside the app.

View file

@ -10,7 +10,6 @@ definitions_filename = definitions.html
format = HTML
html_for_Inform_application = no
javascript = yes
javascript_paste_method = none
wrapper = none
navigation = roadsign
toc_granularity = 3

View file

@ -233,7 +233,6 @@ osx_app {
support_creation = yes
retina_images = yes
declare: OSX
javascript_paste_method = Andrew
}
windows_app {
@ -244,7 +243,6 @@ windows_app {
retina_images = yes
suppress_fonts = yes
declare: Windows
javascript_paste_method = Andrew
destination = ../../Build/Documentation/
}
@ -253,8 +251,7 @@ linux_app {
# This is for command-line Linux, so there's no in-application tweaking
declare: Linux
assume_Public_Library = yes
javascript_paste_method = Andrew
destination = i7/Documentation/
destination = i7/Documentation/
images_copy = no
}
@ -263,7 +260,6 @@ gnome_app {
follow: in-application-instructions.txt
assume_Public_Library = yes
declare: GNOME
javascript_paste_method = David
destination = ../inform7-ide/src/inform/
}

View file

@ -490,7 +490,6 @@ osx_app {
support_creation = yes
retina_images = yes
declare: OSX
javascript_paste_method = Andrew
destination = ../Inform.app/Contents/Resources/English.lproj/
}
@ -502,7 +501,6 @@ windows_app {
retina_images = yes
suppress_fonts = yes
declare: Windows
javascript_paste_method = Andrew
destination = ../../Build/Documentation/
}
@ -511,8 +509,7 @@ linux_app {
# This is for command-line Linux, so there's no in-application tweaking
declare: Linux
assume_Public_Library = yes
javascript_paste_method = Andrew
destination = i7/Documentation/
destination = i7/Documentation/
images_copy = no
}
@ -521,17 +518,15 @@ gnome_app {
follow: in-application-instructions.txt
assume_Public_Library = yes
declare: GNOME
javascript_paste_method = David
destination = ../inform7-ide/src/inform/
}
gnome_flatpak_app {
# HTML documentation installed to a different location for Flatpak builds
follow: in-application-instructions.txt
assume_Public_Library = yes
declare: GNOME
javascript_paste_method = David
destination = /app/tmp/inform
# HTML documentation installed to a different location for Flatpak builds
follow: in-application-instructions.txt
assume_Public_Library = yes
declare: GNOME
destination = /app/tmp/inform
}
website {