1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-08 18:14:21 +03:00
inform7/inter/index-module/Chapter 3/Extras Element.w

55 lines
2.1 KiB
OpenEdge ABL
Raw Normal View History

2021-06-09 01:26:10 +03:00
[ExtrasElement::] Extras Element.
To write the Extras element (Xt) in the index.
2021-07-25 17:11:01 +03:00
@ This is to sweep up rulebooks and activities not covered by other elements,
really, and most of the code here is just to arrange them in some logical order.
2021-06-09 01:26:10 +03:00
=
2021-07-26 15:48:49 +03:00
void ExtrasElement::render(OUTPUT_STREAM, index_session *session) {
localisation_dictionary *LD = Indexing::get_localisation(session);
inter_tree *I = Indexing::get_tree(session);
tree_inventory *inv = Indexing::get_inventory(session);
2021-06-09 01:26:10 +03:00
TreeLists::sort(inv->rulebook_nodes, Synoptic::module_order);
TreeLists::sort(inv->activity_nodes, Synoptic::module_order);
2021-07-25 00:04:35 +03:00
inter_package *E;
LOOP_OVER_INVENTORY_PACKAGES(E, i, inv->module_nodes)
2021-06-09 01:26:10 +03:00
if (Metadata::read_optional_numeric(E, I"^category") == 1)
@<Index rulebooks occurring in this part of the source text@>;
2021-07-25 00:04:35 +03:00
LOOP_OVER_INVENTORY_PACKAGES(E, i, inv->module_nodes)
2021-06-09 01:26:10 +03:00
if (Metadata::read_optional_numeric(E, I"^category") == 2)
@<Index rulebooks occurring in this part of the source text@>;
}
@<Index rulebooks occurring in this part of the source text@> =
int c = 0;
2021-07-25 00:04:35 +03:00
inter_package *rb_pack;
LOOP_OVER_INVENTORY_PACKAGES(rb_pack, i, inv->rulebook_nodes)
if (Synoptic::module_containing(rb_pack->package_head) == E) {
if (Metadata::read_optional_numeric(rb_pack, I"^automatically_generated"))
2021-06-09 01:26:10 +03:00
continue;
if (c++ == 0) @<Heading for these@>;
IndexRules::rulebook_box(OUT, inv,
2021-07-25 00:04:35 +03:00
Metadata::read_optional_textual(rb_pack, I"^printed_name"),
NULL, rb_pack, NULL, 1, TRUE, LD);
2021-06-09 01:26:10 +03:00
}
2021-07-25 00:04:35 +03:00
inter_package *av_pack;
LOOP_OVER_INVENTORY_PACKAGES(av_pack, i, inv->activity_nodes)
if (Synoptic::module_containing(av_pack->package_head) == E) {
2021-06-09 01:26:10 +03:00
if (c++ == 0) @<Heading for these@>;
2021-07-25 00:04:35 +03:00
IndexRules::activity_box(OUT, I, av_pack, 1, LD);
2021-06-09 01:26:10 +03:00
}
@<Heading for these@> =
HTML_OPEN("p");
2021-07-25 17:11:01 +03:00
WRITE("<b>");
2021-06-09 01:26:10 +03:00
if (Metadata::read_optional_numeric(E, I"^category") == 1) {
2021-07-26 02:34:51 +03:00
Localisation::roman(OUT, LD, I"Index.Elements.Xt.FromSourceText");
2021-06-09 01:26:10 +03:00
} else {
2021-07-26 02:34:51 +03:00
Localisation::roman_t(OUT, LD, I"Index.Elements.Xt.FromExtension",
2021-06-09 01:26:10 +03:00
Metadata::read_optional_textual(E, I"^credit"));
}
2021-07-25 17:11:01 +03:00
WRITE("</b>");
2021-06-09 01:26:10 +03:00
HTML_CLOSE("p");