diff --git a/Chapter 3/The Weaver of Text.w b/Chapter 3/The Weaver of Text.w index ddd731e..eaf129f 100644 --- a/Chapter 3/The Weaver of Text.w +++ b/Chapter 3/The Weaver of Text.w @@ -25,8 +25,6 @@ void TextWeaver::commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre (in_code)?(I"Code In Code Comments Notation"):(I"Code In Commentary Notation")); if (Str::ne(code_in_comments_notation, I"Off")) @; - if (within == FALSE) @; - int display_flag = TRUE; text_stream *tex_notation = Bibliographic::get_datum(wv->weave_web->md, I"TeX Mathematics Displayed Notation"); @@ -43,6 +41,7 @@ void TextWeaver::commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre if (within) { TextWeaver::inline_code_fragment(tree, ap, matter); } else { + @; @; TextWeaver::commentary_fragment(tree, ap, matter, in_code); } @@ -65,7 +64,7 @@ void TextWeaver::commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre } } -@ = +@ = for (int i=0; i < Str::len(matter); i++) { if ((Str::includes_at(matter, i, I"http://")) || (Str::includes_at(matter, i, I"https://"))) { @@ -75,6 +74,15 @@ void TextWeaver::commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre Str::substr(after, Str::at(matter, i), Str::end(matter)); match_results mr = Regexp::create_mr(); if (Regexp::match(&mr, after, L"(https*://%C+)(%c*)")) { + while (TextWeaver::boundary_character(FALSE, Str::get_last_char(mr.exp[0]))) { + wchar_t c = Str::get_last_char(mr.exp[0]); + Str::delete_last_character(mr.exp[0]); + TEMPORARY_TEXT(longer); + WRITE_TO(longer, "%c%S", c, mr.exp[1]); + Str::clear(mr.exp[1]); + Str::copy(mr.exp[1], longer); + DISCARD_TEXT(longer); + } TextWeaver::commentary_r(tree, ap, before, within, in_code); Trees::make_child(WeaveTree::url(tree, mr.exp[0], mr.exp[0], TRUE), ap); TextWeaver::commentary_r(tree, ap, mr.exp[1], within, in_code); @@ -141,10 +149,14 @@ void TextWeaver::commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre @ = int N = Str::len(xref_notation); for (int i=0; i < Str::len(matter); i++) { - if ((within == FALSE) && (Str::includes_at(matter, i, xref_notation))) { + if ((within == FALSE) && (Str::includes_at(matter, i, xref_notation)) && + ((i == 0) || (TextWeaver::boundary_character(TRUE, + Str::get_at(matter, i-1))))) { int j = i + N+1; while (j < Str::len(matter)) { - if (Str::includes_at(matter, j, xref_notation)) { + if ((Str::includes_at(matter, j, xref_notation)) && + (TextWeaver::boundary_character(FALSE, + Str::get_at(matter, j+Str::len(xref_notation))))) { int allow = FALSE; TEMPORARY_TEXT(before); TEMPORARY_TEXT(reference); @@ -166,19 +178,35 @@ void TextWeaver::commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre @ = TEMPORARY_TEXT(url); TEMPORARY_TEXT(title); + int ext = FALSE; if (Colonies::resolve_reference_in_weave(url, title, wv->weave_to, reference, - wv->weave_web->md, wv->current_weave_line)) { + wv->weave_web->md, wv->current_weave_line, &ext)) { TextWeaver::commentary_r(tree, ap, before, within, in_code); - Trees::make_child(WeaveTree::url(tree, url, title, FALSE), ap); + Trees::make_child(WeaveTree::url(tree, url, title, ext), ap); TextWeaver::commentary_r(tree, ap, after, within, in_code); allow = TRUE; } DISCARD_TEXT(url); DISCARD_TEXT(title); -@ +@ This tests whether a cross-reference is allowed to begin or end: it must +begin after and finish before a "boundary character". + +Note the one-sided treatment of |:|, which is a boundary after but not before, +so that |http://| won't trigger a cross-reference with the standard |//| +xref notation. = +int TextWeaver::boundary_character(int before, wchar_t c) { + if (c == 0) return TRUE; + if (Characters::is_whitespace(c)) return TRUE; + if ((c == '.') || (c == ',') || (c == '!') || (c == '?') || (c == ';') || + (c == '(')|| (c == ')')) return TRUE; + if ((before == FALSE) && (c == ':')) return TRUE; + return FALSE; +} + +@ = void TextWeaver::commentary_fragment(heterogeneous_tree *tree, tree_node *ap, text_stream *fragment, int in_code) { if (Str::len(fragment) > 0) @@ -264,9 +292,10 @@ void TextWeaver::source_code(heterogeneous_tree *tree, tree_node *ap, @ = TEMPORARY_TEXT(url); TEMPORARY_TEXT(title); + int ext = FALSE; if (Colonies::resolve_reference_in_weave(url, title, wv->weave_to, reference, - wv->weave_web->md, wv->current_weave_line)) { - tree_node *U = WeaveTree::url(tree, url, title, FALSE); + wv->weave_web->md, wv->current_weave_line, &ext)) { + tree_node *U = WeaveTree::url(tree, url, title, ext); TextWeaver::source_code_piece(tree, ap, matter, colouring, from, i); Trees::make_child(U, ap); i = j + N; diff --git a/Chapter 6/Colonies.w b/Chapter 6/Colonies.w index 8ee5a0a..9055106 100644 --- a/Chapter 6/Colonies.w +++ b/Chapter 6/Colonies.w @@ -308,27 +308,30 @@ is where the reference is made from. = int Colonies::resolve_reference_in_weave(text_stream *url, text_stream *title, - filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L) { + filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L, int *ext) { int r = 0; + if (ext) *ext = FALSE; match_results mr = Regexp::create_mr(); if (Regexp::match(&mr, text, L"(%c+?) -> (%c+)")) { r = Colonies::resolve_reference_in_weave_inner(url, NULL, - for_HTML_file, mr.exp[1], Wm, L); + for_HTML_file, mr.exp[1], Wm, L, ext); WRITE_TO(title, "%S", mr.exp[0]); } else { r = Colonies::resolve_reference_in_weave_inner(url, title, - for_HTML_file, text, Wm, L); + for_HTML_file, text, Wm, L, ext); } Regexp::dispose_of(&mr); return r; } + int Colonies::resolve_reference_in_weave_inner(text_stream *url, text_stream *title, - filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L) { + filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L, int *ext) { module *from_M = (Wm)?(Wm->as_module):NULL; module *search_M = from_M; colony_member *search_CM = NULL; int external = FALSE; + @; @; @; @@ -358,6 +361,17 @@ int Colonies::resolve_reference_in_weave_inner(text_stream *url, text_stream *ti } } +@ = + match_results mr = Regexp::create_mr(); + if (Regexp::match(&mr, text, L"https*://%c*")) { + WRITE_TO(url, "%S", text); + WRITE_TO(title, "%S", text); + Regexp::dispose_of(&mr); + if (ext) *ext = TRUE; + return TRUE; + } + Regexp::dispose_of(&mr); + @ = search_CM = Colonies::find(text); if (search_CM) { @@ -449,7 +463,7 @@ void Colonies::link_URL(OUTPUT_STREAM, text_stream *link_text, filename *F) { void Colonies::reference_URL(OUTPUT_STREAM, text_stream *link_text, filename *F) { TEMPORARY_TEXT(title); TEMPORARY_TEXT(url); - if (Colonies::resolve_reference_in_weave(url, title, F, link_text, NULL, NULL)) + if (Colonies::resolve_reference_in_weave(url, title, F, link_text, NULL, NULL, NULL)) WRITE("%S", url); else PRINT("Warning: unable to resolve reference '%S' in navigation\n", link_text); diff --git a/Examples/goldbach/Figures/img1.jpg b/Examples/goldbach/Figures/img1.jpg deleted file mode 100644 index b51eafb..0000000 Binary files a/Examples/goldbach/Figures/img1.jpg and /dev/null differ diff --git a/Examples/goldbach/Figures/img2.jpg b/Examples/goldbach/Figures/img2.jpg deleted file mode 100644 index 9f5d4da..0000000 Binary files a/Examples/goldbach/Figures/img2.jpg and /dev/null differ diff --git a/Examples/goldbach/Figures/img3.jpg b/Examples/goldbach/Figures/img3.jpg deleted file mode 100644 index b3f3d4c..0000000 Binary files a/Examples/goldbach/Figures/img3.jpg and /dev/null differ diff --git a/Examples/goldbach/Sections/Summing Primes.w b/Examples/goldbach/Sections/Summing Primes.w index ee519a6..0516e17 100755 --- a/Examples/goldbach/Sections/Summing Primes.w +++ b/Examples/goldbach/Sections/Summing Primes.w @@ -24,7 +24,7 @@ said as late as the early twentieth century. of the great age of Enlightenment letter-writing. He and Euler exchanged scholarly letters for over thirty years, not something Euler would have kept up with a duffer. Goldbach was also not, as is sometimes said, a lawyer. -See: http://mathshistory.st-andrews.ac.uk/Biographies/Goldbach.html +See: http://mathshistory.st-andrews.ac.uk/Biographies/Goldbach.html. An edited transcription of the letter is at: http://eulerarchive.maa.org//correspondence/letters/OO0765.pdf @ Computer verification has been made up to around $10^{18}$, but by rather diff --git a/Manual/How to Write a Web.w b/Manual/How to Write a Web.w index 9924bcd..88a07b1 100644 --- a/Manual/How to Write a Web.w +++ b/Manual/How to Write a Web.w @@ -365,25 +365,27 @@ For example, URLs in the web are automatically recognised and a weave to HTML will make them into links. For example: = (text) - For further reading, see: https://en.wikipedia.org/wiki/How_to_Avoid_Huge_Ships + For further reading, see: https://en.wikipedia.org/wiki/How_to_Avoid_Huge_Ships. = -For further reading, see: https://en.wikipedia.org/wiki/How_to_Avoid_Huge_Ships +For further reading, see: https://en.wikipedia.org/wiki/How_to_Avoid_Huge_Ships. -Note that URLs are considered to continue to the next white space, so don't -end them with full stops or commas. +Note that URLs are considered to continue to the next white space, except +that any final full stops, question or exclamation marks, commas, brackets, +semicolons, or colons are disregarded. (This is why the above sentence ended +with a full stop and yet the full stop wasn't part of the reference URL.) URLs will also be recognised in any text extract marked as |hyperlinked|. For example, = (text) - Compare: https://en.wikipedia.org/wiki/Crocheting_Adventures_with_Hyperbolic_Planes + Compare: https://en.wikipedia.org/wiki/Crocheting_Adventures_with_Hyperbolic_Planes! = produces: = (hyperlinked text) - Compare: https://en.wikipedia.org/wiki/Crocheting_Adventures_with_Hyperbolic_Planes + Compare: https://en.wikipedia.org/wiki/Crocheting_Adventures_with_Hyperbolic_Planes! = @h Cross-references. -These are like links, but internal. These are normally written within |//| +These are like links, but are internal. These are normally written within |//| signs and are only available in the commentary of a web. They allow us to place cross-references like so: = (text) @@ -413,6 +415,12 @@ This is simple: for example, = produces: "First //the program has to configure itself -> Configuration//, then..."; the text "the program has to configure itself" links to //Configuration//. +This is especially useful if the destination is given as an explicit URL, which +is also allowed: += (text) + See //this biographical note -> http://mathshistory.st-andrews.ac.uk/Biographies/Gauss.html//. += +See //this biographical note -> http://mathshistory.st-andrews.ac.uk/Biographies/Gauss.html//. @ It's also possible to reference function names and type names, provided that the language definition supports these (see //Supporting Programming Languages//): @@ -440,7 +448,11 @@ produces: See the //Manual// for more on this. = -This notation may be inconvenient if you need |//| for something else, but it +@ Cross-references must begin after white space, or a punctuation mark (other +than a colon), and must end to be followed by more white space or another +punctuation mark (this time allowing a colon). In practice, that reduces +the risk of misunderstanding a |//| occurring in the commentary for some +other reason. All the same, you might want a different notation, so this can be configured in the Contents page of a web, say like so: = (text as Inweb) Cross-References Notation: &&& diff --git a/Tangled/inweb.c b/Tangled/inweb.c index 1b7b452..d8b4584 100644 --- a/Tangled/inweb.c +++ b/Tangled/inweb.c @@ -3735,13 +3735,15 @@ void TextWeaver__commentary_text(heterogeneous_tree *tree, tree_node *ap, text_ void TextWeaver__comment_text_in_code(heterogeneous_tree *tree, tree_node *ap, text_stream *matter) ; #line 19 "inweb/Chapter 3/The Weaver of Text.w" void TextWeaver__commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stream *matter, int within, int in_code) ; -#line 182 "inweb/Chapter 3/The Weaver of Text.w" +#line 200 "inweb/Chapter 3/The Weaver of Text.w" +int TextWeaver__boundary_character(int before, wchar_t c) ; +#line 210 "inweb/Chapter 3/The Weaver of Text.w" void TextWeaver__commentary_fragment(heterogeneous_tree *tree, tree_node *ap, text_stream *fragment, int in_code) ; -#line 188 "inweb/Chapter 3/The Weaver of Text.w" +#line 216 "inweb/Chapter 3/The Weaver of Text.w" void TextWeaver__inline_code_fragment(heterogeneous_tree *tree, tree_node *ap, text_stream *fragment) ; -#line 201 "inweb/Chapter 3/The Weaver of Text.w" +#line 229 "inweb/Chapter 3/The Weaver of Text.w" void TextWeaver__source_code(heterogeneous_tree *tree, tree_node *ap, text_stream *matter, text_stream *colouring, int linked) ; -#line 305 "inweb/Chapter 3/The Weaver of Text.w" +#line 334 "inweb/Chapter 3/The Weaver of Text.w" void TextWeaver__source_code_piece(heterogeneous_tree *tree, tree_node *ap, text_stream *matter, text_stream *colouring, int from, int to) ; #line 14 "inweb/Chapter 3/The Tangler.w" void Tangler__tangle(web *W, tangle_target *target, filename *dest_file) ; @@ -4240,18 +4242,18 @@ pathname * Colonies__assets_path(void) ; #line 284 "inweb/Chapter 6/Colonies.w" pathname * Colonies__patterns_path(void) ; #line 310 "inweb/Chapter 6/Colonies.w" -int Colonies__resolve_reference_in_weave(text_stream *url, text_stream *title, filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L) ; -#line 325 "inweb/Chapter 6/Colonies.w" -int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *title, filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L) ; -#line 440 "inweb/Chapter 6/Colonies.w" +int Colonies__resolve_reference_in_weave(text_stream *url, text_stream *title, filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L, int *ext) ; +#line 327 "inweb/Chapter 6/Colonies.w" +int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *title, filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L, int *ext) ; +#line 454 "inweb/Chapter 6/Colonies.w" void Colonies__link_URL(OUTPUT_STREAM, text_stream *link_text, filename *F) ; -#line 449 "inweb/Chapter 6/Colonies.w" +#line 463 "inweb/Chapter 6/Colonies.w" void Colonies__reference_URL(OUTPUT_STREAM, text_stream *link_text, filename *F) ; -#line 460 "inweb/Chapter 6/Colonies.w" +#line 474 "inweb/Chapter 6/Colonies.w" void Colonies__section_URL(OUTPUT_STREAM, section_md *Sm) ; -#line 470 "inweb/Chapter 6/Colonies.w" +#line 484 "inweb/Chapter 6/Colonies.w" void Colonies__paragraph_URL(OUTPUT_STREAM, paragraph *P, filename *from) ; -#line 491 "inweb/Chapter 6/Colonies.w" +#line 505 "inweb/Chapter 6/Colonies.w" void Colonies__paragraph_anchor(OUTPUT_STREAM, paragraph *P) ; void register_tangled_nonterminals(void); text_stream *TL_IS_0 = NULL; @@ -20058,7 +20060,7 @@ void TextWeaver__commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre (in_code)?(TL_IS_257):(TL_IS_258)); if (Str__ne(code_in_comments_notation, TL_IS_259)) { -#line 52 "inweb/Chapter 3/The Weaver of Text.w" +#line 51 "inweb/Chapter 3/The Weaver of Text.w" for (int i=0; i < Str__len(matter); i++) { if (Str__get_at(matter, i) == '\\') i += Str__len(code_in_comments_notation) - 1; else if (Str__includes_at(matter, i, code_in_comments_notation)) { @@ -20079,9 +20081,140 @@ void TextWeaver__commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre #line 26 "inweb/Chapter 3/The Weaver of Text.w" ; - if (within == FALSE) + int display_flag = TRUE; + text_stream *tex_notation = Bibliographic__get_datum(wv->weave_web->md, + TL_IS_260); + if (Str__ne(tex_notation, TL_IS_261)) { -#line 69 "inweb/Chapter 3/The Weaver of Text.w" +#line 99 "inweb/Chapter 3/The Weaver of Text.w" + int N = Str__len(tex_notation); + for (int i=0; i < Str__len(matter); i++) { + if ((within == FALSE) && (Str__includes_at(matter, i, tex_notation))) { + int j = i + N; + while (j < Str__len(matter)) { + if (Str__includes_at(matter, j, tex_notation)) { + int allow = FALSE; + TEMPORARY_TEXT(before); + TEMPORARY_TEXT(maths); + TEMPORARY_TEXT(after); + Str__substr(before, Str__start(matter), Str__at(matter, i)); + Str__substr(maths, Str__at(matter, i + N), Str__at(matter, j)); + Str__substr(after, Str__at(matter, j + N), Str__end(matter)); + TextWeaver__commentary_r(tree, ap, before, within, in_code); + Trees__make_child(WeaveTree__mathematics(tree, maths, display_flag), ap); + TextWeaver__commentary_r(tree, ap, after, within, in_code); + allow = TRUE; + DISCARD_TEXT(before); + DISCARD_TEXT(maths); + DISCARD_TEXT(after); + if (allow) return; + } + j++; + } + } + } + +} +#line 31 "inweb/Chapter 3/The Weaver of Text.w" +; + display_flag = FALSE; + tex_notation = Bibliographic__get_datum(wv->weave_web->md, + TL_IS_262); + if (Str__ne(tex_notation, TL_IS_263)) +{ +#line 99 "inweb/Chapter 3/The Weaver of Text.w" + int N = Str__len(tex_notation); + for (int i=0; i < Str__len(matter); i++) { + if ((within == FALSE) && (Str__includes_at(matter, i, tex_notation))) { + int j = i + N; + while (j < Str__len(matter)) { + if (Str__includes_at(matter, j, tex_notation)) { + int allow = FALSE; + TEMPORARY_TEXT(before); + TEMPORARY_TEXT(maths); + TEMPORARY_TEXT(after); + Str__substr(before, Str__start(matter), Str__at(matter, i)); + Str__substr(maths, Str__at(matter, i + N), Str__at(matter, j)); + Str__substr(after, Str__at(matter, j + N), Str__end(matter)); + TextWeaver__commentary_r(tree, ap, before, within, in_code); + Trees__make_child(WeaveTree__mathematics(tree, maths, display_flag), ap); + TextWeaver__commentary_r(tree, ap, after, within, in_code); + allow = TRUE; + DISCARD_TEXT(before); + DISCARD_TEXT(maths); + DISCARD_TEXT(after); + if (allow) return; + } + j++; + } + } + } + +} +#line 35 "inweb/Chapter 3/The Weaver of Text.w" +; + + text_stream *xref_notation = Bibliographic__get_datum(wv->weave_web->md, + TL_IS_264); + if (Str__ne(xref_notation, TL_IS_265)) +{ +#line 150 "inweb/Chapter 3/The Weaver of Text.w" + int N = Str__len(xref_notation); + for (int i=0; i < Str__len(matter); i++) { + if ((within == FALSE) && (Str__includes_at(matter, i, xref_notation)) && + ((i == 0) || (TextWeaver__boundary_character(TRUE, + Str__get_at(matter, i-1))))) { + int j = i + N+1; + while (j < Str__len(matter)) { + if ((Str__includes_at(matter, j, xref_notation)) && + (TextWeaver__boundary_character(FALSE, + Str__get_at(matter, j+Str__len(xref_notation))))) { + int allow = FALSE; + TEMPORARY_TEXT(before); + TEMPORARY_TEXT(reference); + TEMPORARY_TEXT(after); + Str__substr(before, Str__start(matter), Str__at(matter, i)); + Str__substr(reference, Str__at(matter, i + N), Str__at(matter, j)); + Str__substr(after, Str__at(matter, j + N), Str__end(matter)); + +{ +#line 179 "inweb/Chapter 3/The Weaver of Text.w" + TEMPORARY_TEXT(url); + TEMPORARY_TEXT(title); + int ext = FALSE; + if (Colonies__resolve_reference_in_weave(url, title, wv->weave_to, reference, + wv->weave_web->md, wv->current_weave_line, &ext)) { + TextWeaver__commentary_r(tree, ap, before, within, in_code); + Trees__make_child(WeaveTree__url(tree, url, title, ext), ap); + TextWeaver__commentary_r(tree, ap, after, within, in_code); + allow = TRUE; + } + DISCARD_TEXT(url); + DISCARD_TEXT(title); + +} +#line 167 "inweb/Chapter 3/The Weaver of Text.w" +; + DISCARD_TEXT(before); + DISCARD_TEXT(reference); + DISCARD_TEXT(after); + if (allow) return; + } + j++; + } + } + } + +} +#line 39 "inweb/Chapter 3/The Weaver of Text.w" +; + + if (within) { + TextWeaver__inline_code_fragment(tree, ap, matter); + } else { + +{ +#line 68 "inweb/Chapter 3/The Weaver of Text.w" for (int i=0; i < Str__len(matter); i++) { if ((Str__includes_at(matter, i, TL_IS_266)) || (Str__includes_at(matter, i, TL_IS_267))) { @@ -20091,6 +20224,15 @@ void TextWeaver__commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre Str__substr(after, Str__at(matter, i), Str__end(matter)); match_results mr = Regexp__create_mr(); if (Regexp__match(&mr, after, L"(https*://%C+)(%c*)")) { + while (TextWeaver__boundary_character(FALSE, Str__get_last_char(mr.exp[0]))) { + wchar_t c = Str__get_last_char(mr.exp[0]); + Str__delete_last_character(mr.exp[0]); + TEMPORARY_TEXT(longer); + WRITE_TO(longer, "%c%S", c, mr.exp[1]); + Str__clear(mr.exp[1]); + Str__copy(mr.exp[1], longer); + DISCARD_TEXT(longer); + } TextWeaver__commentary_r(tree, ap, before, within, in_code); Trees__make_child(WeaveTree__url(tree, mr.exp[0], mr.exp[0], TRUE), ap); TextWeaver__commentary_r(tree, ap, mr.exp[1], within, in_code); @@ -20104,138 +20246,11 @@ void TextWeaver__commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre } } -#line 28 "inweb/Chapter 3/The Weaver of Text.w" +#line 44 "inweb/Chapter 3/The Weaver of Text.w" ; - - int display_flag = TRUE; - text_stream *tex_notation = Bibliographic__get_datum(wv->weave_web->md, - TL_IS_260); - if (Str__ne(tex_notation, TL_IS_261)) -{ -#line 91 "inweb/Chapter 3/The Weaver of Text.w" - int N = Str__len(tex_notation); - for (int i=0; i < Str__len(matter); i++) { - if ((within == FALSE) && (Str__includes_at(matter, i, tex_notation))) { - int j = i + N; - while (j < Str__len(matter)) { - if (Str__includes_at(matter, j, tex_notation)) { - int allow = FALSE; - TEMPORARY_TEXT(before); - TEMPORARY_TEXT(maths); - TEMPORARY_TEXT(after); - Str__substr(before, Str__start(matter), Str__at(matter, i)); - Str__substr(maths, Str__at(matter, i + N), Str__at(matter, j)); - Str__substr(after, Str__at(matter, j + N), Str__end(matter)); - TextWeaver__commentary_r(tree, ap, before, within, in_code); - Trees__make_child(WeaveTree__mathematics(tree, maths, display_flag), ap); - TextWeaver__commentary_r(tree, ap, after, within, in_code); - allow = TRUE; - DISCARD_TEXT(before); - DISCARD_TEXT(maths); - DISCARD_TEXT(after); - if (allow) return; - } - j++; - } - } - } - -} -#line 33 "inweb/Chapter 3/The Weaver of Text.w" -; - display_flag = FALSE; - tex_notation = Bibliographic__get_datum(wv->weave_web->md, - TL_IS_262); - if (Str__ne(tex_notation, TL_IS_263)) -{ -#line 91 "inweb/Chapter 3/The Weaver of Text.w" - int N = Str__len(tex_notation); - for (int i=0; i < Str__len(matter); i++) { - if ((within == FALSE) && (Str__includes_at(matter, i, tex_notation))) { - int j = i + N; - while (j < Str__len(matter)) { - if (Str__includes_at(matter, j, tex_notation)) { - int allow = FALSE; - TEMPORARY_TEXT(before); - TEMPORARY_TEXT(maths); - TEMPORARY_TEXT(after); - Str__substr(before, Str__start(matter), Str__at(matter, i)); - Str__substr(maths, Str__at(matter, i + N), Str__at(matter, j)); - Str__substr(after, Str__at(matter, j + N), Str__end(matter)); - TextWeaver__commentary_r(tree, ap, before, within, in_code); - Trees__make_child(WeaveTree__mathematics(tree, maths, display_flag), ap); - TextWeaver__commentary_r(tree, ap, after, within, in_code); - allow = TRUE; - DISCARD_TEXT(before); - DISCARD_TEXT(maths); - DISCARD_TEXT(after); - if (allow) return; - } - j++; - } - } - } - -} -#line 37 "inweb/Chapter 3/The Weaver of Text.w" -; - - text_stream *xref_notation = Bibliographic__get_datum(wv->weave_web->md, - TL_IS_264); - if (Str__ne(xref_notation, TL_IS_265)) -{ -#line 142 "inweb/Chapter 3/The Weaver of Text.w" - int N = Str__len(xref_notation); - for (int i=0; i < Str__len(matter); i++) { - if ((within == FALSE) && (Str__includes_at(matter, i, xref_notation))) { - int j = i + N+1; - while (j < Str__len(matter)) { - if (Str__includes_at(matter, j, xref_notation)) { - int allow = FALSE; - TEMPORARY_TEXT(before); - TEMPORARY_TEXT(reference); - TEMPORARY_TEXT(after); - Str__substr(before, Str__start(matter), Str__at(matter, i)); - Str__substr(reference, Str__at(matter, i + N), Str__at(matter, j)); - Str__substr(after, Str__at(matter, j + N), Str__end(matter)); - -{ -#line 167 "inweb/Chapter 3/The Weaver of Text.w" - TEMPORARY_TEXT(url); - TEMPORARY_TEXT(title); - if (Colonies__resolve_reference_in_weave(url, title, wv->weave_to, reference, - wv->weave_web->md, wv->current_weave_line)) { - TextWeaver__commentary_r(tree, ap, before, within, in_code); - Trees__make_child(WeaveTree__url(tree, url, title, FALSE), ap); - TextWeaver__commentary_r(tree, ap, after, within, in_code); - allow = TRUE; - } - DISCARD_TEXT(url); - DISCARD_TEXT(title); - -} -#line 155 "inweb/Chapter 3/The Weaver of Text.w" -; - DISCARD_TEXT(before); - DISCARD_TEXT(reference); - DISCARD_TEXT(after); - if (allow) return; - } - j++; - } - } - } - -} -#line 41 "inweb/Chapter 3/The Weaver of Text.w" -; - - if (within) { - TextWeaver__inline_code_fragment(tree, ap, matter); - } else { { -#line 119 "inweb/Chapter 3/The Weaver of Text.w" +#line 127 "inweb/Chapter 3/The Weaver of Text.w" TEMPORARY_TEXT(before); TEMPORARY_TEXT(cue); TEMPORARY_TEXT(after); @@ -20259,13 +20274,23 @@ void TextWeaver__commentary_r(heterogeneous_tree *tree, tree_node *ap, text_stre if (allow) return; } -#line 46 "inweb/Chapter 3/The Weaver of Text.w" +#line 45 "inweb/Chapter 3/The Weaver of Text.w" ; TextWeaver__commentary_fragment(tree, ap, matter, in_code); } } -#line 182 "inweb/Chapter 3/The Weaver of Text.w" +#line 200 "inweb/Chapter 3/The Weaver of Text.w" +int TextWeaver__boundary_character(int before, wchar_t c) { + if (c == 0) return TRUE; + if (Characters__is_whitespace(c)) return TRUE; + if ((c == '.') || (c == ',') || (c == '!') || (c == '?') || (c == ';') || + (c == '(')|| (c == ')')) return TRUE; + if ((before == FALSE) && (c == ':')) return TRUE; + return FALSE; +} + +#line 210 "inweb/Chapter 3/The Weaver of Text.w" void TextWeaver__commentary_fragment(heterogeneous_tree *tree, tree_node *ap, text_stream *fragment, int in_code) { if (Str__len(fragment) > 0) @@ -20282,7 +20307,7 @@ void TextWeaver__inline_code_fragment(heterogeneous_tree *tree, tree_node *ap, t Trees__make_child(SC, I); } -#line 201 "inweb/Chapter 3/The Weaver of Text.w" +#line 229 "inweb/Chapter 3/The Weaver of Text.w" void TextWeaver__source_code(heterogeneous_tree *tree, tree_node *ap, text_stream *matter, text_stream *colouring, int linked) { weave_document_node *C = RETRIEVE_POINTER_weave_document_node(tree->root->content); @@ -20293,7 +20318,7 @@ void TextWeaver__source_code(heterogeneous_tree *tree, tree_node *ap, if (linked) { { -#line 233 "inweb/Chapter 3/The Weaver of Text.w" +#line 261 "inweb/Chapter 3/The Weaver of Text.w" if ((Str__includes_at(matter, i, TL_IS_271)) || (Str__includes_at(matter, i, TL_IS_272))) { TEMPORARY_TEXT(after); @@ -20310,14 +20335,14 @@ void TextWeaver__source_code(heterogeneous_tree *tree, tree_node *ap, } } -#line 209 "inweb/Chapter 3/The Weaver of Text.w" +#line 237 "inweb/Chapter 3/The Weaver of Text.w" ; text_stream *xref_notation = Bibliographic__get_datum(wv->weave_web->md, TL_IS_269); if (Str__ne(xref_notation, TL_IS_270)) { -#line 249 "inweb/Chapter 3/The Weaver of Text.w" +#line 277 "inweb/Chapter 3/The Weaver of Text.w" int N = Str__len(xref_notation); if ((Str__includes_at(matter, i, xref_notation))) { int j = i + N+1; @@ -20327,12 +20352,13 @@ void TextWeaver__source_code(heterogeneous_tree *tree, tree_node *ap, Str__substr(reference, Str__at(matter, i + N), Str__at(matter, j)); { -#line 265 "inweb/Chapter 3/The Weaver of Text.w" +#line 293 "inweb/Chapter 3/The Weaver of Text.w" TEMPORARY_TEXT(url); TEMPORARY_TEXT(title); + int ext = FALSE; if (Colonies__resolve_reference_in_weave(url, title, wv->weave_to, reference, - wv->weave_web->md, wv->current_weave_line)) { - tree_node *U = WeaveTree__url(tree, url, title, FALSE); + wv->weave_web->md, wv->current_weave_line, &ext)) { + tree_node *U = WeaveTree__url(tree, url, title, ext); TextWeaver__source_code_piece(tree, ap, matter, colouring, from, i); Trees__make_child(U, ap); i = j + N; @@ -20342,7 +20368,7 @@ void TextWeaver__source_code(heterogeneous_tree *tree, tree_node *ap, DISCARD_TEXT(title); } -#line 256 "inweb/Chapter 3/The Weaver of Text.w" +#line 284 "inweb/Chapter 3/The Weaver of Text.w" ; DISCARD_TEXT(reference); break; @@ -20352,7 +20378,7 @@ void TextWeaver__source_code(heterogeneous_tree *tree, tree_node *ap, } } -#line 213 "inweb/Chapter 3/The Weaver of Text.w" +#line 241 "inweb/Chapter 3/The Weaver of Text.w" ; } if ((Str__get_at(colouring, i) == FUNCTION_COLOUR) && @@ -20365,7 +20391,7 @@ void TextWeaver__source_code(heterogeneous_tree *tree, tree_node *ap, wv->current_weave_line->owning_section, fname, FUNCTION_COLOUR)) { -#line 279 "inweb/Chapter 3/The Weaver of Text.w" +#line 308 "inweb/Chapter 3/The Weaver of Text.w" language_function *fn = Analyser__get_function( wv->current_weave_line->owning_section, fname, FUNCTION_COLOUR); if (fn) { @@ -20392,7 +20418,7 @@ void TextWeaver__source_code(heterogeneous_tree *tree, tree_node *ap, } } -#line 223 "inweb/Chapter 3/The Weaver of Text.w" +#line 251 "inweb/Chapter 3/The Weaver of Text.w" ; DISCARD_TEXT(fname); } @@ -20402,7 +20428,7 @@ void TextWeaver__source_code(heterogeneous_tree *tree, tree_node *ap, TextWeaver__source_code_piece(tree, ap, matter, colouring, from, Str__len(matter)); } -#line 305 "inweb/Chapter 3/The Weaver of Text.w" +#line 334 "inweb/Chapter 3/The Weaver of Text.w" void TextWeaver__source_code_piece(heterogeneous_tree *tree, tree_node *ap, text_stream *matter, text_stream *colouring, int from, int to) { if (to > from) { @@ -28712,22 +28738,24 @@ pathname *Colonies__patterns_path(void) { #line 310 "inweb/Chapter 6/Colonies.w" int Colonies__resolve_reference_in_weave(text_stream *url, text_stream *title, - filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L) { + filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L, int *ext) { int r = 0; + if (ext) *ext = FALSE; match_results mr = Regexp__create_mr(); if (Regexp__match(&mr, text, L"(%c+?) -> (%c+)")) { r = Colonies__resolve_reference_in_weave_inner(url, NULL, - for_HTML_file, mr.exp[1], Wm, L); + for_HTML_file, mr.exp[1], Wm, L, ext); WRITE_TO(title, "%S", mr.exp[0]); } else { r = Colonies__resolve_reference_in_weave_inner(url, title, - for_HTML_file, text, Wm, L); + for_HTML_file, text, Wm, L, ext); } Regexp__dispose_of(&mr); return r; } + int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *title, - filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L) { + filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L, int *ext) { module *from_M = (Wm)?(Wm->as_module):NULL; module *search_M = from_M; colony_member *search_CM = NULL; @@ -28735,7 +28763,23 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti { -#line 362 "inweb/Chapter 6/Colonies.w" +#line 365 "inweb/Chapter 6/Colonies.w" + match_results mr = Regexp__create_mr(); + if (Regexp__match(&mr, text, L"https*://%c*")) { + WRITE_TO(url, "%S", text); + WRITE_TO(title, "%S", text); + Regexp__dispose_of(&mr); + if (ext) *ext = TRUE; + return TRUE; + } + Regexp__dispose_of(&mr); + +} +#line 334 "inweb/Chapter 6/Colonies.w" +; + +{ +#line 376 "inweb/Chapter 6/Colonies.w" search_CM = Colonies__find(text); if (search_CM) { module *found_M = Colonies__as_module(search_CM, L, Wm); @@ -28744,11 +28788,11 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti WRITE_TO(title, "%S", search_CM->name); { -#line 409 "inweb/Chapter 6/Colonies.w" +#line 423 "inweb/Chapter 6/Colonies.w" if (found_M == NULL) internal_error("could not locate M"); if (search_CM) { -#line 415 "inweb/Chapter 6/Colonies.w" +#line 429 "inweb/Chapter 6/Colonies.w" pathname *from = Filenames__up(for_HTML_file); pathname *to = search_CM->weave_path; Pathnames__relative_URL(url, from, to); @@ -28758,11 +28802,11 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti WRITE_TO(title, " (in %S)", search_CM->name); } -#line 410 "inweb/Chapter 6/Colonies.w" +#line 424 "inweb/Chapter 6/Colonies.w" else { -#line 428 "inweb/Chapter 6/Colonies.w" +#line 442 "inweb/Chapter 6/Colonies.w" if (found_M == from_M) { Colonies__section_URL(url, found_Sm); } else { @@ -28773,21 +28817,21 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti } } -#line 411 "inweb/Chapter 6/Colonies.w" +#line 425 "inweb/Chapter 6/Colonies.w" ; return TRUE; } -#line 368 "inweb/Chapter 6/Colonies.w" +#line 382 "inweb/Chapter 6/Colonies.w" ; } } -#line 332 "inweb/Chapter 6/Colonies.w" +#line 335 "inweb/Chapter 6/Colonies.w" ; { -#line 372 "inweb/Chapter 6/Colonies.w" +#line 386 "inweb/Chapter 6/Colonies.w" match_results mr = Regexp__create_mr(); if (Regexp__match(&mr, text, L"(%c*?): (%c*)")) { search_CM = Colonies__find(mr.exp[0]); @@ -28803,7 +28847,7 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti Regexp__dispose_of(&mr); } -#line 333 "inweb/Chapter 6/Colonies.w" +#line 336 "inweb/Chapter 6/Colonies.w" ; module *found_M = NULL; @@ -28815,7 +28859,7 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti if ((L) && (external == FALSE)) { { -#line 387 "inweb/Chapter 6/Colonies.w" +#line 401 "inweb/Chapter 6/Colonies.w" language_function *fn; LOOP_OVER(fn, language_function) { if (Str__eq_insensitive(fn->function_name, text)) { @@ -28827,11 +28871,11 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti } } -#line 342 "inweb/Chapter 6/Colonies.w" +#line 345 "inweb/Chapter 6/Colonies.w" ; { -#line 398 "inweb/Chapter 6/Colonies.w" +#line 412 "inweb/Chapter 6/Colonies.w" language_type *str; LOOP_OVER(str, language_type) { if (Str__eq_insensitive(str->structure_name, text)) { @@ -28843,7 +28887,7 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti } } -#line 343 "inweb/Chapter 6/Colonies.w" +#line 346 "inweb/Chapter 6/Colonies.w" ; } TEMPORARY_TEXT(err); @@ -28859,11 +28903,11 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti } else { { -#line 409 "inweb/Chapter 6/Colonies.w" +#line 423 "inweb/Chapter 6/Colonies.w" if (found_M == NULL) internal_error("could not locate M"); if (search_CM) { -#line 415 "inweb/Chapter 6/Colonies.w" +#line 429 "inweb/Chapter 6/Colonies.w" pathname *from = Filenames__up(for_HTML_file); pathname *to = search_CM->weave_path; Pathnames__relative_URL(url, from, to); @@ -28873,11 +28917,11 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti WRITE_TO(title, " (in %S)", search_CM->name); } -#line 410 "inweb/Chapter 6/Colonies.w" +#line 424 "inweb/Chapter 6/Colonies.w" else { -#line 428 "inweb/Chapter 6/Colonies.w" +#line 442 "inweb/Chapter 6/Colonies.w" if (found_M == from_M) { Colonies__section_URL(url, found_Sm); } else { @@ -28888,18 +28932,18 @@ int Colonies__resolve_reference_in_weave_inner(text_stream *url, text_stream *ti } } -#line 411 "inweb/Chapter 6/Colonies.w" +#line 425 "inweb/Chapter 6/Colonies.w" ; return TRUE; } -#line 356 "inweb/Chapter 6/Colonies.w" +#line 359 "inweb/Chapter 6/Colonies.w" ; return TRUE; } } -#line 440 "inweb/Chapter 6/Colonies.w" +#line 454 "inweb/Chapter 6/Colonies.w" void Colonies__link_URL(OUTPUT_STREAM, text_stream *link_text, filename *F) { match_results mr = Regexp__create_mr(); if (Regexp__match(&mr, link_text, L" *//(%c+)// *")) @@ -28912,7 +28956,7 @@ void Colonies__link_URL(OUTPUT_STREAM, text_stream *link_text, filename *F) { void Colonies__reference_URL(OUTPUT_STREAM, text_stream *link_text, filename *F) { TEMPORARY_TEXT(title); TEMPORARY_TEXT(url); - if (Colonies__resolve_reference_in_weave(url, title, F, link_text, NULL, NULL)) + if (Colonies__resolve_reference_in_weave(url, title, F, link_text, NULL, NULL, NULL)) WRITE("%S", url); else PRINT("Warning: unable to resolve reference '%S' in navigation\n", link_text); diff --git a/docs/goldbach/S-sp.html b/docs/goldbach/S-sp.html index 4e0cb09..d41011f 100644 --- a/docs/goldbach/S-sp.html +++ b/docs/goldbach/S-sp.html @@ -86,7 +86,7 @@ said as late as the early twentieth century. of the great age of Enlightenment letter-writing. He and Euler exchanged scholarly letters for over thirty years, not something Euler would have kept up with a duffer. Goldbach was also not, as is sometimes said, a lawyer. -See: http://mathshistory.st-andrews.ac.uk/Biographies/Goldbach.html +See: http://mathshistory.st-andrews.ac.uk/Biographies/Goldbach.html. An edited transcription of the letter is at: http://eulerarchive.maa.org//correspondence/letters/OO0765.pdf

§2. Computer verification has been made up to around \(10^{18}\), but by rather diff --git a/docs/goldbach/goldbach-test.txt b/docs/goldbach/goldbach-test.txt index 26cba74..f52f0b2 100644 --- a/docs/goldbach/goldbach-test.txt +++ b/docs/goldbach/goldbach-test.txt @@ -42,7 +42,7 @@ document weave order 0 commentary commentary url content url - commentary <\n> + commentary <.\n> commentary url content url commentary <\n> diff --git a/docs/goldbach/goldbach.pdf b/docs/goldbach/goldbach.pdf index f607943..32015b9 100644 Binary files a/docs/goldbach/goldbach.pdf and b/docs/goldbach/goldbach.pdf differ diff --git a/docs/goldbach/goldbach.tex b/docs/goldbach/goldbach.tex index f873d0c..544b8f8 100644 --- a/docs/goldbach/goldbach.tex +++ b/docs/goldbach/goldbach.tex @@ -260,7 +260,7 @@ letter-writer, though his reputation stands less high today.\footnote{${}^{2}$}{ of the great age of Enlightenment letter-writing. He and Euler exchanged scholarly letters for over thirty years, not something Euler would have kept up with a duffer. Goldbach was also not, as is sometimes said, a lawyer. -See: http://mathshistory.st-andrews.ac.uk/Biographies/Goldbach.html +See: http://mathshistory.st-andrews.ac.uk/Biographies/Goldbach.html. An edited transcription of the letter is at: http://eulerarchive.maa.org//correspondence/letters/OO0765.pdf } All the same, the general belief now is that primes are just plentiful enough, and just diff --git a/docs/goldbach/goldbach.txt b/docs/goldbach/goldbach.txt index 72b117c..535deaf 100644 --- a/docs/goldbach/goldbach.txt +++ b/docs/goldbach/goldbach.txt @@ -30,7 +30,7 @@ said as late as the early twentieth century. of the great age of Enlightenment letter-writing. He and Euler exchanged scholarly letters for over thirty years, not something Euler would have kept up with a duffer. Goldbach was also not, as is sometimes said, a lawyer. -See: http://mathshistory.st-andrews.ac.uk/Biographies/Goldbach.html +See: http://mathshistory.st-andrews.ac.uk/Biographies/Goldbach.html. An edited transcription of the letter is at: http://eulerarchive.maa.org//correspondence/letters/OO0765.pdf S2. Computer verification has been made up to around 10^{18}, but by rather diff --git a/docs/inweb/3-ta.html b/docs/inweb/3-ta.html index b5517a3..6b06315 100644 --- a/docs/inweb/3-ta.html +++ b/docs/inweb/3-ta.html @@ -416,7 +416,7 @@ of each C function. return FALSE; } -int Analyser::is_reserved_word_for_section(section *S, text_stream *p, int e) { +int Analyser::is_reserved_word_for_section(section *S, text_stream *p, int e) { return Analyser::is_reserved_word(&(S->sect_target->symbols), p, e); } @@ -426,7 +426,7 @@ of each C function. return NULL; } -language_function *Analyser::get_function(section *S, text_stream *p, int e) { +language_function *Analyser::get_function(section *S, text_stream *p, int e) { hash_table_entry *hte = Analyser::find_hash_entry(&(S->sect_target->symbols), p, FALSE); if ((hte) && (hte->reserved_word & (1 << e))) return hte->as_function; return NULL; diff --git a/docs/inweb/3-tw.html b/docs/inweb/3-tw.html index aea4e6c..7b4b583 100644 --- a/docs/inweb/3-tw.html +++ b/docs/inweb/3-tw.html @@ -546,7 +546,7 @@ in the source is set indented in code style. for (int i=0; i<Str::len(original); i++) PUT_TO(colouring, PLAIN_COLOUR); tree_node *CL = WeaveTree::code_line(tree); Trees::make_child(CL, state->ap); - TextWeaver::source_code(tree, CL, original, colouring, L->enable_hyperlinks); + TextWeaver::source_code(tree, CL, original, colouring, L->enable_hyperlinks); DISCARD_TEXT(colouring); DISCARD_TEXT(original); Weaver::commentary_text(tree, wv, state->ap, matter); @@ -601,7 +601,7 @@ and macro usage is rendered differently. LanguageMethods::syntax_colour(S->sect_language, wv, L, matter, colouring); Find macro usages and adjust syntax colouring accordingly2.7.2.3.2.6; - TextWeaver::source_code(tree, CL, matter, colouring, L->enable_hyperlinks); + TextWeaver::source_code(tree, CL, matter, colouring, L->enable_hyperlinks); if (Str::len(concluding_comment) > 0) TextWeaver::comment_text_in_code(tree, CL, concluding_comment); @@ -726,7 +726,7 @@ otherwise, they are set flush right. if (pmac) { TEMPORARY_TEXT(front_colouring); Str::substr(front_colouring, Str::at(colouring, 0), Str::at(colouring, Str::len(mr.exp[0]))); - TextWeaver::source_code(tree, CL, mr.exp[0], front_colouring, L->enable_hyperlinks); + TextWeaver::source_code(tree, CL, mr.exp[0], front_colouring, L->enable_hyperlinks); DISCARD_TEXT(front_colouring); Str::copy(matter, mr.exp[2]); int N = Str::len(matter); @@ -867,7 +867,7 @@ structure usage, or how CWEB<

§4.

-void Weaver::show_function_usage(heterogeneous_tree *tree, weave_order *wv,
+void Weaver::show_function_usage(heterogeneous_tree *tree, weave_order *wv,
     tree_node *ap, paragraph *P, language_function *fn, int as_list) {
     tree_node *body = ap;
     fn->usage_described = TRUE;
diff --git a/docs/inweb/3-twot.html b/docs/inweb/3-twot.html
index 158ddda..8278cae 100644
--- a/docs/inweb/3-twot.html
+++ b/docs/inweb/3-twot.html
@@ -49,7 +49,7 @@ function togglePopup(material_id) {
     
 

To manage the weaving of commentary or source code text.

-
+

§1. Commentary text. The following takes text, divides it up at stroke-mark boundaries — that is, this is inside, this is outside — and sends contiguous pieces @@ -74,8 +74,6 @@ as appropriate. (in_code)?(I"Code In Code Comments Notation"):(I"Code In Commentary Notation")); if (Str::ne(code_in_comments_notation, I"Off")) Split text and code extracts1.1; - if (within == FALSE) Recognose hyperlinks1.2; - int display_flag = TRUE; text_stream *tex_notation = Bibliographic::get_datum(wv->weave_web->md, I"TeX Mathematics Displayed Notation"); @@ -90,10 +88,11 @@ as appropriate. if (Str::ne(xref_notation, I"Off")) Recognise cross-references1.5; if (within) { - TextWeaver::inline_code_fragment(tree, ap, matter); + TextWeaver::inline_code_fragment(tree, ap, matter); } else { + Recognise hyperlinks1.2; Detect use of footnotes1.4; - TextWeaver::commentary_fragment(tree, ap, matter, in_code); + TextWeaver::commentary_fragment(tree, ap, matter, in_code); } }

@@ -118,7 +117,7 @@ as appropriate. }
  • This code is used in §1.
-

§1.2. Recognose hyperlinks1.2 = +

§1.2. Recognise hyperlinks1.2 =

@@ -131,6 +130,15 @@ as appropriate.
             Str::substr(after, Str::at(matter, i), Str::end(matter));
             match_results mr = Regexp::create_mr();
             if (Regexp::match(&mr, after, L"(https*://%C+)(%c*)")) {
+                while (TextWeaver::boundary_character(FALSE, Str::get_last_char(mr.exp[0]))) {
+                    wchar_t c = Str::get_last_char(mr.exp[0]);
+                    Str::delete_last_character(mr.exp[0]);
+                    TEMPORARY_TEXT(longer);
+                    WRITE_TO(longer, "%c%S", c, mr.exp[1]);
+                    Str::clear(mr.exp[1]);
+                    Str::copy(mr.exp[1], longer);
+                    DISCARD_TEXT(longer);
+                }
                 TextWeaver::commentary_r(tree, ap, before, within, in_code);
                 Trees::make_child(WeaveTree::url(tree, mr.exp[0], mr.exp[0], TRUE), ap);
                 TextWeaver::commentary_r(tree, ap, mr.exp[1], within, in_code);
@@ -209,10 +217,14 @@ as appropriate.
 
     int N = Str::len(xref_notation);
     for (int i=0; i < Str::len(matter); i++) {
-        if ((within == FALSE) && (Str::includes_at(matter, i, xref_notation))) {
+        if ((within == FALSE) && (Str::includes_at(matter, i, xref_notation)) &&
+            ((i == 0) || (TextWeaver::boundary_character(TRUE,
+                Str::get_at(matter, i-1))))) {
             int j = i + N+1;
             while (j < Str::len(matter)) {
-                if (Str::includes_at(matter, j, xref_notation)) {
+                if ((Str::includes_at(matter, j, xref_notation)) &&
+                    (TextWeaver::boundary_character(FALSE,
+                        Str::get_at(matter, j+Str::len(xref_notation))))) {
                     int allow = FALSE;
                     TEMPORARY_TEXT(before);
                     TEMPORARY_TEXT(reference);
@@ -238,10 +250,11 @@ as appropriate.
 
     TEMPORARY_TEXT(url);
     TEMPORARY_TEXT(title);
+    int ext = FALSE;
     if (Colonies::resolve_reference_in_weave(url, title, wv->weave_to, reference,
-        wv->weave_web->md, wv->current_weave_line)) {
+        wv->weave_web->md, wv->current_weave_line, &ext)) {
         TextWeaver::commentary_r(tree, ap, before, within, in_code);
-        Trees::make_child(WeaveTree::url(tree, url, title, FALSE), ap);
+        Trees::make_child(WeaveTree::url(tree, url, title, ext), ap);
         TextWeaver::commentary_r(tree, ap, after, within, in_code);
         allow = TRUE;
     }
@@ -249,16 +262,35 @@ as appropriate.
     DISCARD_TEXT(title);
 
  • This code is used in §1.5.
-

§2.

+

§2. This tests whether a cross-reference is allowed to begin or end: it must +begin after and finish before a "boundary character". +

+ +

Note the one-sided treatment of :, which is a boundary after but not before, +so that http:// won't trigger a cross-reference with the standard // +xref notation. +

-void TextWeaver::commentary_fragment(heterogeneous_tree *tree, tree_node *ap,
+int TextWeaver::boundary_character(int before, wchar_t c) {
+    if (c == 0) return TRUE;
+    if (Characters::is_whitespace(c)) return TRUE;
+    if ((c == '.') || (c == ',') || (c == '!') || (c == '?') || (c == ';') ||
+        (c == '(')|| (c == ')')) return TRUE;
+    if ((before == FALSE) && (c == ':')) return TRUE;
+    return FALSE;
+}
+
+

§3.

+ +
+void TextWeaver::commentary_fragment(heterogeneous_tree *tree, tree_node *ap,
     text_stream *fragment, int in_code) {
     if (Str::len(fragment) > 0)
         Trees::make_child(WeaveTree::commentary(tree, fragment, in_code), ap);
 }
 
-void TextWeaver::inline_code_fragment(heterogeneous_tree *tree, tree_node *ap, text_stream *fragment) {
+void TextWeaver::inline_code_fragment(heterogeneous_tree *tree, tree_node *ap, text_stream *fragment) {
     tree_node *I = WeaveTree::inline(tree);
     Trees::make_child(I, ap);
     TEMPORARY_TEXT(colouring);
@@ -268,10 +300,10 @@ as appropriate.
     Trees::make_child(SC, I);
 }
 
-

§3. Code text.

+

§4. Code text.

-void TextWeaver::source_code(heterogeneous_tree *tree, tree_node *ap,
+void TextWeaver::source_code(heterogeneous_tree *tree, tree_node *ap,
     text_stream *matter, text_stream *colouring, int linked) {
     weave_document_node *C = RETRIEVE_POINTER_weave_document_node(tree->root->content);
     weave_order *wv = C->wv;
@@ -279,11 +311,11 @@ as appropriate.
     int from = 0;
     for (int i=0; i < Str::len(matter); i++) {
         if (linked) {
-            Pick up hyperlinking at the eleventh hour3.1;
+            Pick up hyperlinking at the eleventh hour4.1;
             text_stream *xref_notation = Bibliographic::get_datum(wv->weave_web->md,
                 I"Cross-References Notation");
             if (Str::ne(xref_notation, I"Off"))
-                Pick up cross-references at the eleventh hour3.2;
+                Pick up cross-references at the eleventh hour4.2;
         }
         if ((Str::get_at(colouring, i) == FUNCTION_COLOUR) &&
             (wv->current_weave_line->category != TEXT_EXTRACT_LCAT)) {
@@ -293,16 +325,16 @@ as appropriate.
                 PUT_TO(fname, Str::get_at(matter, j++));
             if (Analyser::is_reserved_word_for_section(
                 wv->current_weave_line->owning_section, fname, FUNCTION_COLOUR))
-                Spot the function3.3;
+                Spot the function4.3;
             DISCARD_TEXT(fname);
         }
 
     }
     if (from < Str::len(matter))
-        TextWeaver::source_code_piece(tree, ap, matter, colouring, from, Str::len(matter));
+        TextWeaver::source_code_piece(tree, ap, matter, colouring, from, Str::len(matter));
 }
 
-

§3.1. Pick up hyperlinking at the eleventh hour3.1 = +

§4.1. Pick up hyperlinking at the eleventh hour4.1 =

@@ -313,7 +345,7 @@ as appropriate.
         match_results mr = Regexp::create_mr();
         if (Regexp::match(&mr, after, L"(https*://%C+)(%c*)")) {
             tree_node *U = WeaveTree::url(tree, mr.exp[0], mr.exp[0], TRUE);
-            TextWeaver::source_code_piece(tree, ap, matter, colouring, from, i);
+            TextWeaver::source_code_piece(tree, ap, matter, colouring, from, i);
             Trees::make_child(U, ap);
             i += Str::len(mr.exp[0]);
             from = i;
@@ -321,8 +353,8 @@ as appropriate.
         DISCARD_TEXT(after);
     }
 
-
  • This code is used in §3.
-

§3.2. Pick up cross-references at the eleventh hour3.2 = +

  • This code is used in §4.
+

§4.2. Pick up cross-references at the eleventh hour4.2 =

@@ -333,7 +365,7 @@ as appropriate.
             if (Str::includes_at(matter, j, xref_notation)) {
                 TEMPORARY_TEXT(reference);
                 Str::substr(reference, Str::at(matter, i + N), Str::at(matter, j));
-                Attempt to resolve the cross-reference at the eleventh hour3.2.1;
+                Attempt to resolve the cross-reference at the eleventh hour4.2.1;
                 DISCARD_TEXT(reference);
                 break;
             }
@@ -341,17 +373,18 @@ as appropriate.
         }
     }
 
-
  • This code is used in §3.
-

§3.2.1. Attempt to resolve the cross-reference at the eleventh hour3.2.1 = +

  • This code is used in §4.
+

§4.2.1. Attempt to resolve the cross-reference at the eleventh hour4.2.1 =

     TEMPORARY_TEXT(url);
     TEMPORARY_TEXT(title);
+    int ext = FALSE;
     if (Colonies::resolve_reference_in_weave(url, title, wv->weave_to, reference,
-        wv->weave_web->md, wv->current_weave_line)) {
-        tree_node *U = WeaveTree::url(tree, url, title, FALSE);
-        TextWeaver::source_code_piece(tree, ap, matter, colouring, from, i);
+        wv->weave_web->md, wv->current_weave_line, &ext)) {
+        tree_node *U = WeaveTree::url(tree, url, title, ext);
+        TextWeaver::source_code_piece(tree, ap, matter, colouring, from, i);
         Trees::make_child(U, ap);
         i = j + N;
         from = i;
@@ -359,8 +392,8 @@ as appropriate.
     DISCARD_TEXT(url);
     DISCARD_TEXT(title);
 
-
  • This code is used in §3.2.
-

§3.3. Spot the function3.3 = +

  • This code is used in §4.2.
+

§4.3. Spot the function4.3 =

@@ -370,7 +403,7 @@ as appropriate.
         source_line *defn_line = fn->function_header_at;
         if (wv->current_weave_line == defn_line) {
             if (fn->usage_described == FALSE) {
-                TextWeaver::source_code_piece(tree, ap, matter, colouring, from, i);
+                TextWeaver::source_code_piece(tree, ap, matter, colouring, from, i);
                 tree_node *FD = WeaveTree::function_defn(tree, fn);
                 Trees::make_child(FD, ap);
                 Weaver::show_function_usage(tree, wv, FD,
@@ -379,7 +412,7 @@ as appropriate.
                 from = i+1;
             }
         } else {
-            TextWeaver::source_code_piece(tree, ap, matter, colouring, from, i);
+            TextWeaver::source_code_piece(tree, ap, matter, colouring, from, i);
             TEMPORARY_TEXT(url)
             Colonies::paragraph_URL(url, defn_line->owning_paragraph, wv->weave_to);
             tree_node *U = WeaveTree::function_usage(tree, url, fn);
@@ -389,11 +422,11 @@ as appropriate.
         }
     }
 
-
  • This code is used in §3.
-

§4.

+
  • This code is used in §4.
+

§5.

-void TextWeaver::source_code_piece(heterogeneous_tree *tree, tree_node *ap,
+void TextWeaver::source_code_piece(heterogeneous_tree *tree, tree_node *ap,
     text_stream *matter, text_stream *colouring, int from, int to) {
     if (to > from) {
         TEMPORARY_TEXT(m);
diff --git a/docs/inweb/5-wt.html b/docs/inweb/5-wt.html
index e0293e8..f34674d 100644
--- a/docs/inweb/5-wt.html
+++ b/docs/inweb/5-wt.html
@@ -632,7 +632,7 @@ information.
     return Trees::new_node(tree, weave_code_line_node_type, STORE_POINTER_weave_code_line_node(C));
 }
 
-tree_node *WeaveTree::function_usage(heterogeneous_tree *tree,
+tree_node *WeaveTree::function_usage(heterogeneous_tree *tree,
     text_stream *url, language_function *fn) {
     weave_function_usage_node *C = CREATE(weave_function_usage_node);
     C->url = Str::duplicate(url);
@@ -640,7 +640,7 @@ information.
     return Trees::new_node(tree, weave_function_usage_node_type, STORE_POINTER_weave_function_usage_node(C));
 }
 
-tree_node *WeaveTree::commentary(heterogeneous_tree *tree, text_stream *text, int in_code) {
+tree_node *WeaveTree::commentary(heterogeneous_tree *tree, text_stream *text, int in_code) {
     weave_commentary_node *C = CREATE(weave_commentary_node);
     C->text = Str::duplicate(text);
     C->in_code = in_code;
@@ -685,7 +685,7 @@ been syntax-coloured.
 

-tree_node *WeaveTree::source_code(heterogeneous_tree *tree,
+tree_node *WeaveTree::source_code(heterogeneous_tree *tree,
     text_stream *matter, text_stream *colouring) {
     if (Str::len(colouring) != Str::len(matter)) internal_error("bad source segment");
     for (int i=0; i<Str::len(colouring); i++)
@@ -696,7 +696,7 @@ been syntax-coloured.
     return Trees::new_node(tree, weave_source_code_node_type, STORE_POINTER_weave_source_code_node(C));
 }
 
-tree_node *WeaveTree::url(heterogeneous_tree *tree, text_stream *url,
+tree_node *WeaveTree::url(heterogeneous_tree *tree, text_stream *url,
     text_stream *content, int external) {
     weave_url_node *C = CREATE(weave_url_node);
     C->url = Str::duplicate(url);
@@ -722,7 +722,7 @@ definition has just occurred.
 

-tree_node *WeaveTree::function_defn(heterogeneous_tree *tree, language_function *fn) {
+tree_node *WeaveTree::function_defn(heterogeneous_tree *tree, language_function *fn) {
     weave_function_defn_node *C = CREATE(weave_function_defn_node);
     C->fn = fn;
     return Trees::new_node(tree, weave_function_defn_node_type, STORE_POINTER_weave_function_defn_node(C));
@@ -766,7 +766,7 @@ indentation but not weave any bracketed marker.
     return Trees::new_node(tree, weave_grammar_index_node_type, STORE_POINTER_weave_grammar_index_node(C));
 }
 
-tree_node *WeaveTree::inline(heterogeneous_tree *tree) {
+tree_node *WeaveTree::inline(heterogeneous_tree *tree) {
     weave_inline_node *C = CREATE(weave_inline_node);
     return Trees::new_node(tree, weave_inline_node_type, STORE_POINTER_weave_inline_node(C));
 }
diff --git a/docs/inweb/6-cln.html b/docs/inweb/6-cln.html
index a674c31..e5bf42f 100644
--- a/docs/inweb/6-cln.html
+++ b/docs/inweb/6-cln.html
@@ -296,7 +296,7 @@ first we find.
 

-colony_member *Colonies::find(text_stream *T) {
+colony_member *Colonies::find(text_stream *T) {
     colony *C;
     LOOP_OVER(C, colony) {
         colony_member *CM;
@@ -315,7 +315,7 @@ the data we already have; but if not, we read it in.
 

-module *Colonies::as_module(colony_member *CM, source_line *L, web_md *Wm) {
+module *Colonies::as_module(colony_member *CM, source_line *L, web_md *Wm) {
     if (CM->loaded == NULL) Perhaps the web being woven8.1;
     if (CM->loaded == NULL) Perhaps a module imported by the web being woven8.2;
     if (CM->loaded == NULL) Perhaps a module not yet seen8.3;
@@ -412,30 +412,33 @@ is where the reference is made from.
 

-int Colonies::resolve_reference_in_weave(text_stream *url, text_stream *title,
-    filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L) {
+int Colonies::resolve_reference_in_weave(text_stream *url, text_stream *title,
+    filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L, int *ext) {
     int r = 0;
+    if (ext) *ext = FALSE;
     match_results mr = Regexp::create_mr();
     if (Regexp::match(&mr, text, L"(%c+?) -> (%c+)")) {
         r = Colonies::resolve_reference_in_weave_inner(url, NULL,
-            for_HTML_file, mr.exp[1], Wm, L);
+            for_HTML_file, mr.exp[1], Wm, L, ext);
         WRITE_TO(title, "%S", mr.exp[0]);
     } else {
         r = Colonies::resolve_reference_in_weave_inner(url, title,
-            for_HTML_file, text, Wm, L);
+            for_HTML_file, text, Wm, L, ext);
     }
     Regexp::dispose_of(&mr);
     return r;
 }
+
 int Colonies::resolve_reference_in_weave_inner(text_stream *url, text_stream *title,
-    filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L) {
+    filename *for_HTML_file, text_stream *text, web_md *Wm, source_line *L, int *ext) {
     module *from_M = (Wm)?(Wm->as_module):NULL;
     module *search_M = from_M;
     colony_member *search_CM = NULL;
     int external = FALSE;
 
-    Is it the name of a member of our colony?10.1;
-    If it contains a colon, does this indicate a section in a colony member?10.2;
+    Is it an explicit URL?10.1;
+    Is it the name of a member of our colony?10.2;
+    If it contains a colon, does this indicate a section in a colony member?10.3;
 
     module *found_M = NULL;
     section_md *found_Sm = NULL;
@@ -444,8 +447,8 @@ is where the reference is made from.
         title, search_M, text, FALSE);
     if (N == 0) {
         if ((L) && (external == FALSE)) {
-            Is it the name of a function in the current web?10.3;
-            Is it the name of a type in the current web?10.4;
+            Is it the name of a function in the current web?10.4;
+            Is it the name of a type in the current web?10.5;
         }
         TEMPORARY_TEXT(err);
         WRITE_TO(err, "Can't find the cross-reference '%S'", text);
@@ -458,12 +461,27 @@ is where the reference is made from.
             title, search_M, text, TRUE);
         return FALSE;
     } else {
-        It refers unambiguously to a single section10.5;
+        It refers unambiguously to a single section10.6;
         return TRUE;
     }
 }
 
-

§10.1. Is it the name of a member of our colony?10.1 = +

§10.1. Is it an explicit URL?10.1 = +

+ +
+    match_results mr = Regexp::create_mr();
+    if (Regexp::match(&mr, text, L"https*://%c*")) {
+        WRITE_TO(url, "%S", text);
+        WRITE_TO(title, "%S", text);
+        Regexp::dispose_of(&mr);
+        if (ext) *ext = TRUE;
+        return TRUE;
+    }
+    Regexp::dispose_of(&mr);
+
+
  • This code is used in §10.
+

§10.2. Is it the name of a member of our colony?10.2 =

@@ -473,11 +491,11 @@ is where the reference is made from.
         section_md *found_Sm = FIRST_IN_LINKED_LIST(section_md, found_M->sections_md);
         int bare_module_name = TRUE;
         WRITE_TO(title, "%S", search_CM->name);
-        It refers unambiguously to a single section10.5;
+        It refers unambiguously to a single section10.6;
     }
 
  • This code is used in §10.
-

§10.2. If it contains a colon, does this indicate a section in a colony member?10.2 = +

§10.3. If it contains a colon, does this indicate a section in a colony member?10.3 =

@@ -496,7 +514,7 @@ is where the reference is made from.
     Regexp::dispose_of(&mr);
 
  • This code is used in §10.
-

§10.3. Is it the name of a function in the current web?10.3 = +

§10.4. Is it the name of a function in the current web?10.4 =

@@ -511,7 +529,7 @@ is where the reference is made from.
     }
 
  • This code is used in §10.
-

§10.4. Is it the name of a type in the current web?10.4 = +

§10.5. Is it the name of a type in the current web?10.5 =

@@ -526,17 +544,17 @@ is where the reference is made from.
     }
 
  • This code is used in §10.
-

§10.5. It refers unambiguously to a single section10.5 = +

§10.6. It refers unambiguously to a single section10.6 =

     if (found_M == NULL) internal_error("could not locate M");
-    if (search_CM) The section is a known colony member10.5.1
-    else The section is not in a known colony member10.5.2;
+    if (search_CM) The section is a known colony member10.6.1
+    else The section is not in a known colony member10.6.2;
     return TRUE;
 
- -

§10.5.1. The section is a known colony member10.5.1 = +

+

§10.6.1. The section is a known colony member10.6.1 =

@@ -548,13 +566,13 @@ is where the reference is made from.
     if (bare_module_name == FALSE)
         WRITE_TO(title, " (in %S)", search_CM->name);
 
- -

§10.5.2. In the absence of a colony file, Inweb can really only guess, and the +

+

§10.6.2. In the absence of a colony file, Inweb can really only guess, and the guess it makes is that modules of the current web will be woven alongside the main one, and suffixed by -module.

-

The section is not in a known colony member10.5.2 = +

The section is not in a known colony member10.6.2 =

@@ -567,7 +585,7 @@ the main one, and suffixed by             WRITE_TO(title, " (in %S)", found_M->module_name);
     }
 
- +

§11. URL management.

@@ -583,7 +601,7 @@ the main one, and suffixed by void Colonies::reference_URL(OUTPUT_STREAM, text_stream *link_text, filename *F) {
     TEMPORARY_TEXT(title);
     TEMPORARY_TEXT(url);
-    if (Colonies::resolve_reference_in_weave(url, title, F, link_text, NULL, NULL))
+    if (Colonies::resolve_reference_in_weave(url, title, F, link_text, NULL, NULL, NULL))
         WRITE("%S", url);
     else
         PRINT("Warning: unable to resolve reference '%S' in navigation\n", link_text);
@@ -591,7 +609,7 @@ the main one, and suffixed by     DISCARD_TEXT(url);
 }
 
-void Colonies::section_URL(OUTPUT_STREAM, section_md *Sm) {
+void Colonies::section_URL(OUTPUT_STREAM, section_md *Sm) {
     if (Sm == NULL) internal_error("unwoven section");
     LOOP_THROUGH_TEXT(pos, Sm->sect_range)
         if ((Str::get(pos) == '/') || (Str::get(pos) == ' '))
@@ -601,7 +619,7 @@ the main one, and suffixed by     WRITE(".html");
 }
 
-void Colonies::paragraph_URL(OUTPUT_STREAM, paragraph *P, filename *from) {
+void Colonies::paragraph_URL(OUTPUT_STREAM, paragraph *P, filename *from) {
     if (from == NULL) internal_error("no from file");
     if (P == NULL) internal_error("no para");
     section *to_S = P->under_section;
diff --git a/docs/inweb/M-htwaw.html b/docs/inweb/M-htwaw.html
index 9c5dd06..33462dc 100644
--- a/docs/inweb/M-htwaw.html
+++ b/docs/inweb/M-htwaw.html
@@ -62,7 +62,7 @@ MathJax = {
     
 

How to mark up code for literate programming.

-
+

§1. The title of a section. In any section file, there will be a few lines at the top which occur before the first paragraph of code begins. (The first paragraph begins on the first @@ -516,13 +516,15 @@ make them into links. For example:

-    For further reading, see: https://en.wikipedia.org/wiki/How_to_Avoid_Huge_Ships
+    For further reading, see: https://en.wikipedia.org/wiki/How_to_Avoid_Huge_Ships.
 
-

For further reading, see: https://en.wikipedia.org/wiki/How_to_Avoid_Huge_Ships +

For further reading, see: https://en.wikipedia.org/wiki/How_to_Avoid_Huge_Ships.

-

Note that URLs are considered to continue to the next white space, so don't -end them with full stops or commas. +

Note that URLs are considered to continue to the next white space, except +that any final full stops, question or exclamation marks, commas, brackets, +semicolons, or colons are disregarded. (This is why the above sentence ended +with a full stop and yet the full stop wasn't part of the reference URL.)

URLs will also be recognised in any text extract marked as hyperlinked. @@ -530,15 +532,15 @@ For example,

-    Compare: https://en.wikipedia.org/wiki/Crocheting_Adventures_with_Hyperbolic_Planes
+    Compare: https://en.wikipedia.org/wiki/Crocheting_Adventures_with_Hyperbolic_Planes!
 

produces:

-    Compare: https://en.wikipedia.org/wiki/Crocheting_Adventures_with_Hyperbolic_Planes
+    Compare: https://en.wikipedia.org/wiki/Crocheting_Adventures_with_Hyperbolic_Planes!
 
-

§14. Cross-references. These are like links, but internal. These are normally written within // +

§14. Cross-references. These are like links, but are internal. These are normally written within // signs and are only available in the commentary of a web. They allow us to place cross-references like so:

@@ -576,6 +578,14 @@ This is simple: for example,

produces: "First the program has to configure itself, then..."; the text "the program has to configure itself" links to Configuration. +This is especially useful if the destination is given as an explicit URL, which +is also allowed: +

+ +
+    See //this biographical note -> http://mathshistory.st-andrews.ac.uk/Biographies/Gauss.html//.
+
+

See this biographical note.

§16. It's also possible to reference function names and type names, provided that @@ -611,7 +621,11 @@ See Making Weaves into Websites.

     See the Manual for more on this.
 
-

This notation may be inconvenient if you need // for something else, but it +

§18. Cross-references must begin after white space, or a punctuation mark (other +than a colon), and must end to be followed by more white space or another +punctuation mark (this time allowing a colon). In practice, that reduces +the risk of misunderstanding a // occurring in the commentary for some +other reason. All the same, you might want a different notation, so this can be configured in the Contents page of a web, say like so:

@@ -624,7 +638,7 @@ can be configured in the Contents page of a web, say like so:
 Cross-References Notation: Off
 
-

§18. Figures. Images to be included in weaves of a web are called "Figures", as they +

§19. Figures. Images to be included in weaves of a web are called "Figures", as they would be in a printed book. These images should ideally be in PNG, JPG or PDF format and placed in a subdirectory of the web called Figures: for instance, the weaver would seek Fig_2_3.pdf at pathname Figures/Fig_2_3.pdf. @@ -657,7 +671,7 @@ correspond. If you really want to monkey with the aspect ratio,

     = (figure Whatever.jpg at 20 by 100)
 
-

§19. Carousels. A carousel is a slide-show of (usually but not always) figures; there's a +

§20. Carousels. A carousel is a slide-show of (usually but not always) figures; there's a set of slides with captions, only one of which is visible at a time.

@@ -770,7 +784,7 @@ it can also be above = (figure furtive.jpg) = (carousel end)
-

§20. Video and audio. To include audio samples, place them as MP3 files in the subdirectory Audio +

§21. Video and audio. To include audio samples, place them as MP3 files in the subdirectory Audio of the web. For example, in the present web,

@@ -796,7 +810,7 @@ Your browser does not support the audio element. takes up space, so for economy's sake a demonstration is omitted from this manual.

-

§21. Embedded video and audio. One way to get around such space limitations is to embed players for video or +

§22. Embedded video and audio. One way to get around such space limitations is to embed players for video or audio hosted on some external service. For example:

@@ -839,7 +853,7 @@ this case was https://youtu.b

-

§22. Adding width and height is straightforward; by default the dimensions are +

§23. Adding width and height is straightforward; by default the dimensions are 720 by 405.

@@ -851,7 +865,7 @@ this case was https://youtu.b arguably music has width and not height, but SoundCloud thinks otherwise).

-

§23. Mathematics notation. Literate programming is a good technique to justify code which hangs on +

§24. Mathematics notation. Literate programming is a good technique to justify code which hangs on unobvious pieces of mathematics or computer science, and which must therefore be explained carefully. Formulae or equations are a real convenience for that.

@@ -890,7 +904,7 @@ changed. The defaults are: treat it as any other text would be treated.

-

§24. Footnotes. Not everyone likes footnotes,1 but sometimes they're a tidy way to make +

§25. Footnotes. Not everyone likes footnotes,1 but sometimes they're a tidy way to make references.2

@@ -899,7 +913,7 @@ University Press, 1999).

  • 2 For example, to cite Donald Knuth, "Evaluation of Porter's constant", Computers & Mathematics with Applications, 2, 137-39 (1976).

  • -

    §25. The content of that sentence was typed as follows: +

    §26. The content of that sentence was typed as follows: