1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-05 16:44:21 +03:00
inform7/inter/index-module/Chapter 3/Events Element.w

65 lines
2.1 KiB
OpenEdge ABL
Raw Normal View History

2021-06-05 12:47:52 +03:00
[EventsElement::] Events Element.
To write the Events element (Ev) in the index.
@ There are two tables, one for timed events, the other for those of no fixed time.
=
2021-07-26 15:48:49 +03:00
void EventsElement::render(OUTPUT_STREAM, index_session *session) {
localisation_dictionary *LD = Indexing::get_localisation(session);
tree_inventory *inv = Indexing::get_inventory(session);
2022-02-03 01:35:38 +02:00
InterNodeList::array_sort(inv->rule_nodes, MakeSynopticModuleStage::module_order);
2021-06-05 12:47:52 +03:00
int when_count = 0, tt_count = 0;
@<Index events with no specific time@>;
@<Index timetabled events@>;
if ((when_count == 0) && (tt_count == 0)) {
2021-07-25 17:11:01 +03:00
HTML_OPEN("p");
2021-07-26 02:34:51 +03:00
Localisation::italic(OUT, LD, I"Index.Elements.Ev.None");
2021-07-25 17:11:01 +03:00
HTML_CLOSE("p");
2021-06-05 12:47:52 +03:00
}
}
@<Index events with no specific time@> =
2021-07-25 00:04:35 +03:00
inter_package *pack;
LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->rule_nodes)
if ((Metadata::exists(pack, I"^timed")) &&
(Metadata::exists(pack, I"^timed_for") == FALSE)) {
if (when_count == 0) {
HTML_OPEN("p");
2021-07-26 02:34:51 +03:00
Localisation::italic(OUT, LD, I"Index.Elements.Ev.Timeless");
2021-06-05 12:47:52 +03:00
HTML_CLOSE("p");
}
2021-07-25 00:04:35 +03:00
when_count++;
HTML_OPEN_WITH("p", "class=\"tightin2\"");
WRITE("%S", Metadata::read_textual(pack, I"^preamble"));
IndexUtilities::link_package(OUT, pack);
2021-07-25 17:11:01 +03:00
WRITE(" (");
2021-07-26 02:34:51 +03:00
Localisation::roman(OUT, LD, I"Index.Elements.Ev.WhereTriggered");
2021-07-25 17:11:01 +03:00
WRITE(": ");
2021-07-25 00:04:35 +03:00
inter_package *entry;
LOOP_THROUGH_SUBPACKAGES(entry, pack, I"_timed_rule_trigger") {
int at = (int) Metadata::read_optional_numeric(entry, I"^used_at");
if (at > 0) IndexUtilities::link(OUT, at);
}
WRITE(")");
HTML_CLOSE("p");
2021-06-05 12:47:52 +03:00
}
@<Index timetabled events@> =
2021-07-25 00:04:35 +03:00
inter_package *pack;
LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->rule_nodes)
if ((Metadata::exists(pack, I"^timed")) &&
(Metadata::exists(pack, I"^timed_for"))) {
if (tt_count == 0) {
HTML_OPEN("p");
2021-07-26 02:34:51 +03:00
Localisation::italic(OUT, LD, I"Index.Elements.Ev.Timetable");
2021-06-05 12:47:52 +03:00
HTML_CLOSE("p");
}
2021-07-25 00:04:35 +03:00
tt_count++;
HTML_OPEN_WITH("p", "class=\"in2\"");
WRITE("%S", Metadata::read_textual(pack, I"^preamble"));
IndexUtilities::link_package(OUT, pack);
HTML_CLOSE("p");
2021-06-05 12:47:52 +03:00
}