1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-06-29 05:24:57 +03:00
inform7/inter/index-module/Chapter 3/Verbs Element.w
2021-07-24 18:16:56 +01:00

45 lines
2 KiB
OpenEdge ABL

[VerbsElement::] Verbs Element.
To write the Verbs element (Vb) in the index.
@
=
void VerbsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {
HTML_OPEN("p"); WRITE("Verbs listed as \"for saying only\" are values of the kind \"verb\" "
"and can be used in adaptive text, but they have no meaning to Inform, so "
"they can't be used in sentences about what's in the story.");
HTML_CLOSE("p");
int verb_count = 0;
inter_lexicon *lexicon = InterpretIndex::get_lexicon();
for (index_lexicon_entry *lex = lexicon->first; lex; lex = lex->sorted_next)
if ((lex->part_of_speech == VERB_TLEXE) ||
(lex->part_of_speech == MVERB_TLEXE) ||
(lex->part_of_speech == PREP_TLEXE)) {
text_stream *entry_text = lex->lemma;
HTML_OPEN_WITH("p", "class=\"hang\"");
IndexUtilities::anchor_numbered(OUT, 10000+verb_count++); /* anchors from 10000: see above */
if (lex->part_of_speech == VERB_TLEXE) WRITE("To <b>%S</b>", entry_text);
else if (lex->part_of_speech == MVERB_TLEXE) WRITE("To <b>%S</b>", entry_text);
else if (lex->part_of_speech == PREP_TLEXE) WRITE("To be <b>%S</b>", entry_text);
else WRITE("To be able to <b>%S</b>", entry_text);
IndexUtilities::link_package(OUT, lex->lex_package);
if (lex->part_of_speech == MVERB_TLEXE) WRITE(" ... for saying only");
else WRITE(" ... <i>%S</i>", Metadata::read_optional_textual(lex->lex_package, I"^meaning"));
HTML_CLOSE("p");
VerbsElement::tabulate_verbs(OUT, lex, I"^present", "present");
VerbsElement::tabulate_verbs(OUT, lex, I"^past", "past");
VerbsElement::tabulate_verbs(OUT, lex, I"^present_perfect", "present perfect");
VerbsElement::tabulate_verbs(OUT, lex, I"^past_perfect", "past perfect");
}
}
void VerbsElement::tabulate_verbs(OUTPUT_STREAM, index_lexicon_entry *lex, text_stream *key, char *tensename) {
text_stream *val = Metadata::read_optional_textual(lex->lex_package, key);
if (Str::len(key) > 0) {
HTML::open_indented_p(OUT, 2, "tight");
WRITE("<i>%s:</i>&nbsp;%S", tensename, val);
HTML_CLOSE("p");
}
}