Added navigation to docs pages

This commit is contained in:
Graham Nelson 2019-02-27 22:34:18 +00:00
parent 5deddbb742
commit 75d26a1003
9 changed files with 215 additions and 113 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@ Tests/intest-history.txt
Tests/Transient/
Tests/hashes.intest
Tests/_Results_Actual/
foundation-test/Tests/Test Cases/_Results_Actual/
platform-settings.mk
foundation-module/Woven/
Examples/*.o

View file

@ -23,6 +23,7 @@ int Weaver::weave_source(web *W, weave_target *wv) {
if ((Str::len(wv->cover_sheet_to_use) > 0) && (W->no_sections > 1))
@<Weave head of the cover sheet, if any@>;
int lines_woven = 0;
section *latest_section = NULL;
@<Weave the body of the material@>;
if ((Str::len(wv->cover_sheet_to_use) > 0) && (W->no_sections > 1))
@<Weave tail of the cover sheet, if any@>;
@ -53,6 +54,7 @@ int Weaver::weave_source(web *W, weave_target *wv) {
Str::clear(state->chaptermark);
LOOP_OVER_LINKED_LIST(S, section, C->sections)
if (Reader::range_within(S->range, wv->weave_range)) {
latest_section = S;
Languages::begin_weave(S, wv);
Str::clear(state->sectionmark);
@<Weave this section@>;
@ -67,7 +69,7 @@ int Weaver::weave_source(web *W, weave_target *wv) {
@<Weave the rennab@> =
TEMPORARY_TEXT(rennab);
WRITE_TO(rennab, "End of weave: %d lines from a web of %d", lines_woven, W->no_lines);
Formats::tail(OUT, wv, rennab);
Formats::tail(OUT, wv, rennab, latest_section);
DISCARD_TEXT(rennab);
@h The state.

View file

@ -564,14 +564,61 @@ void HTMLFormat::xref(OUTPUT_STREAM, weave_target *wv, paragraph *P, section *fr
@ =
void HTMLFormat::tail(weave_format *self, text_stream *OUT, weave_target *wv,
text_stream *comment) {
text_stream *comment, section *this_S) {
HTMLFormat::exit_current_paragraph(OUT);
if (wv->docs_mode) {
chapter *C = this_S->owning_chapter;
section *S, *last_S = NULL, *prev_S = NULL, *next_S = NULL;
LOOP_OVER_LINKED_LIST(S, section, C->sections) {
if (S == this_S) prev_S = last_S;
if (last_S == this_S) next_S = S;
last_S = S;
}
HTML::hr(OUT, "tocbar");
HTML_OPEN_WITH("ul", "class=\"toc\"");
HTML_OPEN("li");
if (prev_S == NULL) WRITE("<i>(This section begins %S.)</i>", C->ch_title);
else {
TEMPORARY_TEXT(TEMP);
HTMLFormat::sref(TEMP, wv, prev_S);
HTML::begin_link(OUT, TEMP);
WRITE("Back to '%S'", prev_S->sect_title);
HTML::end_link(OUT);
DISCARD_TEXT(TEMP);
}
HTML_CLOSE("li");
HTML_OPEN("li");
if (next_S == NULL) WRITE("<i>(This section ends %S.)</i>", C->ch_title);
else {
TEMPORARY_TEXT(TEMP);
HTMLFormat::sref(TEMP, wv, next_S);
HTML::begin_link(OUT, TEMP);
WRITE("Continue with '%S'", next_S->sect_title);
HTML::end_link(OUT);
DISCARD_TEXT(TEMP);
}
HTML_CLOSE("li");
HTML_CLOSE("ul");
HTML::hr(OUT, "tocbar");
}
HTML::comment(OUT, comment);
HTML::completed(OUT);
Bibliographic::set_datum(wv->weave_web, I"Booklet Title", wv->booklet_title);
Indexer::cover_sheet_maker(OUT, wv->weave_web, I"template", wv, WEAVE_SECOND_HALF);
}
@ =
void HTMLFormat::sref(OUTPUT_STREAM, weave_target *wv, section *S) {
if (S == NULL) internal_error("unwoven section");
LOOP_THROUGH_TEXT(pos, S->range)
if (Str::get(pos) == '/')
PUT('-');
else
PUT(Str::get(pos));
WRITE(".html");
}
@h EPUB-only methods.
=

View file

@ -145,6 +145,6 @@ void PlainText::locale(weave_format *self, text_stream *OUT, weave_target *wv,
@ =
void PlainText::tail(weave_format *self, text_stream *OUT, weave_target *wv,
text_stream *comment) {
text_stream *comment, section *S) {
WRITE("[%S]\n", comment);
}

View file

@ -405,7 +405,7 @@ void TeX::change_material(weave_format *self, text_stream *OUT, weave_target *wv
@ =
void TeX::tail(weave_format *self, text_stream *OUT, weave_target *wv,
text_stream *comment) {
text_stream *comment, section *S) {
WRITE("%% %S\n", comment);
WRITE("\\end\n");
}

View file

@ -474,10 +474,10 @@ intended for human eyes, and will be some sort of "End of weave" remark.
=
VMETHOD_TYPE(TAIL_FOR_MTID, weave_format *wf, text_stream *OUT, weave_target *wv,
text_stream *comment)
void Formats::tail(OUTPUT_STREAM, weave_target *wv, text_stream *comment) {
text_stream *comment, section *S)
void Formats::tail(OUTPUT_STREAM, weave_target *wv, text_stream *comment, section *S) {
weave_format *wf = wv->format;
VMETHOD_CALL(wf, TAIL_FOR_MTID, OUT, wv, comment);
VMETHOD_CALL(wf, TAIL_FOR_MTID, OUT, wv, comment, S);
}
@h Post-processing.

View file

@ -1487,7 +1487,7 @@ typedef struct contents_processor {
int stack_pointer; /* And this is our stack pointer for tracking of loops */
text_stream *restrict_to_range;
} contents_processor;
#line 82 "inweb/Chapter 3/The Weaver.w"
#line 84 "inweb/Chapter 3/The Weaver.w"
typedef struct weaver_state {
int kind_of_material; /* one of the enumerated |*_MATERIAL| constants above */
int line_break_pending; /* insert a line break before the next woven line? */
@ -2775,9 +2775,9 @@ void Indexer__transcribe_CSS(OUTPUT_STREAM, filename *CSS_file) ;
void Indexer__copy_CSS(text_stream *line, text_file_position *tfp, void *X) ;
#line 16 "inweb/Chapter 3/The Weaver.w"
int Weaver__weave_source(web *W, weave_target *wv) ;
#line 650 "inweb/Chapter 3/The Weaver.w"
#line 652 "inweb/Chapter 3/The Weaver.w"
void Weaver__show_endnotes_on_previous_paragraph(OUTPUT_STREAM, weave_target *wv, paragraph *P) ;
#line 785 "inweb/Chapter 3/The Weaver.w"
#line 787 "inweb/Chapter 3/The Weaver.w"
int Weaver__weave_table_of_contents(OUTPUT_STREAM, weave_target *wv, section *S) ;
#line 14 "inweb/Chapter 3/The Tangler.w"
void Tangler__go(web *W, tangle_target *target, filename *dest_file) ;
@ -3042,7 +3042,7 @@ void Formats__endnote(OUTPUT_STREAM, weave_target *wv, int end) ;
#line 465 "inweb/Chapter 5/Weave Formats.w"
void Formats__locale(OUTPUT_STREAM, weave_target *wv, paragraph *par1, paragraph *par2) ;
#line 478 "inweb/Chapter 5/Weave Formats.w"
void Formats__tail(OUTPUT_STREAM, weave_target *wv, text_stream *comment) ;
void Formats__tail(OUTPUT_STREAM, weave_target *wv, text_stream *comment, section *S) ;
#line 494 "inweb/Chapter 5/Weave Formats.w"
void Formats__post_process_weave(weave_target *wv, int open_afterwards) ;
#line 505 "inweb/Chapter 5/Weave Formats.w"
@ -3082,7 +3082,7 @@ void PlainText__commentary_text(weave_format *self, text_stream *OUT, weave_ta
#line 140 "inweb/Chapter 5/Plain Text Format.w"
void PlainText__locale(weave_format *self, text_stream *OUT, weave_target *wv, paragraph *par1, paragraph *par2) ;
#line 147 "inweb/Chapter 5/Plain Text Format.w"
void PlainText__tail(weave_format *self, text_stream *OUT, weave_target *wv, text_stream *comment) ;
void PlainText__tail(weave_format *self, text_stream *OUT, weave_target *wv, text_stream *comment, section *S) ;
#line 9 "inweb/Chapter 5/TeX Format.w"
void TeX__create(void) ;
#line 67 "inweb/Chapter 5/TeX Format.w"
@ -3132,7 +3132,7 @@ void TeX__locale(weave_format *self, text_stream *OUT, weave_target *wv, parag
#line 381 "inweb/Chapter 5/TeX Format.w"
void TeX__change_material(weave_format *self, text_stream *OUT, weave_target *wv, int old_material, int new_material, int content) ;
#line 407 "inweb/Chapter 5/TeX Format.w"
void TeX__tail(weave_format *self, text_stream *OUT, weave_target *wv, text_stream *comment) ;
void TeX__tail(weave_format *self, text_stream *OUT, weave_target *wv, text_stream *comment, section *S) ;
#line 417 "inweb/Chapter 5/TeX Format.w"
int TeX__preform_document(weave_format *self, text_stream *OUT, web *W, weave_target *wv, chapter *C, section *S, source_line *L, text_stream *matter, text_stream *concluding_comment) ;
#line 496 "inweb/Chapter 5/TeX Format.w"
@ -3202,10 +3202,12 @@ void HTMLFormat__locale(weave_format *self, text_stream *OUT, weave_target *wv,
#line 545 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__xref(OUTPUT_STREAM, weave_target *wv, paragraph *P, section *from, int a_link) ;
#line 566 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__tail(weave_format *self, text_stream *OUT, weave_target *wv, text_stream *comment) ;
#line 578 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__tail(weave_format *self, text_stream *OUT, weave_target *wv, text_stream *comment, section *this_S) ;
#line 612 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__sref(OUTPUT_STREAM, weave_target *wv, section *S) ;
#line 625 "inweb/Chapter 5/HTML Formats.w"
int HTMLFormat__begin_weaving_EPUB(weave_format *wf, web *W, weave_pattern *pattern) ;
#line 593 "inweb/Chapter 5/HTML Formats.w"
#line 640 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__end_weaving_EPUB(weave_format *wf, web *W, weave_pattern *pattern) ;
#line 22 "inweb/Chapter 5/Running Through TeX.w"
void RunningTeX__post_process_weave(weave_target *wv, int open_afterwards, int to_DVI) ;
@ -14768,7 +14770,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
{
#line 36 "inweb/Chapter 3/The Weaver.w"
#line 37 "inweb/Chapter 3/The Weaver.w"
TEMPORARY_TEXT(banner);
WRITE_TO(banner, "Weave of '%S' generated by %s", wv->booklet_title, INWEB_BUILD);
Formats__top(OUT, wv, banner);
@ -14780,7 +14782,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
if ((Str__len(wv->cover_sheet_to_use) > 0) && (W->no_sections > 1))
{
#line 42 "inweb/Chapter 3/The Weaver.w"
#line 43 "inweb/Chapter 3/The Weaver.w"
if (!(Bibliographic__data_exists(W, TL_IS_141)))
Bibliographic__set_datum(W, TL_IS_142, wv->booklet_title);
Indexer__cover_sheet_maker(OUT, W, wv->cover_sheet_to_use, wv, WEAVE_FIRST_HALF);
@ -14789,13 +14791,14 @@ int Weaver__weave_source(web *W, weave_target *wv) {
#line 24 "inweb/Chapter 3/The Weaver.w"
;
int lines_woven = 0;
section *latest_section = NULL;
{
#line 47 "inweb/Chapter 3/The Weaver.w"
#line 48 "inweb/Chapter 3/The Weaver.w"
weaver_state state_at; weaver_state *state = &state_at;
{
#line 97 "inweb/Chapter 3/The Weaver.w"
#line 99 "inweb/Chapter 3/The Weaver.w"
state->kind_of_material = REGULAR_MATERIAL;
state->line_break_pending = FALSE;
state->next_heading_without_vertical_skip = FALSE;
@ -14809,7 +14812,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
state->sectionmark = Str__new();
}
#line 48 "inweb/Chapter 3/The Weaver.w"
#line 49 "inweb/Chapter 3/The Weaver.w"
;
chapter *C;
section *S;
@ -14818,11 +14821,12 @@ int Weaver__weave_source(web *W, weave_target *wv) {
Str__clear(state->chaptermark);
LOOP_OVER_LINKED_LIST(S, section, C->sections)
if (Reader__range_within(S->range, wv->weave_range)) {
latest_section = S;
Languages__begin_weave(S, wv);
Str__clear(state->sectionmark);
{
#line 112 "inweb/Chapter 3/The Weaver.w"
#line 114 "inweb/Chapter 3/The Weaver.w"
paragraph *current_paragraph = NULL;
for (source_line *L = S->first_line; L; L = L->next_line) {
if ((Tags__tagged_with(L->owning_paragraph, wv->theme_match)) &&
@ -14830,11 +14834,11 @@ int Weaver__weave_source(web *W, weave_target *wv) {
lines_woven++;
{
#line 124 "inweb/Chapter 3/The Weaver.w"
#line 126 "inweb/Chapter 3/The Weaver.w"
/* In principle, all of these source lines should be woven, but... */
{
#line 148 "inweb/Chapter 3/The Weaver.w"
#line 150 "inweb/Chapter 3/The Weaver.w"
if (L->category == INTERFACE_BODY_LCAT) continue;
if (L->category == PURPOSE_BODY_LCAT) continue;
if (L->category == BEGIN_CODE_LCAT) {
@ -14843,17 +14847,17 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 125 "inweb/Chapter 3/The Weaver.w"
#line 127 "inweb/Chapter 3/The Weaver.w"
;
{
#line 159 "inweb/Chapter 3/The Weaver.w"
#line 161 "inweb/Chapter 3/The Weaver.w"
if (L->category == COMMAND_LCAT) {
if (L->command_code == PAGEBREAK_CMD) Formats__pagebreak(OUT, wv);
if (L->command_code == GRAMMAR_INDEX_CMD) InCSupport__weave_grammar_index(OUT);
if (L->command_code == FIGURE_CMD)
{
#line 168 "inweb/Chapter 3/The Weaver.w"
#line 170 "inweb/Chapter 3/The Weaver.w"
text_stream *figname = L->text_operand;
match_results mr = Regexp__create_mr();
if (Regexp__match(&mr, figname, L"(%d+)cm: (%c+)")) {
@ -14874,20 +14878,20 @@ int Weaver__weave_source(web *W, weave_target *wv) {
Regexp__dispose_of(&mr);
}
#line 162 "inweb/Chapter 3/The Weaver.w"
#line 164 "inweb/Chapter 3/The Weaver.w"
;
/* Otherwise assume it was a tangler command, and ignore it here */
continue;
}
}
#line 126 "inweb/Chapter 3/The Weaver.w"
#line 128 "inweb/Chapter 3/The Weaver.w"
;
/* Some of the more baroque front matter of a section... */
{
#line 193 "inweb/Chapter 3/The Weaver.w"
#line 195 "inweb/Chapter 3/The Weaver.w"
if (L->category == PURPOSE_LCAT) {
Formats__subheading(OUT, wv, 2, S->sect_purpose, NULL);
Weaver__weave_table_of_contents(OUT, wv, S);
@ -14895,11 +14899,11 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 129 "inweb/Chapter 3/The Weaver.w"
#line 131 "inweb/Chapter 3/The Weaver.w"
;
{
#line 202 "inweb/Chapter 3/The Weaver.w"
#line 204 "inweb/Chapter 3/The Weaver.w"
if ((state->show_section_toc_soon == 1) && (Regexp__string_is_white_space(L->text))) {
state->show_section_toc_soon = FALSE;
if (Weaver__weave_table_of_contents(OUT, wv, S))
@ -14909,22 +14913,22 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 130 "inweb/Chapter 3/The Weaver.w"
#line 132 "inweb/Chapter 3/The Weaver.w"
;
{
#line 214 "inweb/Chapter 3/The Weaver.w"
#line 216 "inweb/Chapter 3/The Weaver.w"
if (L->category == INTERFACE_LCAT) {
state->horizontal_rule_just_drawn = FALSE;
continue;
}
}
#line 131 "inweb/Chapter 3/The Weaver.w"
#line 133 "inweb/Chapter 3/The Weaver.w"
;
{
#line 222 "inweb/Chapter 3/The Weaver.w"
#line 224 "inweb/Chapter 3/The Weaver.w"
if (L->category == DEFINITIONS_LCAT) {
Formats__subheading(OUT, wv, 2, TL_IS_145, NULL);
state->next_heading_without_vertical_skip = TRUE;
@ -14933,15 +14937,15 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 132 "inweb/Chapter 3/The Weaver.w"
#line 134 "inweb/Chapter 3/The Weaver.w"
;
{
#line 234 "inweb/Chapter 3/The Weaver.w"
#line 236 "inweb/Chapter 3/The Weaver.w"
if (L->category == BAR_LCAT) {
{
#line 634 "inweb/Chapter 3/The Weaver.w"
#line 636 "inweb/Chapter 3/The Weaver.w"
int mode_now = state->kind_of_material;
if (state->kind_of_material != REGULAR_MATERIAL) {
state->kind_of_material = REGULAR_MATERIAL;
@ -14954,7 +14958,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
if (L) current_paragraph = L->owning_paragraph;
}
#line 235 "inweb/Chapter 3/The Weaver.w"
#line 237 "inweb/Chapter 3/The Weaver.w"
;
state->kind_of_material = REGULAR_MATERIAL;
state->next_heading_without_vertical_skip = TRUE;
@ -14963,13 +14967,13 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 133 "inweb/Chapter 3/The Weaver.w"
#line 135 "inweb/Chapter 3/The Weaver.w"
;
/* The crucial junction point between modes... */
{
#line 483 "inweb/Chapter 3/The Weaver.w"
#line 485 "inweb/Chapter 3/The Weaver.w"
if ((L->category == HEADING_START_LCAT) ||
(L->category == PARAGRAPH_START_LCAT) ||
(L->category == CHAPTER_HEADING_LCAT) ||
@ -14977,7 +14981,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
state->in_run_of_definitions = FALSE;
{
#line 634 "inweb/Chapter 3/The Weaver.w"
#line 636 "inweb/Chapter 3/The Weaver.w"
int mode_now = state->kind_of_material;
if (state->kind_of_material != REGULAR_MATERIAL) {
state->kind_of_material = REGULAR_MATERIAL;
@ -14990,17 +14994,17 @@ int Weaver__weave_source(web *W, weave_target *wv) {
if (L) current_paragraph = L->owning_paragraph;
}
#line 488 "inweb/Chapter 3/The Weaver.w"
#line 490 "inweb/Chapter 3/The Weaver.w"
;
if (wv->theme_match)
{
#line 518 "inweb/Chapter 3/The Weaver.w"
#line 520 "inweb/Chapter 3/The Weaver.w"
if ((L->owning_paragraph) &&
(L->owning_paragraph->starts_on_new_page)) Formats__pagebreak(OUT, wv);
}
#line 490 "inweb/Chapter 3/The Weaver.w"
#line 492 "inweb/Chapter 3/The Weaver.w"
;
Languages__reset_syntax_colouring(S->sect_language); /* a precaution: limits bad colouring accidents to one para */
int weight = 0;
@ -15010,7 +15014,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
{
#line 531 "inweb/Chapter 3/The Weaver.w"
#line 533 "inweb/Chapter 3/The Weaver.w"
if (weight == 3) {
Str__copy(state->chaptermark, L->text_operand);
Str__clear(state->sectionmark);
@ -15026,13 +15030,13 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 497 "inweb/Chapter 3/The Weaver.w"
#line 499 "inweb/Chapter 3/The Weaver.w"
;
text_stream *TeX_macro = NULL;
{
#line 561 "inweb/Chapter 3/The Weaver.w"
#line 563 "inweb/Chapter 3/The Weaver.w"
switch (weight) {
case 0: TeX_macro = TL_IS_152; break;
case 1: TeX_macro = TL_IS_153; break;
@ -15041,7 +15045,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
if (wv->theme_match)
{
#line 580 "inweb/Chapter 3/The Weaver.w"
#line 582 "inweb/Chapter 3/The Weaver.w"
switch (weight) {
case 0: TeX_macro = TL_IS_158; break;
case 1: TeX_macro = TL_IS_159; break;
@ -15062,7 +15066,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 567 "inweb/Chapter 3/The Weaver.w"
#line 569 "inweb/Chapter 3/The Weaver.w"
;
if ((state->next_heading_without_vertical_skip) && (weight < 2)) {
state->next_heading_without_vertical_skip = FALSE;
@ -15073,13 +15077,13 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 500 "inweb/Chapter 3/The Weaver.w"
#line 502 "inweb/Chapter 3/The Weaver.w"
;
TEMPORARY_TEXT(heading_text);
{
#line 600 "inweb/Chapter 3/The Weaver.w"
#line 602 "inweb/Chapter 3/The Weaver.w"
if (weight == 3) {
TEMPORARY_TEXT(brief_title);
match_results mr = Regexp__create_mr();
@ -15099,7 +15103,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 503 "inweb/Chapter 3/The Weaver.w"
#line 505 "inweb/Chapter 3/The Weaver.w"
;
Formats__paragraph_heading(OUT, wv, TeX_macro, S, L->owning_paragraph,
heading_text, state->chaptermark, state->sectionmark, weight);
@ -15110,7 +15114,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
{
#line 622 "inweb/Chapter 3/The Weaver.w"
#line 624 "inweb/Chapter 3/The Weaver.w"
if (Str__len(L->text_operand2) > 0) {
TEMPORARY_TEXT(matter);
WRITE_TO(matter, "%S\n", L->text_operand2);
@ -15120,7 +15124,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 511 "inweb/Chapter 3/The Weaver.w"
#line 513 "inweb/Chapter 3/The Weaver.w"
;
if (weight == 3) Formats__chapter_title_page(OUT, wv, C);
@ -15128,28 +15132,28 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 136 "inweb/Chapter 3/The Weaver.w"
#line 138 "inweb/Chapter 3/The Weaver.w"
;
/* With all exotica dealt with, we now just have material to weave verbatim... */
TEMPORARY_TEXT(matter); Str__copy(matter, L->text);
if (L->is_commentary)
{
#line 247 "inweb/Chapter 3/The Weaver.w"
#line 249 "inweb/Chapter 3/The Weaver.w"
{
#line 259 "inweb/Chapter 3/The Weaver.w"
#line 261 "inweb/Chapter 3/The Weaver.w"
if (L->category == SOURCE_DISPLAY_LCAT) {
Formats__display_line(OUT, wv, L->text_operand);
continue;
}
}
#line 247 "inweb/Chapter 3/The Weaver.w"
#line 249 "inweb/Chapter 3/The Weaver.w"
;
{
#line 268 "inweb/Chapter 3/The Weaver.w"
#line 270 "inweb/Chapter 3/The Weaver.w"
if (Regexp__string_is_white_space(matter)) {
if ((L->next_line) && (L->next_line->category == COMMENT_BODY_LCAT) &&
(state->substantive_comment)) {
@ -15163,11 +15167,11 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 248 "inweb/Chapter 3/The Weaver.w"
#line 250 "inweb/Chapter 3/The Weaver.w"
;
{
#line 284 "inweb/Chapter 3/The Weaver.w"
#line 286 "inweb/Chapter 3/The Weaver.w"
match_results mr = Regexp__create_mr();
if (Regexp__match(&mr, matter, L"%(...%) (%c*)")) { /* continue single */
Formats__change_material(OUT, wv, state->kind_of_material, REGULAR_MATERIAL,
@ -15197,11 +15201,11 @@ int Weaver__weave_source(web *W, weave_target *wv) {
Regexp__dispose_of(&mr);
}
#line 249 "inweb/Chapter 3/The Weaver.w"
#line 251 "inweb/Chapter 3/The Weaver.w"
;
{
#line 316 "inweb/Chapter 3/The Weaver.w"
#line 318 "inweb/Chapter 3/The Weaver.w"
match_results mr = Regexp__create_mr();
if (Regexp__match(&mr, matter, L"\t|(%c*)|(%c*?)")) {
if (state->kind_of_material != CODE_MATERIAL) {
@ -15225,7 +15229,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
Regexp__dispose_of(&mr);
}
#line 250 "inweb/Chapter 3/The Weaver.w"
#line 252 "inweb/Chapter 3/The Weaver.w"
;
state->substantive_comment = TRUE;
WRITE_TO(matter, "\n");
@ -15233,14 +15237,14 @@ int Weaver__weave_source(web *W, weave_target *wv) {
continue;
}
#line 140 "inweb/Chapter 3/The Weaver.w"
#line 142 "inweb/Chapter 3/The Weaver.w"
else
{
#line 344 "inweb/Chapter 3/The Weaver.w"
#line 346 "inweb/Chapter 3/The Weaver.w"
{
#line 380 "inweb/Chapter 3/The Weaver.w"
#line 382 "inweb/Chapter 3/The Weaver.w"
int mode_now = state->kind_of_material;
if (state->kind_of_material != CODE_MATERIAL) {
if (L->category == MACRO_DEFINITION_LCAT)
@ -15260,11 +15264,11 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 344 "inweb/Chapter 3/The Weaver.w"
#line 346 "inweb/Chapter 3/The Weaver.w"
;
{
#line 402 "inweb/Chapter 3/The Weaver.w"
#line 404 "inweb/Chapter 3/The Weaver.w"
if (state->line_break_pending) {
Formats__blank_line(OUT, wv, FALSE);
state->line_break_pending = FALSE;
@ -15275,13 +15279,13 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 345 "inweb/Chapter 3/The Weaver.w"
#line 347 "inweb/Chapter 3/The Weaver.w"
;
int tab_stops_of_indentation = 0;
{
#line 415 "inweb/Chapter 3/The Weaver.w"
#line 417 "inweb/Chapter 3/The Weaver.w"
int spaces_in = 0;
while (Characters__is_space_or_tab(Str__get_first_char(matter))) {
if (Str__get_first_char(matter) == '\t') {
@ -15298,14 +15302,14 @@ int Weaver__weave_source(web *W, weave_target *wv) {
}
}
#line 348 "inweb/Chapter 3/The Weaver.w"
#line 350 "inweb/Chapter 3/The Weaver.w"
;
TEMPORARY_TEXT(prefatory);
TEMPORARY_TEXT(concluding_comment);
{
#line 435 "inweb/Chapter 3/The Weaver.w"
#line 437 "inweb/Chapter 3/The Weaver.w"
TEMPORARY_TEXT(part_before_comment);
TEMPORARY_TEXT(part_within_comment);
if (Languages__parse_comment(S->sect_language,
@ -15317,11 +15321,11 @@ int Weaver__weave_source(web *W, weave_target *wv) {
DISCARD_TEXT(part_within_comment);
}
#line 352 "inweb/Chapter 3/The Weaver.w"
#line 354 "inweb/Chapter 3/The Weaver.w"
;
{
#line 448 "inweb/Chapter 3/The Weaver.w"
#line 450 "inweb/Chapter 3/The Weaver.w"
match_results mr = Regexp__create_mr();
if ((Regexp__match(&mr, matter, L"@d (%c*)")) || (Regexp__match(&mr, matter, L"@define (%c*)"))) {
Str__copy(prefatory, TL_IS_150);
@ -15333,7 +15337,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
Regexp__dispose_of(&mr);
}
#line 353 "inweb/Chapter 3/The Weaver.w"
#line 355 "inweb/Chapter 3/The Weaver.w"
;
if (Languages__weave_code_line(OUT, S->sect_language, wv,
@ -15345,7 +15349,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
int found = 0;
{
#line 459 "inweb/Chapter 3/The Weaver.w"
#line 461 "inweb/Chapter 3/The Weaver.w"
match_results mr = Regexp__create_mr();
while (Regexp__match(&mr, matter, L"(%c*?)%@%<(%c*?)%@%>(%c*)")) {
Str__copy(matter, mr.exp[2]);
@ -15368,7 +15372,7 @@ int Weaver__weave_source(web *W, weave_target *wv) {
Regexp__dispose_of(&mr);
}
#line 362 "inweb/Chapter 3/The Weaver.w"
#line 364 "inweb/Chapter 3/The Weaver.w"
;
if (Str__len(prefatory) > 0) {
state->in_run_of_definitions = TRUE;
@ -15384,19 +15388,19 @@ int Weaver__weave_source(web *W, weave_target *wv) {
continue;
}
#line 141 "inweb/Chapter 3/The Weaver.w"
#line 143 "inweb/Chapter 3/The Weaver.w"
;
DISCARD_TEXT(matter);
}
#line 117 "inweb/Chapter 3/The Weaver.w"
#line 119 "inweb/Chapter 3/The Weaver.w"
;
}
}
source_line *L = NULL;
{
#line 634 "inweb/Chapter 3/The Weaver.w"
#line 636 "inweb/Chapter 3/The Weaver.w"
int mode_now = state->kind_of_material;
if (state->kind_of_material != REGULAR_MATERIAL) {
state->kind_of_material = REGULAR_MATERIAL;
@ -15409,56 +15413,56 @@ int Weaver__weave_source(web *W, weave_target *wv) {
if (L) current_paragraph = L->owning_paragraph;
}
#line 121 "inweb/Chapter 3/The Weaver.w"
#line 123 "inweb/Chapter 3/The Weaver.w"
;
}
#line 58 "inweb/Chapter 3/The Weaver.w"
#line 60 "inweb/Chapter 3/The Weaver.w"
;
}
}
}
#line 26 "inweb/Chapter 3/The Weaver.w"
#line 27 "inweb/Chapter 3/The Weaver.w"
;
if ((Str__len(wv->cover_sheet_to_use) > 0) && (W->no_sections > 1))
{
#line 63 "inweb/Chapter 3/The Weaver.w"
#line 65 "inweb/Chapter 3/The Weaver.w"
if (!(Bibliographic__data_exists(W, TL_IS_143)))
Bibliographic__set_datum(W, TL_IS_144, wv->booklet_title);
Indexer__cover_sheet_maker(OUT, W, wv->cover_sheet_to_use, wv, WEAVE_SECOND_HALF);
}
#line 28 "inweb/Chapter 3/The Weaver.w"
#line 29 "inweb/Chapter 3/The Weaver.w"
;
{
#line 68 "inweb/Chapter 3/The Weaver.w"
#line 70 "inweb/Chapter 3/The Weaver.w"
TEMPORARY_TEXT(rennab);
WRITE_TO(rennab, "End of weave: %d lines from a web of %d", lines_woven, W->no_lines);
Formats__tail(OUT, wv, rennab);
Formats__tail(OUT, wv, rennab, latest_section);
DISCARD_TEXT(rennab);
}
#line 29 "inweb/Chapter 3/The Weaver.w"
#line 30 "inweb/Chapter 3/The Weaver.w"
;
STREAM_CLOSE(OUT);
return lines_woven;
}
#line 80 "inweb/Chapter 3/The Weaver.w"
#line 82 "inweb/Chapter 3/The Weaver.w"
#line 95 "inweb/Chapter 3/The Weaver.w"
#line 97 "inweb/Chapter 3/The Weaver.w"
#line 650 "inweb/Chapter 3/The Weaver.w"
#line 652 "inweb/Chapter 3/The Weaver.w"
void Weaver__show_endnotes_on_previous_paragraph(OUTPUT_STREAM, weave_target *wv, paragraph *P) {
Tags__show_endnote_on_ifdefs(OUT, wv, P);
if (P->defines_macro)
{
#line 663 "inweb/Chapter 3/The Weaver.w"
#line 665 "inweb/Chapter 3/The Weaver.w"
Formats__endnote(OUT, wv, 1);
Formats__text(OUT, wv, TL_IS_163);
int ct = 0;
@ -15498,13 +15502,13 @@ void Weaver__show_endnotes_on_previous_paragraph(OUTPUT_STREAM, weave_target *wv
Formats__endnote(OUT, wv, 2);
}
#line 653 "inweb/Chapter 3/The Weaver.w"
#line 655 "inweb/Chapter 3/The Weaver.w"
;
function *fn;
LOOP_OVER_LINKED_LIST(fn, function, P->functions)
{
#line 702 "inweb/Chapter 3/The Weaver.w"
#line 704 "inweb/Chapter 3/The Weaver.w"
Formats__endnote(OUT, wv, 1);
hash_table_entry *hte =
Analyser__find_hash_entry(fn->function_header_at->owning_section, fn->function_name, FALSE);
@ -15519,7 +15523,7 @@ void Weaver__show_endnotes_on_previous_paragraph(OUTPUT_STREAM, weave_target *wv
(P->under_section == hteu->usage_recorded_at->under_section))
{
#line 725 "inweb/Chapter 3/The Weaver.w"
#line 727 "inweb/Chapter 3/The Weaver.w"
if (used_flag == FALSE) Formats__text(OUT, wv, TL_IS_177);
used_flag = TRUE;
section *S = hteu->usage_recorded_at->under_section;
@ -15537,13 +15541,13 @@ void Weaver__show_endnotes_on_previous_paragraph(OUTPUT_STREAM, weave_target *wv
last_cited_in = hteu->usage_recorded_at->under_section;
}
#line 714 "inweb/Chapter 3/The Weaver.w"
#line 716 "inweb/Chapter 3/The Weaver.w"
;
LOOP_OVER_LINKED_LIST(hteu, hash_table_entry_usage, hte->usages)
if (P->under_section != hteu->usage_recorded_at->under_section)
{
#line 725 "inweb/Chapter 3/The Weaver.w"
#line 727 "inweb/Chapter 3/The Weaver.w"
if (used_flag == FALSE) Formats__text(OUT, wv, TL_IS_177);
used_flag = TRUE;
section *S = hteu->usage_recorded_at->under_section;
@ -15561,7 +15565,7 @@ void Weaver__show_endnotes_on_previous_paragraph(OUTPUT_STREAM, weave_target *wv
last_cited_in = hteu->usage_recorded_at->under_section;
}
#line 717 "inweb/Chapter 3/The Weaver.w"
#line 719 "inweb/Chapter 3/The Weaver.w"
;
if (used_flag == FALSE) Formats__text(OUT, wv, TL_IS_174);
if ((last_cited_in != P->under_section) && (last_cited_in))
@ -15570,13 +15574,13 @@ void Weaver__show_endnotes_on_previous_paragraph(OUTPUT_STREAM, weave_target *wv
Formats__endnote(OUT, wv, 2);
}
#line 656 "inweb/Chapter 3/The Weaver.w"
#line 658 "inweb/Chapter 3/The Weaver.w"
;
c_structure *st;
LOOP_OVER_LINKED_LIST(st, c_structure, P->structures)
{
#line 742 "inweb/Chapter 3/The Weaver.w"
#line 744 "inweb/Chapter 3/The Weaver.w"
Formats__endnote(OUT, wv, 1);
Formats__text(OUT, wv, TL_IS_182);
Formats__text(OUT, wv, st->structure_name);
@ -15616,11 +15620,11 @@ void Weaver__show_endnotes_on_previous_paragraph(OUTPUT_STREAM, weave_target *wv
Formats__endnote(OUT, wv, 2);
}
#line 659 "inweb/Chapter 3/The Weaver.w"
#line 661 "inweb/Chapter 3/The Weaver.w"
;
}
#line 785 "inweb/Chapter 3/The Weaver.w"
#line 787 "inweb/Chapter 3/The Weaver.w"
int Weaver__weave_table_of_contents(OUTPUT_STREAM, weave_target *wv, section *S) {
int noteworthy = 0;
paragraph *P;
@ -18178,10 +18182,10 @@ void Formats__locale(OUTPUT_STREAM, weave_target *wv, paragraph *par1, paragraph
#line 476 "inweb/Chapter 5/Weave Formats.w"
VMETHOD_TYPE(TAIL_FOR_MTID, weave_format *wf, text_stream *OUT, weave_target *wv,
text_stream *comment)
void Formats__tail(OUTPUT_STREAM, weave_target *wv, text_stream *comment) {
text_stream *comment, section *S)
void Formats__tail(OUTPUT_STREAM, weave_target *wv, text_stream *comment, section *S) {
weave_format *wf = wv->format;
VMETHOD_CALL(wf, TAIL_FOR_MTID, OUT, wv, comment);
VMETHOD_CALL(wf, TAIL_FOR_MTID, OUT, wv, comment, S);
}
#line 491 "inweb/Chapter 5/Weave Formats.w"
@ -18361,7 +18365,7 @@ void PlainText__locale(weave_format *self, text_stream *OUT, weave_target *wv,
#line 147 "inweb/Chapter 5/Plain Text Format.w"
void PlainText__tail(weave_format *self, text_stream *OUT, weave_target *wv,
text_stream *comment) {
text_stream *comment, section *S) {
WRITE("[%S]\n", comment);
}
@ -18827,7 +18831,7 @@ void TeX__change_material(weave_format *self, text_stream *OUT, weave_target *wv
#line 407 "inweb/Chapter 5/TeX Format.w"
void TeX__tail(weave_format *self, text_stream *OUT, weave_target *wv,
text_stream *comment) {
text_stream *comment, section *S) {
WRITE("%% %S\n", comment);
WRITE("\\end\n");
}
@ -19549,15 +19553,62 @@ void HTMLFormat__xref(OUTPUT_STREAM, weave_target *wv, paragraph *P, section *fr
#line 566 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__tail(weave_format *self, text_stream *OUT, weave_target *wv,
text_stream *comment) {
text_stream *comment, section *this_S) {
HTMLFormat__exit_current_paragraph(OUT);
if (wv->docs_mode) {
chapter *C = this_S->owning_chapter;
section *S, *last_S = NULL, *prev_S = NULL, *next_S = NULL;
LOOP_OVER_LINKED_LIST(S, section, C->sections) {
if (S == this_S) prev_S = last_S;
if (last_S == this_S) next_S = S;
last_S = S;
}
HTML__hr(OUT, "tocbar");
HTML_OPEN_WITH("ul", "class=\"toc\"");
HTML_OPEN("li");
if (prev_S == NULL) WRITE("<i>(This section begins %S.)</i>", C->ch_title);
else {
TEMPORARY_TEXT(TEMP);
HTMLFormat__sref(TEMP, wv, prev_S);
HTML__begin_link(OUT, TEMP);
WRITE("Back to '%S'", prev_S->sect_title);
HTML__end_link(OUT);
DISCARD_TEXT(TEMP);
}
HTML_CLOSE("li");
HTML_OPEN("li");
if (next_S == NULL) WRITE("<i>(This section ends %S.)</i>", C->ch_title);
else {
TEMPORARY_TEXT(TEMP);
HTMLFormat__sref(TEMP, wv, next_S);
HTML__begin_link(OUT, TEMP);
WRITE("Continue with '%S'", next_S->sect_title);
HTML__end_link(OUT);
DISCARD_TEXT(TEMP);
}
HTML_CLOSE("li");
HTML_CLOSE("ul");
HTML__hr(OUT, "tocbar");
}
HTML__comment(OUT, comment);
HTML__completed(OUT);
Bibliographic__set_datum(wv->weave_web, TL_IS_293, wv->booklet_title);
Indexer__cover_sheet_maker(OUT, wv->weave_web, TL_IS_294, wv, WEAVE_SECOND_HALF);
}
#line 578 "inweb/Chapter 5/HTML Formats.w"
#line 612 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__sref(OUTPUT_STREAM, weave_target *wv, section *S) {
if (S == NULL) internal_error("unwoven section");
LOOP_THROUGH_TEXT(pos, S->range)
if (Str__get(pos) == '/')
PUT('-');
else
PUT(Str__get(pos));
WRITE(".html");
}
#line 625 "inweb/Chapter 5/HTML Formats.w"
int HTMLFormat__begin_weaving_EPUB(weave_format *wf, web *W, weave_pattern *pattern) {
TEMPORARY_TEXT(T)
WRITE_TO(T, "%S", Bibliographic__get_datum(W, TL_IS_295));

View file

@ -1,6 +1,6 @@
<html>
<head>
<title>inweb Source</title>
<title>Inweb &#9733; Webs</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-gb">
<link href="inweb/inweb.css" rel="stylesheet" rev="stylesheet" type="text/css">

View file

@ -12,6 +12,7 @@ Tests/intest-history.txt
Tests/Transient/
Tests/hashes.intest
Tests/_Results_Actual/
foundation-test/Tests/Test Cases/_Results_Actual/
platform-settings.mk
foundation-module/Woven/
Examples/*.o