From 56800ab736b4620aa38d29e1f05c848116a3c0f5 Mon Sep 17 00:00:00 2001 From: David Kinder Date: Sat, 30 Apr 2022 06:27:37 +0100 Subject: [PATCH] Remove indoc javascript_paste_method, always use the MacOS/Linux method on Windows --- indoc/Chapter 1/Instructions.w | 12 --------- indoc/Chapter 2/HTML and Javascript.w | 13 ++-------- indoc/Chapter 2/Renderer.w | 26 ++++--------------- indoc/Manual/Volumes and Instructions.w | 5 ---- indoc/Materials/basic-instructions.txt | 1 - indoc/Tests/Basic/indoc-instructions.txt | 6 +---- .../Documentation/indoc-instructions.txt | 17 +++++------- 7 files changed, 14 insertions(+), 66 deletions(-) diff --git a/indoc/Chapter 1/Instructions.w b/indoc/Chapter 1/Instructions.w index 5b47db340..081128b1f 100644 --- a/indoc/Chapter 1/Instructions.w +++ b/indoc/Chapter 1/Instructions.w @@ -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. @ = 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) diff --git a/indoc/Chapter 2/HTML and Javascript.w b/indoc/Chapter 2/HTML and Javascript.w index fa5514254..c7bda8e81 100644 --- a/indoc/Chapter 2/HTML and Javascript.w +++ b/indoc/Chapter 2/HTML and Javascript.w @@ -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); diff --git a/indoc/Chapter 2/Renderer.w b/indoc/Chapter 2/Renderer.w index 348993d60..5359c9135 100644 --- a/indoc/Chapter 2/Renderer.w +++ b/indoc/Chapter 2/Renderer.w @@ -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, "javascript_paste_method == PASTEMODE_David) { - Javascript_paste_count++; - WRITE_TO(raw, "%d", Javascript_paste_count); - } - WRITE_TO(raw, "("); + WRITE_TO(raw, "; 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, " "); if ((indoc_settings->support_creation) && (Str::len(titling) > 0)) { WRITE_TO(raw, "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, "   "); } 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 || 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); } diff --git a/indoc/Manual/Volumes and Instructions.w b/indoc/Manual/Volumes and Instructions.w index 371d8fc8e..872dcee3e 100644 --- a/indoc/Manual/Volumes and Instructions.w +++ b/indoc/Manual/Volumes and Instructions.w @@ -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. diff --git a/indoc/Materials/basic-instructions.txt b/indoc/Materials/basic-instructions.txt index 2c56635b1..6338fa1da 100644 --- a/indoc/Materials/basic-instructions.txt +++ b/indoc/Materials/basic-instructions.txt @@ -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 diff --git a/indoc/Tests/Basic/indoc-instructions.txt b/indoc/Tests/Basic/indoc-instructions.txt index 96fe24229..d50c410e5 100644 --- a/indoc/Tests/Basic/indoc-instructions.txt +++ b/indoc/Tests/Basic/indoc-instructions.txt @@ -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/ } diff --git a/resources/Documentation/indoc-instructions.txt b/resources/Documentation/indoc-instructions.txt index 195e26530..f765bfcc2 100644 --- a/resources/Documentation/indoc-instructions.txt +++ b/resources/Documentation/indoc-instructions.txt @@ -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 {