1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-09 02:24:21 +03:00
inform7/inter/index-module/Chapter 3/Values Element.w

82 lines
2.6 KiB
OpenEdge ABL
Raw Normal View History

2021-06-06 14:01:16 +03:00
[ValuesElement::] Values Element.
To write the Values element (Vl) in the index.
2021-07-26 01:56:17 +03:00
@ Variables and equations both appear here, though really they're conceptually
quite different.
2021-06-06 14:01:16 +03:00
=
2021-07-26 15:48:49 +03:00
void ValuesElement::render(OUTPUT_STREAM, index_session *session) {
localisation_dictionary *LD = Indexing::get_localisation(session);
tree_inventory *inv = Indexing::get_inventory(session);
2021-06-06 14:01:16 +03:00
TreeLists::sort(inv->variable_nodes, Synoptic::module_order);
@<Index the variables@>;
TreeLists::sort(inv->equation_nodes, Synoptic::module_order);
@<Index the equations@>;
}
@<Index the variables@> =
2021-06-07 00:18:08 +03:00
inter_symbol *definition_area = NULL, *current_area = NULL;
2021-06-06 14:01:16 +03:00
HTML_OPEN("p");
2021-07-09 00:56:01 +03:00
IndexUtilities::anchor(OUT, I"NAMES");
2021-06-06 14:01:16 +03:00
int understood_note_given = FALSE;
2021-07-25 00:04:35 +03:00
inter_package *pack;
LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->variable_nodes)
2021-06-06 14:01:16 +03:00
if (Metadata::read_optional_numeric(pack, I"^indexable")) {
if (Metadata::read_optional_numeric(pack, I"^understood"))
@<Index a K understood variable@>
else
@<Index a regular variable@>;
}
HTML_CLOSE("p");
@<Index a K understood variable@> =
if (understood_note_given == FALSE) {
understood_note_given = TRUE;
2021-07-26 02:34:51 +03:00
Localisation::roman(OUT, LD, I"Index.Elements.Vl.UnderstoodVariables");
2021-06-06 14:01:16 +03:00
HTML_TAG("br");
}
@<Index a regular variable@> =
2021-06-07 00:18:08 +03:00
definition_area = Metadata::read_optional_symbol(pack, I"^heading");
if (definition_area == NULL) continue;
2021-06-06 14:01:16 +03:00
if (definition_area != current_area) {
2021-07-25 00:04:35 +03:00
inter_package *heading_pack =
Inter::Packages::container(definition_area->definition);
2021-06-06 14:01:16 +03:00
HTML_CLOSE("p");
HTML_OPEN("p");
2021-07-09 00:56:01 +03:00
IndexUtilities::show_definition_area(OUT, heading_pack, FALSE);
2021-06-06 14:01:16 +03:00
}
current_area = definition_area;
2021-06-07 00:18:08 +03:00
2021-06-06 14:01:16 +03:00
text_stream *name = Metadata::read_optional_textual(pack, I"^name");
WRITE("%S", name);
2021-07-24 20:16:56 +03:00
IndexUtilities::link_package(OUT, pack);
IndexUtilities::link_to_documentation(OUT, pack);
2021-06-06 14:01:16 +03:00
text_stream *contents = Metadata::read_optional_textual(pack, I"^contents");
WRITE(" - <i>%S</i>", contents);
HTML_TAG("br");
@<Index the equations@> =
2021-07-26 01:56:17 +03:00
HTML_OPEN("p");
2021-07-26 02:34:51 +03:00
Localisation::bold(OUT, LD, I"Index.Elements.Vl.EquationsHeading");
2021-07-26 01:56:17 +03:00
WRITE(" (");
2021-07-26 02:34:51 +03:00
Localisation::italic(OUT, LD, I"Index.Elements.Vl.AboutEquations");
2021-07-26 01:56:17 +03:00
WRITE(")");
HTML_CLOSE("p");
HTML_OPEN("p");
int N = 0;
inter_package *pack;
LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->equation_nodes) {
int at = (int) Metadata::read_optional_numeric(pack, I"^at");
if (at > 0) {
WRITE("%S", Metadata::read_optional_textual(pack, I"^name"));
IndexUtilities::link(OUT, at);
WRITE(" (%S)", Metadata::read_optional_textual(pack, I"^text"));
HTML_TAG("br");
N++;
2021-06-06 14:01:16 +03:00
}
}
2021-07-26 02:34:51 +03:00
if (N == 0) Localisation::italic(OUT, LD, I"Index.Elements.Vl.NoEquations");
2021-07-26 01:56:17 +03:00
HTML_CLOSE("p");