Skip to content

Commit

Permalink
Fix for Mantis bug 1983
Browse files Browse the repository at this point in the history
  • Loading branch information
ganelson committed Apr 10, 2022
1 parent 0b247c8 commit 70ff5f4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
10 changes: 9 additions & 1 deletion inform7/if-module/Chapter 3/Scenes.w
Expand Up @@ -653,5 +653,13 @@ scene *Scenes::rcd_scene(id_runtime_context_data *idrcd) {
return NULL;
}

@ And this is used to make metadata for indexing.


=
wording Scenes::during_wording(id_runtime_context_data *idrcd) {
if (idrcd) {
scenes_rcd_data *srcd = RCD_PLUGIN_DATA(scenes, idrcd);
if (srcd) return Node::get_text(srcd->during_scene);
}
return EMPTY_WORDING;
}
2 changes: 2 additions & 0 deletions inform7/runtime-module/Chapter 2/Hierarchy.w
Expand Up @@ -1556,6 +1556,7 @@ void Hierarchy::establish(void) {
@e RULE_INDEX_NUMBER_MD_HL
@e BRULE_AT_MD_HL
@e RULE_DURING_MD_HL
@e RULE_DURING_TEXT_MD_HL
@e RULE_ACTION_RELEVANCES_HAP
@e RULE_ACTION_RELEVANCE_MD_HL
@e RULEBOOK_PLACEMENTS_HAP
Expand Down Expand Up @@ -1605,6 +1606,7 @@ void Hierarchy::establish(void) {
H_C_U(RULE_INDEX_NUMBER_MD_HL, I"^index_number")
H_C_U(BRULE_AT_MD_HL, I"^at")
H_C_U(RULE_DURING_MD_HL, I"^during")
H_C_U(RULE_DURING_TEXT_MD_HL, I"^during_text")
H_BEGIN_AP(RULE_ACTION_RELEVANCES_HAP, I"relevant_action", I"_relevant_action")
H_C_U(RULE_ACTION_RELEVANCE_MD_HL, I"^action")
H_END
Expand Down
3 changes: 3 additions & 0 deletions inform7/runtime-module/Chapter 5/Rulebooks.w
Expand Up @@ -186,6 +186,9 @@ void RTRulebooks::compilation_agent(compilation_subtask *t) {
scene *during_scene = Scenes::rcd_scene(phrcd);
if (during_scene) Hierarchy::apply_metadata_from_iname(EP, RULE_DURING_MD_HL,
RTInstances::value_iname(during_scene->as_instance));
wording W = Scenes::during_wording(phrcd);
if (Wordings::nonempty(W))
Hierarchy::apply_metadata_from_raw_wording(EP, RULE_DURING_TEXT_MD_HL, W);
action_name *an;
LOOP_OVER(an, action_name) {
if (ActionRules::within_action_context(phrcd, an)) {
Expand Down
18 changes: 14 additions & 4 deletions inter/index-module/Chapter 2/Index Rules.w
Expand Up @@ -290,6 +290,7 @@ int IndexRules::index_rule(OUTPUT_STREAM, inter_tree *I, inter_package *R,
text_stream *italicised_text = Metadata::optional_textual(R, I"^index_name");
text_stream *first_line = Metadata::optional_textual(R, I"^first_line");
if (Str::len(italicised_text) > 0) @<Index the italicised text to do with the rule@>;
@<Index the during condition@>;
if (Str::len(name) > 0) @<Index the rule name along with Javascript buttons@>;
if ((Str::len(italicised_text) == 0) &&
(Str::len(name) == 0) && (Str::len(first_line) > 0))
Expand All @@ -301,14 +302,23 @@ int IndexRules::index_rule(OUTPUT_STREAM, inter_tree *I, inter_package *R,
return no_responses_indexed;
}

@<Index the italicised text to do with the rule@> =
WRITE("<i>%S", italicised_text);
@<Index the during condition@> =
if (rc.scene_context) {
WRITE(" ");
WRITE("<i>");
Localisation::roman_t(OUT, LD, I"Index.Elements.RS.During",
FauxScenes::scene_name(rc.scene_context));
WRITE("</i>&nbsp;&nbsp;");
} else {
text_stream *during_text = Metadata::optional_textual(R, I"^during_text");
if (Str::len(during_text) > 0) {
WRITE("<i>");
Localisation::roman_t(OUT, LD, I"Index.Elements.RS.During", during_text);
WRITE("</i>&nbsp;&nbsp;");
}
}
WRITE("</i>&nbsp;&nbsp;");

@<Index the italicised text to do with the rule@> =
WRITE("<i>%S</i>&nbsp;&nbsp;", italicised_text);

@

Expand Down

0 comments on commit 70ff5f4

Please sign in to comment.