From ecf2c4b38ab25cf0e272ae81dcd9bb7ba833802b Mon Sep 17 00:00:00 2001 From: Graham Nelson Date: Wed, 6 May 2020 10:15:34 +0100 Subject: [PATCH] Completed downloads feature --- Chapter 2/The Parser.w | 10 + Chapter 3/The Collater.w | 8 + Chapter 3/The Weaver.w | 3 +- Chapter 5/Debugging Format.w | 2 +- Chapter 5/HTML Formats.w | 47 +- Chapter 5/Weave Tree.w | 4 +- Manual/Advanced Weaving with Patterns.w | 3 + Manual/How to Write a Web.w | 7 +- Patterns/HTML/Downloads/Downloads.css | 16 + Patterns/HTML/Downloads/download.png | Bin 0 -> 1085 bytes Patterns/HTML/Embedding/Download.html | 10 + Tangled/inweb.c | 2760 +++++++++-------- docs/docs-assets/Downloads.css | 16 + docs/docs-assets/download.png | Bin 0 -> 1085 bytes docs/foundation-module/1-pp.html | 14 +- docs/foundation-module/1-wp.html | 12 +- docs/foundation-module/3-fln.html | 14 +- docs/goldbach/goldbach.pdf | Bin 252026 -> 252026 bytes docs/inweb/1-pc.html | 2 +- docs/inweb/1-ptt.html | 2 +- docs/inweb/1-ts.html | 2 +- docs/inweb/2-tp.html | 10 + docs/inweb/3-tc.html | 58 +- docs/inweb/3-tw.html | 3 +- docs/inweb/5-df.html | 2 +- docs/inweb/5-hf.html | 51 +- docs/inweb/5-wt.html | 4 +- docs/inweb/6-cln.html | 8 +- docs/inweb/M-awwp.html | 3 + docs/inweb/M-htwaw.html | 18 +- foundation-module/Chapter 1/POSIX Platforms.w | 10 +- .../Chapter 1/Windows Platform.w | 10 +- foundation-module/Chapter 3/Filenames.w | 12 +- 33 files changed, 1709 insertions(+), 1412 deletions(-) create mode 100644 Patterns/HTML/Downloads/Downloads.css create mode 100644 Patterns/HTML/Downloads/download.png create mode 100644 Patterns/HTML/Embedding/Download.html create mode 100644 docs/docs-assets/Downloads.css create mode 100644 docs/docs-assets/download.png diff --git a/Chapter 2/The Parser.w b/Chapter 2/The Parser.w index bff05c4..a668a46 100644 --- a/Chapter 2/The Parser.w +++ b/Chapter 2/The Parser.w @@ -391,6 +391,15 @@ division in the current section. code_lcat_for_body = COMMENT_BODY_LCAT; L->text_operand = Str::duplicate(mr2.exp[0]); comment_mode = TRUE; + } else if ((current_paragraph) && + (Regexp::match(&mr2, mr.exp[0], L"%(download (%c+) \"(%c*)\"%)"))) { + Tags::add_by_name(L->owning_paragraph, I"Download"); + L->command_code = DOWNLOAD_CMD; + L->category = COMMAND_LCAT; + code_lcat_for_body = COMMENT_BODY_LCAT; + L->text_operand = Str::duplicate(mr2.exp[0]); + L->text_operand2 = Str::duplicate(mr2.exp[1]); + comment_mode = TRUE; } else if ((current_paragraph) && (Regexp::match(&mr2, mr.exp[0], L"%(download (%c+)%)"))) { Tags::add_by_name(L->owning_paragraph, I"Download"); @@ -398,6 +407,7 @@ division in the current section. L->category = COMMAND_LCAT; code_lcat_for_body = COMMENT_BODY_LCAT; L->text_operand = Str::duplicate(mr2.exp[0]); + L->text_operand2 = Str::new(); comment_mode = TRUE; } else if ((current_paragraph) && (Regexp::match(&mr2, mr.exp[0], L"%(carousel%)"))) { diff --git a/Chapter 3/The Collater.w b/Chapter 3/The Collater.w index cd4f4a1..280a0c8 100644 --- a/Chapter 3/The Collater.w +++ b/Chapter 3/The Collater.w @@ -495,6 +495,8 @@ used by the HTML renderer, would cause a modest-sized explosion on some pages. @; } else if (Regexp::match(&mr, varname, L"Docs")) { @; + } else if (Regexp::match(&mr, varname, L"Assets")) { + @; } else if (Regexp::match(&mr, varname, L"URL \"(%c+)\"")) { text_stream *link_text = mr.exp[0]; @; @@ -665,6 +667,12 @@ navigation purposes. Filenames::up(cls->into_file), Pathnames::from_text(Colonies::home())); +@ = + pathname *P = Colonies::assets_path(); + if (P == NULL) P = Filenames::up(cls->into_file); + Pathnames::relative_URL(substituted, + Filenames::up(cls->into_file), P); + @ = Pathnames::relative_URL(substituted, Filenames::up(cls->into_file), diff --git a/Chapter 3/The Weaver.w b/Chapter 3/The Weaver.w index a8b2f24..0518098 100644 --- a/Chapter 3/The Weaver.w +++ b/Chapter 3/The Weaver.w @@ -308,7 +308,8 @@ at us; but we don't weave them into the output, that's for sure. Trees::make_child(WeaveTree::video(tree, figname, w, h), state->ap); @ = - Trees::make_child(WeaveTree::download(tree, L->text_operand), state->ap); + Trees::make_child(WeaveTree::download(tree, L->text_operand, L->text_operand2), + state->ap); @ = int w, h; diff --git a/Chapter 5/Debugging Format.w b/Chapter 5/Debugging Format.w index 9977ada..13e63f1 100644 --- a/Chapter 5/Debugging Format.w +++ b/Chapter 5/Debugging Format.w @@ -157,7 +157,7 @@ int Debugging::render_visit(tree_node *N, void *state, int L) { @ = weave_download_node *C = RETRIEVE_POINTER_weave_download_node(N->content); - WRITE(" <%S>", C->download_name); + WRITE(" <%S> %S", C->download_name, C->filetype); @ = weave_material_node *C = RETRIEVE_POINTER_weave_material_node(N->content); diff --git a/Chapter 5/HTML Formats.w b/Chapter 5/HTML Formats.w index 0145da8..c36aca0 100644 --- a/Chapter 5/HTML Formats.w +++ b/Chapter 5/HTML Formats.w @@ -366,19 +366,40 @@ int HTMLFormat::render_visit(tree_node *N, void *state, int L) { filename *F = Filenames::in( Pathnames::down(hrs->wv->weave_web->md->path_to_web, I"Downloads"), C->download_name); - Assets::include_asset(OUT, hrs->copy_rule, hrs->wv->weave_web, F, NULL, - hrs->wv->pattern, hrs->wv->weave_to); - HTML_OPEN_WITH("p", "class=\"center-p\""); - WRITE("Download: "); - TEMPORARY_TEXT(url); - Pathnames::relative_URL(url, Filenames::up(hrs->wv->weave_to), Filenames::up(F)); - WRITE_TO(url, "%S", Filenames::get_leafname(F)); - HTML::begin_download_link(OUT, url); - WRITE("%S", C->download_name); - HTML::end_link(OUT); - DISCARD_TEXT(url); - HTML_CLOSE("p"); - WRITE("\n"); + filename *TF = Patterns::find_file_in_subdirectory(hrs->wv->pattern, I"Embedding", + I"Download.html"); + if (TF == NULL) { + Main::error_in_web(I"Downloads are not supported", hrs->wv->current_weave_line); + } else { + Swarm::ensure_plugin(hrs->wv, I"Downloads"); + Assets::include_asset(OUT, hrs->copy_rule, hrs->wv->weave_web, F, NULL, + hrs->wv->pattern, hrs->wv->weave_to); + TEMPORARY_TEXT(url); + TEMPORARY_TEXT(size); + Pathnames::relative_URL(url, Filenames::up(hrs->wv->weave_to), Filenames::up(F)); + WRITE_TO(url, "%S", Filenames::get_leafname(F)); + int N = Filenames::size(F); + if (N > 0) @ + else Main::error_in_web(I"Download file missing or empty", + hrs->wv->current_weave_line); + Bibliographic::set_datum(hrs->wv->weave_web->md, I"File Name", C->download_name); + Bibliographic::set_datum(hrs->wv->weave_web->md, I"File URL", url); + Bibliographic::set_datum(hrs->wv->weave_web->md, I"File Details", size); + Collater::for_web_and_pattern(OUT, hrs->wv->weave_web, hrs->wv->pattern, + TF, hrs->into_file); + WRITE("\n"); + DISCARD_TEXT(url); + DISCARD_TEXT(size); + } + +@ = + WRITE_TO(size, " ("); + if (Str::len(C->filetype) > 0) WRITE_TO(size, "%S, ", C->filetype); + if (N < 1024) WRITE_TO(size, "%d byte%s", N, (N!=1)?"s":""); + else if (N < 1024*1024) WRITE_TO(size, "%dkB", N/1024); + else if (N < 1024*1024*1024) WRITE_TO(size, "%dMB", N/1024/1024); + else WRITE_TO(size, "%dGB", N/1024/1024/1024); + WRITE_TO(size, ")"); @ = weave_material_node *C = RETRIEVE_POINTER_weave_material_node(N->content); diff --git a/Chapter 5/Weave Tree.w b/Chapter 5/Weave Tree.w index 72c3e8a..c56dadf 100644 --- a/Chapter 5/Weave Tree.w +++ b/Chapter 5/Weave Tree.w @@ -96,6 +96,7 @@ typedef struct weave_video_node { typedef struct weave_download_node { struct text_stream *download_name; + struct text_stream *filetype; MEMORY_MANAGEMENT } weave_download_node; @@ -534,9 +535,10 @@ tree_node *WeaveTree::video(heterogeneous_tree *tree, } tree_node *WeaveTree::download(heterogeneous_tree *tree, - text_stream *download_name) { + text_stream *download_name, text_stream *filetype) { weave_download_node *C = CREATE(weave_download_node); C->download_name = Str::duplicate(download_name); + C->filetype = Str::duplicate(filetype); return Trees::new_node(tree, weave_download_node_type, STORE_POINTER_weave_download_node(C)); } diff --git a/Manual/Advanced Weaving with Patterns.w b/Manual/Advanced Weaving with Patterns.w index 00a6661..c3fdd27 100644 --- a/Manual/Advanced Weaving with Patterns.w +++ b/Manual/Advanced Weaving with Patterns.w @@ -352,6 +352,9 @@ in BLOCK CAPITAL LETTERS. a colony of webs -- see //Making Weaves into Websites// for more, and for syntaxes to do with links and URLs. (b) |[[Breadcrumbs]]| expands to the HTML for the breadcrumb trail. +(c) |[[Docs]]| expands to the URL to the home page of a colony. +(d) |[[Assets]]| expands to the URL of the directory into which plugin +assets such as images are placed. @ The |template-index.html| file has access to additional placeholders enabling it to generate contents pages: diff --git a/Manual/How to Write a Web.w b/Manual/How to Write a Web.w index baa80d5..37a21a0 100644 --- a/Manual/How to Write a Web.w +++ b/Manual/How to Write a Web.w @@ -602,12 +602,13 @@ arguably music has width and not height, but SoundCloud thinks otherwise). Occasional small downloads may be useful as a way to present examples to try with a program being documented. These are very simple: = (text as Inweb) - = (download alice.crt) + = (download alice.crt "certificate file") = produces: -= (download alice.crt) += (download alice.crt "certificate file") The file to download, in this case |alice.crt|, must be placed in a |Downloads| -subdirectory of the web. +subdirectory of the web. The explanatory text -- usually just an indication +of what sort of file this is -- is optional. @h Mathematics notation. Literate programming is a good technique to justify code which hangs on diff --git a/Patterns/HTML/Downloads/Downloads.css b/Patterns/HTML/Downloads/Downloads.css new file mode 100644 index 0000000..c1b9f07 --- /dev/null +++ b/Patterns/HTML/Downloads/Downloads.css @@ -0,0 +1,16 @@ +div.download-container p { + text-align: center; +} + +div.download-container button.download-button { + background-color: DodgerBlue; + border: none; + color: white; + padding: 10px 24px; + cursor: pointer; + font-size: 18px; +} + +div.download-container button.download-button:hover { + background-color: RoyalBlue; +} diff --git a/Patterns/HTML/Downloads/download.png b/Patterns/HTML/Downloads/download.png new file mode 100644 index 0000000000000000000000000000000000000000..3834ae9212f376c15c032626f6bb1af1ac31bd78 GIT binary patch literal 1085 zcmaJ=Pe>F|7=N~~iMl}$k#=w#=@7X)GpoDnPHwu+thwdLvb&UY(Q)RfgU-Bh=IO2r zvRbF0Lw1QkMLN_igbo%(+9eADI~jN>sBTse2K_;{H|lDKwt<=VzK`GU_x;}czPX<0 zKJTfhsQ>_Y;+Ly_W(9)VUWn~y*sviz&Muh(QWSOQkH9}twNUUTEa7gRS zSumCBPAj=#C9Kk|=ctw}PXu&`Wh$$W7&f1c&^x+3**j^5rgk8BI7085>X8zZfGkJ_ ze5_YtgDe%~d|YEwC=_a-{4B>Zte@fhUM|Ep`gxY6_8yv4v(y1TDR%7DB2k1M!r0^) zCX>ndGL1fD4KiFf9CkGPelJ0I?Fj?RS+8N&7ZpTkE0$(r4H=Z9DEFf=9HEKR-6QDc zzN}&IT@$%5CM%l^=VP5C6@ilUf2gkSqivjo2Y&x4Y^Nto$RweS#w>+2ZlK;NW%7ar zWsIyeLL>*@QLMlK>vZ5JIyn~k{K5p1pHWU~aBQ#O)X`0IWg;+;W5P~5g z8sNBCG|aV!qe3$$iZOu;u)!i%M9P>B4P4}^2i#Cet}_a{Nh*ub(#E0MVIiH`IWn)6 z_R>^RZ;z{%_7W(`Wr!KZY3yH(E~d!zINSZPCBgpSLxW7aMaH`9zGt5N67ED-I<~#N zT__Y@POjY`nL{|)ohpD&OY8*_&BVoMI=iv?_W6-1s>=1|dm+D3`JxiTg}QrZ?@qe! zT&!xiH0u%1xZG7I*uI4d@d|QP*FC)kLF(t1)2~1NUTvPK-I|`S4cwZ2=h`wlzpZVQ zgZwiv6 +

+ + + +

+ diff --git a/Tangled/inweb.c b/Tangled/inweb.c index 4c778c4..7340f53 100644 --- a/Tangled/inweb.c +++ b/Tangled/inweb.c @@ -110,7 +110,7 @@ void Platform__where_am_i(wchar_t *p, size_t length) { #endif /* PLATFORM_MACOS */ #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 340 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 346 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" typedef pthread_t foundation_thread; typedef pthread_attr_t foundation_thread_attributes; @@ -207,7 +207,7 @@ typedef struct Win32_Thread_Attrs foundation_thread_attributes; #endif /* PLATFORM_WINDOWS */ #ifdef PLATFORM_WINDOWS -#line 250 "inweb/foundation-module/Chapter 1/Windows Platform.w" +#line 256 "inweb/foundation-module/Chapter 1/Windows Platform.w" struct Win32_Critical_Section { void* v1; long v2; long v3; long v4; long v5; void* v6; }; void __stdcall EnterCriticalSection(struct Win32_Critical_Section* cs); @@ -1676,7 +1676,7 @@ typedef struct source_line { struct source_line *next_line; /* within the owning section's linked list */ struct paragraph *owning_paragraph; /* for lines falling under paragraphs; |NULL| if not */ } source_line; -#line 722 "inweb/Chapter 2/The Parser.w" +#line 732 "inweb/Chapter 2/The Parser.w" typedef struct paragraph { int above_bar; /* placed above the dividing bar in its section (in Version 1 syntax) */ int placed_early; /* should appear early in the tangled code */ @@ -1699,7 +1699,7 @@ typedef struct paragraph { struct section *under_section; MEMORY_MANAGEMENT } paragraph; -#line 833 "inweb/Chapter 2/The Parser.w" +#line 843 "inweb/Chapter 2/The Parser.w" typedef struct footnote { int footnote_cue_number; /* used only for |FOOTNOTE_TEXT_LCAT| lines */ int footnote_text_number; /* used only for |FOOTNOTE_TEXT_LCAT| lines */ @@ -2037,16 +2037,17 @@ typedef struct weave_video_node { #line 97 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_download_node { struct text_stream *download_name; + struct text_stream *filetype; MEMORY_MANAGEMENT } weave_download_node; -#line 102 "inweb/Chapter 5/Weave Tree.w" +#line 103 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_material_node { int material_type; int plainly; struct programming_language *styling; MEMORY_MANAGEMENT } weave_material_node; -#line 109 "inweb/Chapter 5/Weave Tree.w" +#line 110 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_embed_node { struct text_stream *service; struct text_stream *ID; @@ -2054,130 +2055,130 @@ typedef struct weave_embed_node { int h; MEMORY_MANAGEMENT } weave_embed_node; -#line 117 "inweb/Chapter 5/Weave Tree.w" +#line 118 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_pmac_node { struct para_macro *pmac; int defn; MEMORY_MANAGEMENT } weave_pmac_node; -#line 123 "inweb/Chapter 5/Weave Tree.w" +#line 124 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_vskip_node { int in_comment; MEMORY_MANAGEMENT } weave_vskip_node; -#line 128 "inweb/Chapter 5/Weave Tree.w" +#line 129 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_chapter_node { struct chapter *chap; MEMORY_MANAGEMENT } weave_chapter_node; -#line 133 "inweb/Chapter 5/Weave Tree.w" +#line 134 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_section_node { struct section *sect; MEMORY_MANAGEMENT } weave_section_node; -#line 138 "inweb/Chapter 5/Weave Tree.w" +#line 139 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_code_line_node { MEMORY_MANAGEMENT } weave_code_line_node; -#line 142 "inweb/Chapter 5/Weave Tree.w" +#line 143 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_function_usage_node { struct text_stream *url; struct language_function *fn; MEMORY_MANAGEMENT } weave_function_usage_node; -#line 148 "inweb/Chapter 5/Weave Tree.w" +#line 149 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_commentary_node { struct text_stream *text; int in_code; MEMORY_MANAGEMENT } weave_commentary_node; -#line 154 "inweb/Chapter 5/Weave Tree.w" +#line 155 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_carousel_slide_node { struct text_stream *caption; int caption_command; MEMORY_MANAGEMENT } weave_carousel_slide_node; -#line 160 "inweb/Chapter 5/Weave Tree.w" +#line 161 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_toc_node { struct text_stream *text1; MEMORY_MANAGEMENT } weave_toc_node; -#line 165 "inweb/Chapter 5/Weave Tree.w" +#line 166 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_toc_line_node { struct text_stream *text1; struct text_stream *text2; struct paragraph *para; MEMORY_MANAGEMENT } weave_toc_line_node; -#line 172 "inweb/Chapter 5/Weave Tree.w" +#line 173 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_chapter_title_page_node { MEMORY_MANAGEMENT } weave_chapter_title_page_node; -#line 176 "inweb/Chapter 5/Weave Tree.w" +#line 177 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_defn_node { struct text_stream *keyword; MEMORY_MANAGEMENT } weave_defn_node; -#line 181 "inweb/Chapter 5/Weave Tree.w" +#line 182 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_inline_node { MEMORY_MANAGEMENT } weave_inline_node; -#line 185 "inweb/Chapter 5/Weave Tree.w" +#line 186 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_locale_node { struct paragraph *par1; struct paragraph *par2; MEMORY_MANAGEMENT } weave_locale_node; -#line 191 "inweb/Chapter 5/Weave Tree.w" +#line 192 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_source_code_node { struct text_stream *matter; struct text_stream *colouring; MEMORY_MANAGEMENT } weave_source_code_node; -#line 197 "inweb/Chapter 5/Weave Tree.w" +#line 198 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_url_node { struct text_stream *url; struct text_stream *content; int external; MEMORY_MANAGEMENT } weave_url_node; -#line 204 "inweb/Chapter 5/Weave Tree.w" +#line 205 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_footnote_cue_node { struct text_stream *cue_text; MEMORY_MANAGEMENT } weave_footnote_cue_node; -#line 209 "inweb/Chapter 5/Weave Tree.w" +#line 210 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_begin_footnote_text_node { struct text_stream *cue_text; MEMORY_MANAGEMENT } weave_begin_footnote_text_node; -#line 214 "inweb/Chapter 5/Weave Tree.w" +#line 215 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_display_line_node { struct text_stream *text; MEMORY_MANAGEMENT } weave_display_line_node; -#line 219 "inweb/Chapter 5/Weave Tree.w" +#line 220 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_function_defn_node { struct language_function *fn; MEMORY_MANAGEMENT } weave_function_defn_node; -#line 224 "inweb/Chapter 5/Weave Tree.w" +#line 225 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_item_node { int depth; struct text_stream *label; MEMORY_MANAGEMENT } weave_item_node; -#line 230 "inweb/Chapter 5/Weave Tree.w" +#line 231 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_grammar_index_node { MEMORY_MANAGEMENT } weave_grammar_index_node; -#line 234 "inweb/Chapter 5/Weave Tree.w" +#line 235 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_maths_node { struct text_stream *content; int displayed; MEMORY_MANAGEMENT } weave_maths_node; -#line 240 "inweb/Chapter 5/Weave Tree.w" +#line 241 "inweb/Chapter 5/Weave Tree.w" typedef struct weave_verbatim_node { struct text_stream *content; MEMORY_MANAGEMENT @@ -2383,43 +2384,47 @@ time_t Platform__never_time(void) ; time_t Platform__timestamp(char *transcoded_filename) ; #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 280 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 272 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +off_t Platform__size(char *transcoded_filename) ; +#endif /* PLATFORM_POSIX */ +#ifdef PLATFORM_POSIX +#line 286 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" void Platform__rsync(char *transcoded_source, char *transcoded_dest) ; #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 289 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 295 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" void Platform__quote_text(char *quoted, char *raw, int terminate) ; #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 305 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 311 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" void Platform__sleep(int seconds) ; #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_MACOS #ifdef PLATFORM_POSIX -#line 321 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 327 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" void Platform__notification(text_stream *text, int happy) ; #endif /* PLATFORM_MACOS */ #endif /* PLATFORM_POSIX */ #ifndef PLATFORM_MACOS #ifdef PLATFORM_POSIX -#line 334 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 340 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" void Platform__notification(text_stream *text, int happy) ; #endif /* PLATFORM_MACOS */ #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 346 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 352 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" int Platform__create_thread(foundation_thread *pt, const foundation_thread_attributes *pa, void *(*fn)(void *), void *arg) ; #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 351 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 357 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" int Platform__join_thread(pthread_t pt, void** rv) ; #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 355 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 361 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" void Platform__init_thread(pthread_attr_t* pa, size_t size) ; #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 360 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 366 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" size_t Platform__get_thread_stack_size(pthread_attr_t* pa) ; #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_WINDOWS @@ -2478,6 +2483,10 @@ time_t Platform__never_time(void) ; #line 236 "inweb/foundation-module/Chapter 1/Windows Platform.w" time_t Platform__timestamp(char *transcoded_filename) ; #endif /* PLATFORM_WINDOWS */ +#ifdef PLATFORM_WINDOWS +#line 242 "inweb/foundation-module/Chapter 1/Windows Platform.w" +off_t Platform__size(char *transcoded_filename) ; +#endif /* PLATFORM_WINDOWS */ #line 64 "inweb/foundation-module/Chapter 2/Debugging Log.w" void Log__declare_aspect(int a, wchar_t *name, int def, int alt) ; #line 111 "inweb/foundation-module/Chapter 2/Debugging Log.w" @@ -2898,6 +2907,8 @@ FILE * Filenames__fopen_caseless(filename *F, char *usage) ; int Filenames__eq(filename *F1, filename *F2) ; #line 266 "inweb/foundation-module/Chapter 3/Filenames.w" time_t Filenames__timestamp(filename *F) ; +#line 276 "inweb/foundation-module/Chapter 3/Filenames.w" +int Filenames__size(filename *F) ; #ifdef PLATFORM_POSIX #line 50 "inweb/foundation-module/Chapter 3/Case-Insensitive Filenames.w" FILE * CIFilingSystem__fopen(const char *path, const char *mode) ; @@ -3628,13 +3639,13 @@ source_line * Lines__new_source_line_in(text_stream *line, text_file_position *t char * Lines__category_name(int cat) ; #line 17 "inweb/Chapter 2/The Parser.w" void Parser__parse_web(web *W, int inweb_mode) ; -#line 815 "inweb/Chapter 2/The Parser.w" +#line 825 "inweb/Chapter 2/The Parser.w" text_stream * Parser__extract_purpose(text_stream *prologue, source_line *XL, section *S, source_line **adjust) ; -#line 887 "inweb/Chapter 2/The Parser.w" +#line 897 "inweb/Chapter 2/The Parser.w" int Parser__detect_footnote(web *W, text_stream *matter, text_stream *before, text_stream *cue, text_stream *after) ; -#line 930 "inweb/Chapter 2/The Parser.w" +#line 940 "inweb/Chapter 2/The Parser.w" footnote * Parser__find_footnote_in_para(paragraph *P, text_stream *cue) ; -#line 946 "inweb/Chapter 2/The Parser.w" +#line 956 "inweb/Chapter 2/The Parser.w" void Parser__wrong_version(int using, source_line *L, char *feature, int need) ; #line 20 "inweb/Chapter 2/Paragraph Macros.w" para_macro * Macros__create(section *S, paragraph *P, source_line *L, text_stream *name) ; @@ -3718,35 +3729,35 @@ linked_list_item * Collater__heading_topmost_on_stack(collater_state *cls, int l void Collater__start_CI_loop(collater_state *cls, int level, linked_list_item *from, linked_list_item *to, int pos) ; #line 450 "inweb/Chapter 3/The Collater.w" void Collater__end_CI_loop(collater_state *cls) ; -#line 742 "inweb/Chapter 3/The Collater.w" +#line 750 "inweb/Chapter 3/The Collater.w" text_stream * Collater__module_owner(const module *M, web *W) ; -#line 758 "inweb/Chapter 3/The Collater.w" +#line 766 "inweb/Chapter 3/The Collater.w" void Collater__sort_web(web *W) ; -#line 761 "inweb/Chapter 3/The Collater.w" +#line 769 "inweb/Chapter 3/The Collater.w" int Collater__sort_comparison(const void *ent1, const void *ent2) ; -#line 771 "inweb/Chapter 3/The Collater.w" +#line 779 "inweb/Chapter 3/The Collater.w" int Collater__cmp_owners(text_stream *O1, text_stream *O2) ; #line 16 "inweb/Chapter 3/The Weaver.w" int Weaver__weave(weave_order *wv) ; #line 42 "inweb/Chapter 3/The Weaver.w" int Weaver__weave_inner(weave_order *wv, heterogeneous_tree *tree, tree_node *body) ; -#line 576 "inweb/Chapter 3/The Weaver.w" +#line 577 "inweb/Chapter 3/The Weaver.w" void Weaver__show_endnotes_on_previous_paragraph(heterogeneous_tree *tree, weave_order *wv, tree_node *ap, paragraph *P) ; -#line 674 "inweb/Chapter 3/The Weaver.w" +#line 675 "inweb/Chapter 3/The Weaver.w" void Weaver__show_function_usage(heterogeneous_tree *tree, weave_order *wv, tree_node *ap, paragraph *P, language_function *fn, int as_list) ; -#line 739 "inweb/Chapter 3/The Weaver.w" +#line 740 "inweb/Chapter 3/The Weaver.w" void Weaver__weave_subheading(heterogeneous_tree *tree, weave_order *wv, tree_node *ap, text_stream *text) ; -#line 745 "inweb/Chapter 3/The Weaver.w" +#line 746 "inweb/Chapter 3/The Weaver.w" void Weaver__change_material(heterogeneous_tree *tree, weaver_state *state, int new_material, int plainly, programming_language *pl) ; -#line 757 "inweb/Chapter 3/The Weaver.w" +#line 758 "inweb/Chapter 3/The Weaver.w" void Weaver__change_material_for_para(heterogeneous_tree *tree, weaver_state *state) ; -#line 765 "inweb/Chapter 3/The Weaver.w" +#line 766 "inweb/Chapter 3/The Weaver.w" void Weaver__figure(heterogeneous_tree *tree, weave_order *wv, tree_node *ap, text_stream *figname, int w, int h) ; -#line 771 "inweb/Chapter 3/The Weaver.w" +#line 772 "inweb/Chapter 3/The Weaver.w" void Weaver__commentary_text(heterogeneous_tree *tree, weave_order *wv, tree_node *ap, text_stream *matter) ; -#line 781 "inweb/Chapter 3/The Weaver.w" +#line 782 "inweb/Chapter 3/The Weaver.w" text_stream * Weaver__dimensions(text_stream *item, int *w, int *h, source_line *L) ; -#line 828 "inweb/Chapter 3/The Weaver.w" +#line 829 "inweb/Chapter 3/The Weaver.w" int Weaver__weave_table_of_contents(heterogeneous_tree *tree, tree_node *ap, section *S) ; #line 12 "inweb/Chapter 3/The Weaver of Text.w" void TextWeaver__commentary_text(heterogeneous_tree *tree, tree_node *ap, text_stream *matter) ; @@ -4004,103 +4015,103 @@ void InCSupport__new_tag_declared(programming_language *self, theme_tag *tag) ; void InCSupport__analyse_code(programming_language *self, web *W) ; #line 968 "inweb/Chapter 4/InC Support.w" int InCSupport__share_element(programming_language *self, text_stream *elname) ; -#line 293 "inweb/Chapter 5/Weave Tree.w" +#line 294 "inweb/Chapter 5/Weave Tree.w" heterogeneous_tree * WeaveTree__new_tree(weave_order *wv) ; -#line 394 "inweb/Chapter 5/Weave Tree.w" +#line 395 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__document(heterogeneous_tree *tree, weave_order *wv) ; -#line 401 "inweb/Chapter 5/Weave Tree.w" +#line 402 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__head(heterogeneous_tree *tree, text_stream *banner) ; -#line 408 "inweb/Chapter 5/Weave Tree.w" +#line 409 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__body(heterogeneous_tree *tree) ; -#line 414 "inweb/Chapter 5/Weave Tree.w" +#line 415 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__tail(heterogeneous_tree *tree, text_stream *rennab) ; -#line 421 "inweb/Chapter 5/Weave Tree.w" +#line 422 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__verbatim(heterogeneous_tree *tree, text_stream *content) ; -#line 428 "inweb/Chapter 5/Weave Tree.w" +#line 429 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__section_header(heterogeneous_tree *tree, section *S) ; -#line 435 "inweb/Chapter 5/Weave Tree.w" +#line 436 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__section_footer(heterogeneous_tree *tree, section *S) ; -#line 442 "inweb/Chapter 5/Weave Tree.w" +#line 443 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__chapter(heterogeneous_tree *tree, chapter *Ch) ; -#line 448 "inweb/Chapter 5/Weave Tree.w" +#line 449 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__chapter_header(heterogeneous_tree *tree, chapter *Ch) ; -#line 455 "inweb/Chapter 5/Weave Tree.w" +#line 456 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__chapter_footer(heterogeneous_tree *tree, chapter *Ch) ; -#line 462 "inweb/Chapter 5/Weave Tree.w" +#line 463 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__purpose(heterogeneous_tree *tree, text_stream *P) ; -#line 469 "inweb/Chapter 5/Weave Tree.w" +#line 470 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__subheading(heterogeneous_tree *tree, text_stream *P) ; -#line 476 "inweb/Chapter 5/Weave Tree.w" +#line 477 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__pagebreak(heterogeneous_tree *tree) ; -#line 482 "inweb/Chapter 5/Weave Tree.w" +#line 483 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__linebreak(heterogeneous_tree *tree) ; -#line 488 "inweb/Chapter 5/Weave Tree.w" +#line 489 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__bar(heterogeneous_tree *tree) ; -#line 494 "inweb/Chapter 5/Weave Tree.w" +#line 495 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__paragraph_heading(heterogeneous_tree *tree, paragraph *P, int no_skip) ; -#line 502 "inweb/Chapter 5/Weave Tree.w" +#line 503 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__endnote(heterogeneous_tree *tree) ; -#line 508 "inweb/Chapter 5/Weave Tree.w" +#line 509 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__figure(heterogeneous_tree *tree, text_stream *figname, int w, int h) ; -#line 518 "inweb/Chapter 5/Weave Tree.w" +#line 519 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__audio(heterogeneous_tree *tree, text_stream *audio_name, int w) ; -#line 527 "inweb/Chapter 5/Weave Tree.w" +#line 528 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__video(heterogeneous_tree *tree, text_stream *video_name, int w, int h) ; -#line 536 "inweb/Chapter 5/Weave Tree.w" -tree_node * WeaveTree__download(heterogeneous_tree *tree, text_stream *download_name) ; -#line 544 "inweb/Chapter 5/Weave Tree.w" +#line 537 "inweb/Chapter 5/Weave Tree.w" +tree_node * WeaveTree__download(heterogeneous_tree *tree, text_stream *download_name, text_stream *filetype) ; +#line 546 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__material(heterogeneous_tree *tree, int material_type, int plainly, programming_language *styling) ; -#line 553 "inweb/Chapter 5/Weave Tree.w" +#line 555 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__embed(heterogeneous_tree *tree, text_stream *service, text_stream *ID, int w, int h) ; -#line 568 "inweb/Chapter 5/Weave Tree.w" +#line 570 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__pmac(heterogeneous_tree *tree, para_macro *pmac, int defn) ; -#line 580 "inweb/Chapter 5/Weave Tree.w" +#line 582 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__vskip(heterogeneous_tree *tree, int in_comment) ; -#line 586 "inweb/Chapter 5/Weave Tree.w" +#line 588 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__section(heterogeneous_tree *tree, section *sect) ; -#line 592 "inweb/Chapter 5/Weave Tree.w" +#line 594 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__code_line(heterogeneous_tree *tree) ; -#line 597 "inweb/Chapter 5/Weave Tree.w" +#line 599 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__function_usage(heterogeneous_tree *tree, text_stream *url, language_function *fn) ; -#line 605 "inweb/Chapter 5/Weave Tree.w" +#line 607 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__commentary(heterogeneous_tree *tree, text_stream *text, int in_code) ; -#line 612 "inweb/Chapter 5/Weave Tree.w" +#line 614 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__carousel_slide(heterogeneous_tree *tree, text_stream *caption, int c) ; -#line 619 "inweb/Chapter 5/Weave Tree.w" +#line 621 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__table_of_contents(heterogeneous_tree *tree, text_stream *text1) ; -#line 625 "inweb/Chapter 5/Weave Tree.w" +#line 627 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__contents_line(heterogeneous_tree *tree, text_stream *text1, text_stream *text2, paragraph *P) ; -#line 634 "inweb/Chapter 5/Weave Tree.w" +#line 636 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__weave_chapter_title_page_node(heterogeneous_tree *tree) ; -#line 639 "inweb/Chapter 5/Weave Tree.w" +#line 641 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__weave_defn_node(heterogeneous_tree *tree, text_stream *keyword) ; -#line 649 "inweb/Chapter 5/Weave Tree.w" +#line 651 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__source_code(heterogeneous_tree *tree, text_stream *matter, text_stream *colouring) ; -#line 660 "inweb/Chapter 5/Weave Tree.w" +#line 662 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__url(heterogeneous_tree *tree, text_stream *url, text_stream *content, int external) ; -#line 669 "inweb/Chapter 5/Weave Tree.w" +#line 671 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__footnote_cue(heterogeneous_tree *tree, text_stream *cue) ; -#line 675 "inweb/Chapter 5/Weave Tree.w" +#line 677 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__footnote(heterogeneous_tree *tree, text_stream *cue) ; -#line 685 "inweb/Chapter 5/Weave Tree.w" +#line 687 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__function_defn(heterogeneous_tree *tree, language_function *fn) ; -#line 695 "inweb/Chapter 5/Weave Tree.w" +#line 697 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__display_line(heterogeneous_tree *tree, text_stream *text) ; -#line 714 "inweb/Chapter 5/Weave Tree.w" +#line 716 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__weave_item_node(heterogeneous_tree *tree, int depth, text_stream *label) ; -#line 721 "inweb/Chapter 5/Weave Tree.w" +#line 723 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__grammar_index(heterogeneous_tree *tree) ; -#line 726 "inweb/Chapter 5/Weave Tree.w" +#line 728 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__inline(heterogeneous_tree *tree) ; -#line 731 "inweb/Chapter 5/Weave Tree.w" +#line 733 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__locale(heterogeneous_tree *tree, paragraph *par1, paragraph *par2) ; -#line 738 "inweb/Chapter 5/Weave Tree.w" +#line 740 "inweb/Chapter 5/Weave Tree.w" tree_node * WeaveTree__mathematics(heterogeneous_tree *tree, text_stream *content, int displayed) ; -#line 745 "inweb/Chapter 5/Weave Tree.w" +#line 747 "inweb/Chapter 5/Weave Tree.w" void WeaveTree__show(text_stream *OUT, heterogeneous_tree *T) ; -#line 752 "inweb/Chapter 5/Weave Tree.w" +#line 754 "inweb/Chapter 5/Weave Tree.w" void WeaveTree__prune(heterogeneous_tree *T) ; -#line 756 "inweb/Chapter 5/Weave Tree.w" +#line 758 "inweb/Chapter 5/Weave Tree.w" int WeaveTree__prune_visit(tree_node *N, void *state) ; #line 18 "inweb/Chapter 5/Format Methods.w" weave_format * Formats__create_weave_format(text_stream *name, text_stream *ext) ; @@ -4160,19 +4171,19 @@ void HTMLFormat__render(weave_format *self, text_stream *OUT, heterogeneous_tre void HTMLFormat__render_EPUB(weave_format *self, text_stream *OUT, heterogeneous_tree *tree) ; #line 86 "inweb/Chapter 5/HTML Formats.w" int HTMLFormat__render_visit(tree_node *N, void *state, int L) ; -#line 856 "inweb/Chapter 5/HTML Formats.w" +#line 877 "inweb/Chapter 5/HTML Formats.w" int HTMLFormat__interior_material(tree_node *N) ; -#line 870 "inweb/Chapter 5/HTML Formats.w" +#line 891 "inweb/Chapter 5/HTML Formats.w" void HTMLFormat__go_to_depth(HTML_render_state *hrs, int from_depth, int to_depth) ; -#line 888 "inweb/Chapter 5/HTML Formats.w" +#line 909 "inweb/Chapter 5/HTML Formats.w" void HTMLFormat__paragraph_number(text_stream *OUT, paragraph *P) ; -#line 901 "inweb/Chapter 5/HTML Formats.w" +#line 922 "inweb/Chapter 5/HTML Formats.w" void HTMLFormat__change_colour(text_stream *OUT, int col, colour_scheme *cs) ; -#line 925 "inweb/Chapter 5/HTML Formats.w" +#line 946 "inweb/Chapter 5/HTML Formats.w" void HTMLFormat__escape_text(text_stream *OUT, text_stream *id) ; -#line 937 "inweb/Chapter 5/HTML Formats.w" +#line 958 "inweb/Chapter 5/HTML Formats.w" int HTMLFormat__begin_weaving_EPUB(weave_format *wf, web *W, weave_pattern *pattern) ; -#line 952 "inweb/Chapter 5/HTML Formats.w" +#line 973 "inweb/Chapter 5/HTML Formats.w" void HTMLFormat__end_weaving_EPUB(weave_format *wf, web *W, weave_pattern *pattern) ; #line 9 "inweb/Chapter 5/Debugging Format.w" void Debugging__create(void) ; @@ -4897,6 +4908,15 @@ text_stream *TL_IS_616 = NULL; text_stream *TL_IS_617 = NULL; text_stream *TL_IS_618 = NULL; text_stream *TL_IS_619 = NULL; +text_stream *TL_IS_620 = NULL; +text_stream *TL_IS_621 = NULL; +text_stream *TL_IS_622 = NULL; +text_stream *TL_IS_623 = NULL; +text_stream *TL_IS_624 = NULL; +text_stream *TL_IS_625 = NULL; +text_stream *TL_IS_626 = NULL; +text_stream *TL_IS_627 = NULL; +text_stream *TL_IS_628 = NULL; void register_tangled_text_literals(void); #line 57 "inweb/foundation-module/Chapter 2/Streams.w" #define WRITE(args...) Writers__printf(OUT, args) @@ -5179,9 +5199,15 @@ time_t Platform__timestamp(char *transcoded_filename) { return Platform__never_time(); } +off_t Platform__size(char *transcoded_filename) { + struct stat filestat; + if (stat(transcoded_filename, &filestat) != -1) return filestat.st_size; + return (off_t) 0; +} + #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 280 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 286 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" void Platform__rsync(char *transcoded_source, char *transcoded_dest) { char rsync_command[10*MAX_FILENAME_LENGTH]; sprintf(rsync_command, "rsync -a --delete "); @@ -5206,7 +5232,7 @@ void Platform__quote_text(char *quoted, char *raw, int terminate) { #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 305 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 311 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" void Platform__sleep(int seconds) { sleep((unsigned int) seconds); } @@ -5214,7 +5240,7 @@ void Platform__sleep(int seconds) { #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_MACOS #ifdef PLATFORM_POSIX -#line 321 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 327 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" void Platform__notification(text_stream *text, int happy) { char *sound_name = "Bell.aiff"; if (happy == FALSE) sound_name = "Submarine.aiff"; @@ -5229,14 +5255,14 @@ void Platform__notification(text_stream *text, int happy) { #endif /* PLATFORM_POSIX */ #ifndef PLATFORM_MACOS #ifdef PLATFORM_POSIX -#line 334 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 340 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" void Platform__notification(text_stream *text, int happy) { } #endif /* PLATFORM_MACOS */ #endif /* PLATFORM_POSIX */ #ifdef PLATFORM_POSIX -#line 346 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" +#line 352 "inweb/foundation-module/Chapter 1/POSIX Platforms.w" int Platform__create_thread(foundation_thread *pt, const foundation_thread_attributes *pa, void *(*fn)(void *), void *arg) { return pthread_create(pt, pa, fn, arg); @@ -5369,6 +5395,12 @@ time_t Platform__timestamp(char *transcoded_filename) { return Platform__never_time(); } +off_t Platform__size(char *transcoded_filename) { + struct stat filestat; + if (stat(transcoded_filename, &filestat) != -1) return filestat.st_size; + return (off_t) 0; +} + #endif /* PLATFORM_WINDOWS */ #line 10 "inweb/foundation-module/Chapter 2/Debugging Log.w" text_stream debug_log_file_struct; /* The actual debugging log file */ @@ -8506,6 +8538,16 @@ time_t Filenames__timestamp(filename *F) { return t; } +int Filenames__size(filename *F) { + char transcoded_pathname[4*MAX_FILENAME_LENGTH]; + TEMPORARY_TEXT(FN); + WRITE_TO(FN, "%f", F); + Str__copy_to_locale_string(transcoded_pathname, FN, 4*MAX_FILENAME_LENGTH); + int t = (int) Platform__size(transcoded_pathname); + DISCARD_TEXT(FN); + return t; +} + #ifdef PLATFORM_POSIX #line 50 "inweb/foundation-module/Chapter 3/Case-Insensitive Filenames.w" FILE *CIFilingSystem__fopen(const char *path, const char *mode) { @@ -16756,15 +16798,15 @@ void Parser__parse_web(web *W, int inweb_mode) { (Regexp__match(&mr2, mr.exp[0], L"%((%c*?) *text%)"))) { { -#line 464 "inweb/Chapter 2/The Parser.w" +#line 474 "inweb/Chapter 2/The Parser.w" match_results mr3 = Regexp__create_mr(); while (TRUE) { if (Regexp__match(&mr3, mr2.exp[0], L" *(%C+) *(%c*?)")) { - if (Str__eq(mr3.exp[0], TL_IS_187)) L->plainer = TRUE; - else if (Str__eq(mr3.exp[0], TL_IS_188)) L->enable_hyperlinks = TRUE; + if (Str__eq(mr3.exp[0], TL_IS_188)) L->plainer = TRUE; + else if (Str__eq(mr3.exp[0], TL_IS_189)) L->enable_hyperlinks = TRUE; else { Main__error_in_web( - TL_IS_189, L); + TL_IS_190, L); } } else break; Str__clear(mr2.exp[0]); @@ -16782,15 +16824,15 @@ void Parser__parse_web(web *W, int inweb_mode) { (Regexp__match(&mr2, mr.exp[0], L"%((%c*?) *text as code%)"))) { { -#line 464 "inweb/Chapter 2/The Parser.w" +#line 474 "inweb/Chapter 2/The Parser.w" match_results mr3 = Regexp__create_mr(); while (TRUE) { if (Regexp__match(&mr3, mr2.exp[0], L" *(%C+) *(%c*?)")) { - if (Str__eq(mr3.exp[0], TL_IS_187)) L->plainer = TRUE; - else if (Str__eq(mr3.exp[0], TL_IS_188)) L->enable_hyperlinks = TRUE; + if (Str__eq(mr3.exp[0], TL_IS_188)) L->plainer = TRUE; + else if (Str__eq(mr3.exp[0], TL_IS_189)) L->enable_hyperlinks = TRUE; else { Main__error_in_web( - TL_IS_189, L); + TL_IS_190, L); } } else break; Str__clear(mr2.exp[0]); @@ -16808,15 +16850,15 @@ void Parser__parse_web(web *W, int inweb_mode) { (Regexp__match(&mr2, mr.exp[0], L"%((%c*?) *text as (%c+)%)"))) { { -#line 464 "inweb/Chapter 2/The Parser.w" +#line 474 "inweb/Chapter 2/The Parser.w" match_results mr3 = Regexp__create_mr(); while (TRUE) { if (Regexp__match(&mr3, mr2.exp[0], L" *(%C+) *(%c*?)")) { - if (Str__eq(mr3.exp[0], TL_IS_187)) L->plainer = TRUE; - else if (Str__eq(mr3.exp[0], TL_IS_188)) L->enable_hyperlinks = TRUE; + if (Str__eq(mr3.exp[0], TL_IS_188)) L->plainer = TRUE; + else if (Str__eq(mr3.exp[0], TL_IS_189)) L->enable_hyperlinks = TRUE; else { Main__error_in_web( - TL_IS_189, L); + TL_IS_190, L); } } else break; Str__clear(mr2.exp[0]); @@ -16834,15 +16876,15 @@ void Parser__parse_web(web *W, int inweb_mode) { (Regexp__match(&mr2, mr.exp[0], L"%((%c*?) *text from (%c+) as code%)"))) { { -#line 464 "inweb/Chapter 2/The Parser.w" +#line 474 "inweb/Chapter 2/The Parser.w" match_results mr3 = Regexp__create_mr(); while (TRUE) { if (Regexp__match(&mr3, mr2.exp[0], L" *(%C+) *(%c*?)")) { - if (Str__eq(mr3.exp[0], TL_IS_187)) L->plainer = TRUE; - else if (Str__eq(mr3.exp[0], TL_IS_188)) L->enable_hyperlinks = TRUE; + if (Str__eq(mr3.exp[0], TL_IS_188)) L->plainer = TRUE; + else if (Str__eq(mr3.exp[0], TL_IS_189)) L->enable_hyperlinks = TRUE; else { Main__error_in_web( - TL_IS_189, L); + TL_IS_190, L); } } else break; Str__clear(mr2.exp[0]); @@ -16856,7 +16898,7 @@ void Parser__parse_web(web *W, int inweb_mode) { code_pl_for_body = S->sect_language; { -#line 480 "inweb/Chapter 2/The Parser.w" +#line 490 "inweb/Chapter 2/The Parser.w" L->category = BEGIN_CODE_LCAT; pathname *P = W->md->path_to_web; filename *F = Filenames__from_text_relative(P, mr2.exp[1]); @@ -16870,7 +16912,7 @@ void Parser__parse_web(web *W, int inweb_mode) { latest->next_line = TL; latest = TL; } - source_line *EEL = Lines__new_source_line_in(TL_IS_190, &(L->source), S); + source_line *EEL = Lines__new_source_line_in(TL_IS_191, &(L->source), S); EEL->next_line = latest->next_line; latest->next_line = EEL; code_lcat_for_body = TEXT_EXTRACT_LCAT; @@ -16883,15 +16925,15 @@ void Parser__parse_web(web *W, int inweb_mode) { (Regexp__match(&mr2, mr.exp[0], L"%((%c*?) *text from (%c+) as (%c+)%)"))) { { -#line 464 "inweb/Chapter 2/The Parser.w" +#line 474 "inweb/Chapter 2/The Parser.w" match_results mr3 = Regexp__create_mr(); while (TRUE) { if (Regexp__match(&mr3, mr2.exp[0], L" *(%C+) *(%c*?)")) { - if (Str__eq(mr3.exp[0], TL_IS_187)) L->plainer = TRUE; - else if (Str__eq(mr3.exp[0], TL_IS_188)) L->enable_hyperlinks = TRUE; + if (Str__eq(mr3.exp[0], TL_IS_188)) L->plainer = TRUE; + else if (Str__eq(mr3.exp[0], TL_IS_189)) L->enable_hyperlinks = TRUE; else { Main__error_in_web( - TL_IS_189, L); + TL_IS_190, L); } } else break; Str__clear(mr2.exp[0]); @@ -16905,7 +16947,7 @@ void Parser__parse_web(web *W, int inweb_mode) { code_pl_for_body = Languages__find_by_name(mr2.exp[2], W); { -#line 480 "inweb/Chapter 2/The Parser.w" +#line 490 "inweb/Chapter 2/The Parser.w" L->category = BEGIN_CODE_LCAT; pathname *P = W->md->path_to_web; filename *F = Filenames__from_text_relative(P, mr2.exp[1]); @@ -16919,7 +16961,7 @@ void Parser__parse_web(web *W, int inweb_mode) { latest->next_line = TL; latest = TL; } - source_line *EEL = Lines__new_source_line_in(TL_IS_190, &(L->source), S); + source_line *EEL = Lines__new_source_line_in(TL_IS_191, &(L->source), S); EEL->next_line = latest->next_line; latest->next_line = EEL; code_lcat_for_body = TEXT_EXTRACT_LCAT; @@ -16932,15 +16974,15 @@ void Parser__parse_web(web *W, int inweb_mode) { (Regexp__match(&mr2, mr.exp[0], L"%((%c*?) *text from (%c+)%)"))) { { -#line 464 "inweb/Chapter 2/The Parser.w" +#line 474 "inweb/Chapter 2/The Parser.w" match_results mr3 = Regexp__create_mr(); while (TRUE) { if (Regexp__match(&mr3, mr2.exp[0], L" *(%C+) *(%c*?)")) { - if (Str__eq(mr3.exp[0], TL_IS_187)) L->plainer = TRUE; - else if (Str__eq(mr3.exp[0], TL_IS_188)) L->enable_hyperlinks = TRUE; + if (Str__eq(mr3.exp[0], TL_IS_188)) L->plainer = TRUE; + else if (Str__eq(mr3.exp[0], TL_IS_189)) L->enable_hyperlinks = TRUE; else { Main__error_in_web( - TL_IS_189, L); + TL_IS_190, L); } } else break; Str__clear(mr2.exp[0]); @@ -16954,7 +16996,7 @@ void Parser__parse_web(web *W, int inweb_mode) { code_pl_for_body = NULL; { -#line 480 "inweb/Chapter 2/The Parser.w" +#line 490 "inweb/Chapter 2/The Parser.w" L->category = BEGIN_CODE_LCAT; pathname *P = W->md->path_to_web; filename *F = Filenames__from_text_relative(P, mr2.exp[1]); @@ -16968,7 +17010,7 @@ void Parser__parse_web(web *W, int inweb_mode) { latest->next_line = TL; latest = TL; } - source_line *EEL = Lines__new_source_line_in(TL_IS_190, &(L->source), S); + source_line *EEL = Lines__new_source_line_in(TL_IS_191, &(L->source), S); EEL->next_line = latest->next_line; latest->next_line = EEL; code_lcat_for_body = TEXT_EXTRACT_LCAT; @@ -17002,16 +17044,26 @@ void Parser__parse_web(web *W, int inweb_mode) { L->text_operand = Str__duplicate(mr2.exp[0]); comment_mode = TRUE; } else if ((current_paragraph) && - (Regexp__match(&mr2, mr.exp[0], L"%(download (%c+)%)"))) { + (Regexp__match(&mr2, mr.exp[0], L"%(download (%c+) \"(%c*)\"%)"))) { Tags__add_by_name(L->owning_paragraph, TL_IS_178); L->command_code = DOWNLOAD_CMD; L->category = COMMAND_LCAT; code_lcat_for_body = COMMENT_BODY_LCAT; L->text_operand = Str__duplicate(mr2.exp[0]); + L->text_operand2 = Str__duplicate(mr2.exp[1]); + comment_mode = TRUE; + } else if ((current_paragraph) && + (Regexp__match(&mr2, mr.exp[0], L"%(download (%c+)%)"))) { + Tags__add_by_name(L->owning_paragraph, TL_IS_179); + L->command_code = DOWNLOAD_CMD; + L->category = COMMAND_LCAT; + code_lcat_for_body = COMMENT_BODY_LCAT; + L->text_operand = Str__duplicate(mr2.exp[0]); + L->text_operand2 = Str__new(); comment_mode = TRUE; } else if ((current_paragraph) && (Regexp__match(&mr2, mr.exp[0], L"%(carousel%)"))) { - Tags__add_by_name(L->owning_paragraph, TL_IS_179); + Tags__add_by_name(L->owning_paragraph, TL_IS_180); L->command_code = CAROUSEL_UNCAPTIONED_CMD; L->category = COMMAND_LCAT; code_lcat_for_body = COMMENT_BODY_LCAT; @@ -17019,7 +17071,7 @@ void Parser__parse_web(web *W, int inweb_mode) { comment_mode = TRUE; } else if ((current_paragraph) && (Regexp__match(&mr2, mr.exp[0], L"%(carousel \"(%c+)\" below%)"))) { - Tags__add_by_name(L->owning_paragraph, TL_IS_180); + Tags__add_by_name(L->owning_paragraph, TL_IS_181); L->command_code = CAROUSEL_BELOW_CMD; L->category = COMMAND_LCAT; code_lcat_for_body = COMMENT_BODY_LCAT; @@ -17027,7 +17079,7 @@ void Parser__parse_web(web *W, int inweb_mode) { comment_mode = TRUE; } else if ((current_paragraph) && (Regexp__match(&mr2, mr.exp[0], L"%(carousel \"(%c+)\" above%)"))) { - Tags__add_by_name(L->owning_paragraph, TL_IS_181); + Tags__add_by_name(L->owning_paragraph, TL_IS_182); L->command_code = CAROUSEL_ABOVE_CMD; L->category = COMMAND_LCAT; code_lcat_for_body = COMMENT_BODY_LCAT; @@ -17035,7 +17087,7 @@ void Parser__parse_web(web *W, int inweb_mode) { comment_mode = TRUE; } else if ((current_paragraph) && (Regexp__match(&mr2, mr.exp[0], L"%(carousel \"(%c+)\"%)"))) { - Tags__add_by_name(L->owning_paragraph, TL_IS_182); + Tags__add_by_name(L->owning_paragraph, TL_IS_183); L->command_code = CAROUSEL_CMD; L->category = COMMAND_LCAT; code_lcat_for_body = COMMENT_BODY_LCAT; @@ -17043,7 +17095,7 @@ void Parser__parse_web(web *W, int inweb_mode) { comment_mode = TRUE; } else if ((current_paragraph) && (Regexp__match(&mr2, mr.exp[0], L"%(carousel end%)"))) { - Tags__add_by_name(L->owning_paragraph, TL_IS_183); + Tags__add_by_name(L->owning_paragraph, TL_IS_184); L->command_code = CAROUSEL_END_CMD; L->category = COMMAND_LCAT; code_lcat_for_body = COMMENT_BODY_LCAT; @@ -17051,7 +17103,7 @@ void Parser__parse_web(web *W, int inweb_mode) { } else if ((current_paragraph) && ((Regexp__match(&mr2, mr.exp[0], L"%(embedded (%C+) video (%c+)%)")) || (Regexp__match(&mr2, mr.exp[0], L"%(embedded (%C+) audio (%c+)%)")))) { - Tags__add_by_name(L->owning_paragraph, TL_IS_184); + Tags__add_by_name(L->owning_paragraph, TL_IS_185); L->command_code = EMBED_CMD; L->category = COMMAND_LCAT; code_lcat_for_body = COMMENT_BODY_LCAT; @@ -17059,10 +17111,10 @@ void Parser__parse_web(web *W, int inweb_mode) { L->text_operand2 = Str__duplicate(mr2.exp[1]); comment_mode = TRUE; } else { - Main__error_in_web(TL_IS_185, L); + Main__error_in_web(TL_IS_186, L); } } else if (Regexp__match(&mr, L->text, L"= *%C%c*")) { - Main__error_in_web(TL_IS_186, L); + Main__error_in_web(TL_IS_187, L); } code_plainness_for_body = L->plainer; hyperlink_body = L->enable_hyperlinks; @@ -17091,12 +17143,12 @@ void Parser__parse_web(web *W, int inweb_mode) { } { -#line 506 "inweb/Chapter 2/The Parser.w" +#line 516 "inweb/Chapter 2/The Parser.w" extract_mode = FALSE; if (Str__eq_wide_string(command_text, L"Purpose:")) { -#line 554 "inweb/Chapter 2/The Parser.w" - if (before_bar == FALSE) Main__error_in_web(TL_IS_192, L); +#line 564 "inweb/Chapter 2/The Parser.w" + if (before_bar == FALSE) Main__error_in_web(TL_IS_193, L); if (S->md->using_syntax >= V2_SYNTAX) Parser__wrong_version(S->md->using_syntax, L, "'@Purpose'", V1_SYNTAX); L->category = PURPOSE_LCAT; @@ -17105,14 +17157,14 @@ void Parser__parse_web(web *W, int inweb_mode) { S->sect_purpose = Parser__extract_purpose(remainder, L->next_line, L->owning_section, &L); } -#line 507 "inweb/Chapter 2/The Parser.w" +#line 517 "inweb/Chapter 2/The Parser.w" else if (Str__eq_wide_string(command_text, L"Interface:")) { -#line 563 "inweb/Chapter 2/The Parser.w" +#line 573 "inweb/Chapter 2/The Parser.w" if (S->md->using_syntax >= V2_SYNTAX) Parser__wrong_version(S->md->using_syntax, L, "'@Interface'", V1_SYNTAX); - if (before_bar == FALSE) Main__error_in_web(TL_IS_193, L); + if (before_bar == FALSE) Main__error_in_web(TL_IS_194, L); L->category = INTERFACE_LCAT; L->owning_paragraph = NULL; L->is_commentary = TRUE; @@ -17125,14 +17177,14 @@ void Parser__parse_web(web *W, int inweb_mode) { } } -#line 508 "inweb/Chapter 2/The Parser.w" +#line 518 "inweb/Chapter 2/The Parser.w" else if (Str__eq_wide_string(command_text, L"Definitions:")) { -#line 578 "inweb/Chapter 2/The Parser.w" +#line 588 "inweb/Chapter 2/The Parser.w" if (S->md->using_syntax >= V2_SYNTAX) Parser__wrong_version(S->md->using_syntax, L, "'@Definitions' headings", V1_SYNTAX); - if (before_bar == FALSE) Main__error_in_web(TL_IS_194, L); + if (before_bar == FALSE) Main__error_in_web(TL_IS_195, L); L->category = DEFINITIONS_LCAT; L->owning_paragraph = NULL; L->is_commentary = TRUE; @@ -17140,14 +17192,14 @@ void Parser__parse_web(web *W, int inweb_mode) { next_par_number = 1; } -#line 509 "inweb/Chapter 2/The Parser.w" +#line 519 "inweb/Chapter 2/The Parser.w" else if (Regexp__match(&mr, command_text, L"----+")) { -#line 591 "inweb/Chapter 2/The Parser.w" +#line 601 "inweb/Chapter 2/The Parser.w" if (S->md->using_syntax >= V2_SYNTAX) Parser__wrong_version(S->md->using_syntax, L, "the bar '----...'", V1_SYNTAX); - if (before_bar == FALSE) Main__error_in_web(TL_IS_195, L); + if (before_bar == FALSE) Main__error_in_web(TL_IS_196, L); L->category = BAR_LCAT; L->owning_paragraph = NULL; L->is_commentary = TRUE; @@ -17157,14 +17209,14 @@ void Parser__parse_web(web *W, int inweb_mode) { next_par_number = 1; } -#line 510 "inweb/Chapter 2/The Parser.w" +#line 520 "inweb/Chapter 2/The Parser.w" else if ((Str__eq_wide_string(command_text, L"c")) || (Str__eq_wide_string(command_text, L"x")) || ((S->md->using_syntax == V1_SYNTAX) && (Str__eq_wide_string(command_text, L"e")))) { -#line 609 "inweb/Chapter 2/The Parser.w" +#line 619 "inweb/Chapter 2/The Parser.w" if (S->md->using_syntax > V1_SYNTAX) Parser__wrong_version(S->md->using_syntax, L, "'@c' and '@x'", V1_SYNTAX); L->category = BEGIN_CODE_LCAT; @@ -17178,11 +17230,11 @@ void Parser__parse_web(web *W, int inweb_mode) { hyperlink_body = FALSE; } -#line 514 "inweb/Chapter 2/The Parser.w" +#line 524 "inweb/Chapter 2/The Parser.w" else if (Str__eq_wide_string(command_text, L"d")) { -#line 625 "inweb/Chapter 2/The Parser.w" +#line 635 "inweb/Chapter 2/The Parser.w" L->category = BEGIN_DEFINITION_LCAT; code_lcat_for_body = CONT_DEFINITION_LCAT; code_pl_for_body = NULL; @@ -17199,97 +17251,63 @@ void Parser__parse_web(web *W, int inweb_mode) { L->is_commentary = FALSE; Regexp__dispose_of(&mr); -} -#line 515 "inweb/Chapter 2/The Parser.w" - - else if (Str__eq_wide_string(command_text, L"define")) { - if (S->md->using_syntax < V2_SYNTAX) - Parser__wrong_version(S->md->using_syntax, L, "'@define' for definitions (use '@d' instead)", V2_SYNTAX); - -{ -#line 625 "inweb/Chapter 2/The Parser.w" - L->category = BEGIN_DEFINITION_LCAT; - code_lcat_for_body = CONT_DEFINITION_LCAT; - code_pl_for_body = NULL; - match_results mr = Regexp__create_mr(); - if (Regexp__match(&mr, remainder, L"(%C+) (%c+)")) { - L->text_operand = Str__duplicate(mr.exp[0]); /* name of term defined */ - L->text_operand2 = Str__duplicate(mr.exp[1]); /* Value */ - } else { - L->text_operand = Str__duplicate(remainder); /* name of term defined */ - L->text_operand2 = Str__new(); /* no value given */ - } - Analyser__mark_reserved_word_at_line(L, L->text_operand, CONSTANT_COLOUR); - comment_mode = FALSE; - L->is_commentary = FALSE; - Regexp__dispose_of(&mr); - -} -#line 519 "inweb/Chapter 2/The Parser.w" -; - } else if (Str__eq_wide_string(command_text, L"default")) { - if (S->md->using_syntax < V2_SYNTAX) - Parser__wrong_version(S->md->using_syntax, L, "'@default' for definitions", V2_SYNTAX); - L->default_defn = TRUE; - -{ -#line 625 "inweb/Chapter 2/The Parser.w" - L->category = BEGIN_DEFINITION_LCAT; - code_lcat_for_body = CONT_DEFINITION_LCAT; - code_pl_for_body = NULL; - match_results mr = Regexp__create_mr(); - if (Regexp__match(&mr, remainder, L"(%C+) (%c+)")) { - L->text_operand = Str__duplicate(mr.exp[0]); /* name of term defined */ - L->text_operand2 = Str__duplicate(mr.exp[1]); /* Value */ - } else { - L->text_operand = Str__duplicate(remainder); /* name of term defined */ - L->text_operand2 = Str__new(); /* no value given */ - } - Analyser__mark_reserved_word_at_line(L, L->text_operand, CONSTANT_COLOUR); - comment_mode = FALSE; - L->is_commentary = FALSE; - Regexp__dispose_of(&mr); - -} -#line 524 "inweb/Chapter 2/The Parser.w" -; - } else if (Str__eq_wide_string(command_text, L"enum")) -{ -#line 645 "inweb/Chapter 2/The Parser.w" - L->category = BEGIN_DEFINITION_LCAT; - text_stream *from = NULL; - match_results mr = Regexp__create_mr(); - L->text_operand = Str__duplicate(remainder); /* name of term defined */ - TEMPORARY_TEXT(before); - TEMPORARY_TEXT(after); - if (LanguageMethods__parse_comment(S->sect_language, L->text_operand, - before, after)) { - Str__copy(L->text_operand, before); - } - DISCARD_TEXT(before); - DISCARD_TEXT(after); - Str__trim_white_space(L->text_operand); - if (Regexp__match(&mr, L->text_operand, L"(%C+) from (%c+)")) { - from = mr.exp[1]; - Str__copy(L->text_operand, mr.exp[0]); - } else if (Regexp__match(&mr, L->text_operand, L"(%C+) (%c+)")) { - Main__error_in_web(TL_IS_196, L); - } - L->text_operand2 = Str__new(); - if (inweb_mode == TANGLE_MODE) - Enumerations__define(L->text_operand2, L->text_operand, from, L); - Analyser__mark_reserved_word_at_line(L, L->text_operand, CONSTANT_COLOUR); - comment_mode = FALSE; - L->is_commentary = FALSE; - Regexp__dispose_of(&mr); - } #line 525 "inweb/Chapter 2/The Parser.w" - else if ((Str__eq_wide_string(command_text, L"e")) && (S->md->using_syntax >= V2_SYNTAX)) + else if (Str__eq_wide_string(command_text, L"define")) { + if (S->md->using_syntax < V2_SYNTAX) + Parser__wrong_version(S->md->using_syntax, L, "'@define' for definitions (use '@d' instead)", V2_SYNTAX); { -#line 645 "inweb/Chapter 2/The Parser.w" +#line 635 "inweb/Chapter 2/The Parser.w" + L->category = BEGIN_DEFINITION_LCAT; + code_lcat_for_body = CONT_DEFINITION_LCAT; + code_pl_for_body = NULL; + match_results mr = Regexp__create_mr(); + if (Regexp__match(&mr, remainder, L"(%C+) (%c+)")) { + L->text_operand = Str__duplicate(mr.exp[0]); /* name of term defined */ + L->text_operand2 = Str__duplicate(mr.exp[1]); /* Value */ + } else { + L->text_operand = Str__duplicate(remainder); /* name of term defined */ + L->text_operand2 = Str__new(); /* no value given */ + } + Analyser__mark_reserved_word_at_line(L, L->text_operand, CONSTANT_COLOUR); + comment_mode = FALSE; + L->is_commentary = FALSE; + Regexp__dispose_of(&mr); + +} +#line 529 "inweb/Chapter 2/The Parser.w" +; + } else if (Str__eq_wide_string(command_text, L"default")) { + if (S->md->using_syntax < V2_SYNTAX) + Parser__wrong_version(S->md->using_syntax, L, "'@default' for definitions", V2_SYNTAX); + L->default_defn = TRUE; + +{ +#line 635 "inweb/Chapter 2/The Parser.w" + L->category = BEGIN_DEFINITION_LCAT; + code_lcat_for_body = CONT_DEFINITION_LCAT; + code_pl_for_body = NULL; + match_results mr = Regexp__create_mr(); + if (Regexp__match(&mr, remainder, L"(%C+) (%c+)")) { + L->text_operand = Str__duplicate(mr.exp[0]); /* name of term defined */ + L->text_operand2 = Str__duplicate(mr.exp[1]); /* Value */ + } else { + L->text_operand = Str__duplicate(remainder); /* name of term defined */ + L->text_operand2 = Str__new(); /* no value given */ + } + Analyser__mark_reserved_word_at_line(L, L->text_operand, CONSTANT_COLOUR); + comment_mode = FALSE; + L->is_commentary = FALSE; + Regexp__dispose_of(&mr); + +} +#line 534 "inweb/Chapter 2/The Parser.w" +; + } else if (Str__eq_wide_string(command_text, L"enum")) +{ +#line 655 "inweb/Chapter 2/The Parser.w" L->category = BEGIN_DEFINITION_LCAT; text_stream *from = NULL; match_results mr = Regexp__create_mr(); @@ -17307,7 +17325,7 @@ void Parser__parse_web(web *W, int inweb_mode) { from = mr.exp[1]; Str__copy(L->text_operand, mr.exp[0]); } else if (Regexp__match(&mr, L->text_operand, L"(%C+) (%c+)")) { - Main__error_in_web(TL_IS_196, L); + Main__error_in_web(TL_IS_197, L); } L->text_operand2 = Str__new(); if (inweb_mode == TANGLE_MODE) @@ -17318,7 +17336,41 @@ void Parser__parse_web(web *W, int inweb_mode) { Regexp__dispose_of(&mr); } -#line 527 "inweb/Chapter 2/The Parser.w" +#line 535 "inweb/Chapter 2/The Parser.w" + + else if ((Str__eq_wide_string(command_text, L"e")) && (S->md->using_syntax >= V2_SYNTAX)) + +{ +#line 655 "inweb/Chapter 2/The Parser.w" + L->category = BEGIN_DEFINITION_LCAT; + text_stream *from = NULL; + match_results mr = Regexp__create_mr(); + L->text_operand = Str__duplicate(remainder); /* name of term defined */ + TEMPORARY_TEXT(before); + TEMPORARY_TEXT(after); + if (LanguageMethods__parse_comment(S->sect_language, L->text_operand, + before, after)) { + Str__copy(L->text_operand, before); + } + DISCARD_TEXT(before); + DISCARD_TEXT(after); + Str__trim_white_space(L->text_operand); + if (Regexp__match(&mr, L->text_operand, L"(%C+) from (%c+)")) { + from = mr.exp[1]; + Str__copy(L->text_operand, mr.exp[0]); + } else if (Regexp__match(&mr, L->text_operand, L"(%C+) (%c+)")) { + Main__error_in_web(TL_IS_197, L); + } + L->text_operand2 = Str__new(); + if (inweb_mode == TANGLE_MODE) + Enumerations__define(L->text_operand2, L->text_operand, from, L); + Analyser__mark_reserved_word_at_line(L, L->text_operand, CONSTANT_COLOUR); + comment_mode = FALSE; + L->is_commentary = FALSE; + Regexp__dispose_of(&mr); + +} +#line 537 "inweb/Chapter 2/The Parser.w" else { int weight = -1, new_page = FALSE; @@ -17340,7 +17392,7 @@ void Parser__parse_web(web *W, int inweb_mode) { } if (weight >= 0) { -#line 697 "inweb/Chapter 2/The Parser.w" +#line 707 "inweb/Chapter 2/The Parser.w" comment_mode = TRUE; L->is_commentary = TRUE; L->category = PARAGRAPH_START_LCAT; @@ -17359,7 +17411,7 @@ void Parser__parse_web(web *W, int inweb_mode) { } { -#line 746 "inweb/Chapter 2/The Parser.w" +#line 756 "inweb/Chapter 2/The Parser.w" paragraph *P = CREATE(paragraph); if (S->md->using_syntax > V1_SYNTAX) { P->above_bar = FALSE; @@ -17372,9 +17424,9 @@ void Parser__parse_web(web *W, int inweb_mode) { } P->heading_text = Str__duplicate(L->text_operand); if ((S->md->using_syntax == V1_SYNTAX) && (before_bar)) - P->ornament = Str__duplicate(TL_IS_197); - else P->ornament = Str__duplicate(TL_IS_198); + else + P->ornament = Str__duplicate(TL_IS_199); WRITE_TO(P->paragraph_number, "%d", next_par_number++); P->parent_paragraph = NULL; P->next_child_number = 1; @@ -17394,7 +17446,7 @@ void Parser__parse_web(web *W, int inweb_mode) { current_paragraph = P; } -#line 713 "inweb/Chapter 2/The Parser.w" +#line 723 "inweb/Chapter 2/The Parser.w" ; L->owning_paragraph = current_paragraph; @@ -17402,9 +17454,9 @@ void Parser__parse_web(web *W, int inweb_mode) { Regexp__dispose_of(&mr); } -#line 546 "inweb/Chapter 2/The Parser.w" +#line 556 "inweb/Chapter 2/The Parser.w" - else Main__error_in_web(TL_IS_191, L); + else Main__error_in_web(TL_IS_192, L); } } @@ -17420,7 +17472,7 @@ void Parser__parse_web(web *W, int inweb_mode) { ; if (comment_mode) { -#line 782 "inweb/Chapter 2/The Parser.w" +#line 792 "inweb/Chapter 2/The Parser.w" match_results mr = Regexp__create_mr(); if (Regexp__match(&mr, L->text, L">> (%c+)")) { L->category = SOURCE_DISPLAY_LCAT; @@ -17433,7 +17485,7 @@ void Parser__parse_web(web *W, int inweb_mode) { ; if (comment_mode == FALSE) { -#line 794 "inweb/Chapter 2/The Parser.w" +#line 804 "inweb/Chapter 2/The Parser.w" if ((L->category != BEGIN_DEFINITION_LCAT) && (L->category != COMMAND_LCAT)) { L->category = code_lcat_for_body; L->plainer = code_plainness_for_body; @@ -17493,7 +17545,7 @@ void Parser__parse_web(web *W, int inweb_mode) { LOOP_OVER_LINKED_LIST(P, paragraph, S->paragraphs) { -#line 842 "inweb/Chapter 2/The Parser.w" +#line 852 "inweb/Chapter 2/The Parser.w" int next_footnote_in_para = 1; footnote *current_text = NULL; TEMPORARY_TEXT(before); @@ -17511,7 +17563,7 @@ void Parser__parse_web(web *W, int inweb_mode) { if (this_is_a_cue == FALSE) { -#line 866 "inweb/Chapter 2/The Parser.w" +#line 876 "inweb/Chapter 2/The Parser.w" L->category = FOOTNOTE_TEXT_LCAT; footnote *F = CREATE(footnote); F->footnote_cue_number = Str__atoi(cue, 0); @@ -17531,7 +17583,7 @@ void Parser__parse_web(web *W, int inweb_mode) { current_text = F; } -#line 857 "inweb/Chapter 2/The Parser.w" +#line 867 "inweb/Chapter 2/The Parser.w" ; } L->footnote_text = current_text; @@ -17556,9 +17608,9 @@ void Parser__parse_web(web *W, int inweb_mode) { LanguageMethods__further_parsing(W, W->main_language); } -#line 744 "inweb/Chapter 2/The Parser.w" +#line 754 "inweb/Chapter 2/The Parser.w" -#line 815 "inweb/Chapter 2/The Parser.w" +#line 825 "inweb/Chapter 2/The Parser.w" text_stream *Parser__extract_purpose(text_stream *prologue, source_line *XL, section *S, source_line **adjust) { text_stream *P = Str__duplicate(prologue); while ((XL) && (XL->next_line) && (XL->owning_section == S) && @@ -17574,16 +17626,16 @@ text_stream *Parser__extract_purpose(text_stream *prologue, source_line *XL, sec return P; } -#line 840 "inweb/Chapter 2/The Parser.w" +#line 850 "inweb/Chapter 2/The Parser.w" -#line 887 "inweb/Chapter 2/The Parser.w" +#line 897 "inweb/Chapter 2/The Parser.w" int Parser__detect_footnote(web *W, text_stream *matter, text_stream *before, text_stream *cue, text_stream *after) { text_stream *fn_on_notation = - Bibliographic__get_datum(W->md, TL_IS_199); - text_stream *fn_off_notation = Bibliographic__get_datum(W->md, TL_IS_200); - if (Str__ne(fn_on_notation, TL_IS_201)) { + text_stream *fn_off_notation = + Bibliographic__get_datum(W->md, TL_IS_201); + if (Str__ne(fn_on_notation, TL_IS_202)) { int N1 = Str__len(fn_on_notation); int N2 = Str__len(fn_off_notation); if ((N1 > 0) && (N2 > 0)) @@ -17630,7 +17682,7 @@ footnote *Parser__find_footnote_in_para(paragraph *P, text_stream *cue) { return NULL; } -#line 946 "inweb/Chapter 2/The Parser.w" +#line 956 "inweb/Chapter 2/The Parser.w" void Parser__wrong_version(int using, source_line *L, char *feature, int need) { TEMPORARY_TEXT(warning); WRITE_TO(warning, "%s is a feature available only in version %d syntax (you're using version %d)", @@ -17675,10 +17727,10 @@ theme_tag *Tags__find_by_name(text_stream *name, int creating_if_necessary) { tag->tag_name = Str__duplicate(name); tag->ifdef_positive = NOT_APPLICABLE; tag->ifdef_symbol = Str__new(); - if (Str__prefix_eq(name, TL_IS_202, 6)) { + if (Str__prefix_eq(name, TL_IS_203, 6)) { Str__substr(tag->ifdef_symbol, Str__at(name, 6), Str__end(name)); tag->ifdef_positive = TRUE; - } else if (Str__prefix_eq(name, TL_IS_203, 7)) { + } else if (Str__prefix_eq(name, TL_IS_204, 7)) { Str__substr(tag->ifdef_symbol, Str__at(name, 7), Str__end(name)); tag->ifdef_positive = FALSE; } @@ -17773,20 +17825,20 @@ void Tags__show_endnote_on_ifdefs(heterogeneous_tree *tree, tree_node *ap, parag if (d++ == 0) { tree_node *E = WeaveTree__endnote(tree); Trees__make_child(E, ap); ap = E; - TextWeaver__commentary_text(tree, ap, TL_IS_205); - } else { TextWeaver__commentary_text(tree, ap, TL_IS_206); + } else { + TextWeaver__commentary_text(tree, ap, TL_IS_207); } } else { - TextWeaver__commentary_text(tree, ap, TL_IS_207); + TextWeaver__commentary_text(tree, ap, TL_IS_208); } TextWeaver__commentary_text(tree, ap, pt->the_tag->ifdef_symbol); } if (c > 0) { - if (c == 1) TextWeaver__commentary_text(tree, ap, TL_IS_208); - else TextWeaver__commentary_text(tree, ap, TL_IS_209); - if (sense) TextWeaver__commentary_text(tree, ap, TL_IS_210); - else TextWeaver__commentary_text(tree, ap, TL_IS_211); + if (c == 1) TextWeaver__commentary_text(tree, ap, TL_IS_209); + else TextWeaver__commentary_text(tree, ap, TL_IS_210); + if (sense) TextWeaver__commentary_text(tree, ap, TL_IS_211); + else TextWeaver__commentary_text(tree, ap, TL_IS_212); } } @@ -17805,26 +17857,26 @@ void Tags__show_endnote_on_ifdefs(heterogeneous_tree *tree, tree_node *ap, parag if (d++ == 0) { tree_node *E = WeaveTree__endnote(tree); Trees__make_child(E, ap); ap = E; - TextWeaver__commentary_text(tree, ap, TL_IS_205); - } else { TextWeaver__commentary_text(tree, ap, TL_IS_206); + } else { + TextWeaver__commentary_text(tree, ap, TL_IS_207); } } else { - TextWeaver__commentary_text(tree, ap, TL_IS_207); + TextWeaver__commentary_text(tree, ap, TL_IS_208); } TextWeaver__commentary_text(tree, ap, pt->the_tag->ifdef_symbol); } if (c > 0) { - if (c == 1) TextWeaver__commentary_text(tree, ap, TL_IS_208); - else TextWeaver__commentary_text(tree, ap, TL_IS_209); - if (sense) TextWeaver__commentary_text(tree, ap, TL_IS_210); - else TextWeaver__commentary_text(tree, ap, TL_IS_211); + if (c == 1) TextWeaver__commentary_text(tree, ap, TL_IS_209); + else TextWeaver__commentary_text(tree, ap, TL_IS_210); + if (sense) TextWeaver__commentary_text(tree, ap, TL_IS_211); + else TextWeaver__commentary_text(tree, ap, TL_IS_212); } } #line 139 "inweb/Chapter 2/Tags.w" ; - if (d > 0) TextWeaver__commentary_text(tree, ap, TL_IS_204); + if (d > 0) TextWeaver__commentary_text(tree, ap, TL_IS_205); } #line 22 "inweb/Chapter 2/Enumerated Constants.w" @@ -17848,7 +17900,7 @@ void Enumerations__define(OUTPUT_STREAM, text_stream *symbol, match_results mr = Regexp__create_mr(); if (Regexp__match(&mr, symbol, L"%c*_(%C+?)")) Str__copy(pf, mr.exp[0]); else { - Main__error_in_web(TL_IS_212, L); + Main__error_in_web(TL_IS_213, L); WRITE_TO(pf, "BOGUS"); } Regexp__dispose_of(&mr); @@ -17864,7 +17916,7 @@ void Enumerations__define(OUTPUT_STREAM, text_stream *symbol, if (es->stub) WRITE("(%S+", es->stub); WRITE("%d", es->next_free_value++); if (es->stub) WRITE(")"); - } else Main__error_in_web(TL_IS_213, L); + } else Main__error_in_web(TL_IS_214, L); } #line 45 "inweb/Chapter 2/Enumerated Constants.w" @@ -17872,7 +17924,7 @@ void Enumerations__define(OUTPUT_STREAM, text_stream *symbol, else { #line 70 "inweb/Chapter 2/Enumerated Constants.w" - if (es) Main__error_in_web(TL_IS_214, L); + if (es) Main__error_in_web(TL_IS_215, L); else { es = CREATE(enumeration_set); es->postfix = Str__duplicate(pf); @@ -18162,7 +18214,7 @@ void Analyser__analyse_code(web *W) { if ((L->category == INTERFACE_BODY_LCAT) && (L->interface_line_identified == FALSE) && (Regexp__string_is_white_space(L->text) == FALSE)) - Main__error_in_web(TL_IS_215, L); + Main__error_in_web(TL_IS_216, L); } #line 109 "inweb/Chapter 3/The Analyser.w" @@ -18395,23 +18447,23 @@ void Analyser__analyse_find(web *W, source_line *L, text_stream *identifier, int #line 390 "inweb/Chapter 3/The Analyser.w" void Analyser__write_makefile(web *W, filename *F, module_search *I) { - filename *prototype = Filenames__in(W->md->path_to_web, TL_IS_216); + filename *prototype = Filenames__in(W->md->path_to_web, TL_IS_217); if (!(TextFiles__exists(prototype))) - prototype = Filenames__in(path_to_inweb_materials, TL_IS_217); + prototype = Filenames__in(path_to_inweb_materials, TL_IS_218); Makefiles__write(W, prototype, F, I); } void Analyser__write_gitignore(web *W, filename *F) { - filename *prototype = Filenames__in(W->md->path_to_web, TL_IS_218); + filename *prototype = Filenames__in(W->md->path_to_web, TL_IS_219); if (!(TextFiles__exists(prototype))) - prototype = Filenames__in(path_to_inweb_materials, TL_IS_219); + prototype = Filenames__in(path_to_inweb_materials, TL_IS_220); Git__write_gitignore(W, prototype, F); } #line 19 "inweb/Chapter 3/The Collater.w" void Collater__for_web_and_pattern(text_stream *OUT, web *W, weave_pattern *pattern, filename *F, filename *into) { - Collater__collate(OUT, W, TL_IS_220, F, pattern, NULL, NULL, NULL, into); + Collater__collate(OUT, W, TL_IS_221, F, pattern, NULL, NULL, NULL, into); } void Collater__for_order(text_stream *OUT, weave_order *wv, @@ -18566,33 +18618,33 @@ void Collater__process(text_stream *OUT, collater_state *cls) { if (Regexp__match(&mr, command, L"If (%c*)")) { text_stream *condition = mr.exp[0]; int level = IF_FALSE_LEVEL; - if (Str__eq(condition, TL_IS_221)) { + if (Str__eq(condition, TL_IS_222)) { if (cls->for_web->md->chaptered) level = IF_TRUE_LEVEL; - } else if (Str__eq(condition, TL_IS_222)) { + } else if (Str__eq(condition, TL_IS_223)) { if (LinkedLists__len(cls->modules) > 0) level = IF_TRUE_LEVEL; - } else if (Str__eq(condition, TL_IS_223)) { + } else if (Str__eq(condition, TL_IS_224)) { module *M = CONTENT_IN_ITEM( Collater__heading_topmost_on_stack(cls, MODULE_LEVEL), module); if ((M) && (Colonies__find(M->module_name))) level = IF_TRUE_LEVEL; - } else if (Str__eq(condition, TL_IS_224)) { + } else if (Str__eq(condition, TL_IS_225)) { module *M = CONTENT_IN_ITEM( Collater__heading_topmost_on_stack(cls, MODULE_LEVEL), module); if (M) { TEMPORARY_TEXT(url); TEMPORARY_TEXT(purpose); WRITE_TO(url, "%p", M->module_location); - Readme__write_var(purpose, url, TL_IS_225); + Readme__write_var(purpose, url, TL_IS_226); if (Str__len(purpose) > 0) level = IF_TRUE_LEVEL; DISCARD_TEXT(url); DISCARD_TEXT(purpose); } - } else if (Str__eq(condition, TL_IS_226)) { + } else if (Str__eq(condition, TL_IS_227)) { chapter *C = CONTENT_IN_ITEM( Collater__heading_topmost_on_stack(cls, CHAPTER_LEVEL), chapter); if ((C) && (Str__len(C->md->rubric) > 0)) level = IF_TRUE_LEVEL; - } else if (Str__eq(condition, TL_IS_227)) { + } else if (Str__eq(condition, TL_IS_228)) { section *S = CONTENT_IN_ITEM( Collater__heading_topmost_on_stack(cls, SECTION_LEVEL), section); if ((S) && (Str__len(S->sect_purpose) > 0)) level = IF_TRUE_LEVEL; @@ -18844,7 +18896,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { if (Bibliographic__data_exists(cls->for_web->md, varname)) { { -#line 539 "inweb/Chapter 3/The Collater.w" +#line 541 "inweb/Chapter 3/The Collater.w" WRITE_TO(substituted, "%S", Bibliographic__get_datum(cls->for_web->md, varname)); } @@ -18853,7 +18905,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { } else if (Regexp__match(&mr, varname, L"Navigation")) { { -#line 545 "inweb/Chapter 3/The Collater.w" +#line 547 "inweb/Chapter 3/The Collater.w" if (cls->nav_file) { if (TextFiles__exists(cls->nav_file)) Collater__collate(substituted, cls->for_web, cls->restrict_to_range, @@ -18870,7 +18922,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { } else if (Regexp__match(&mr, varname, L"Breadcrumbs")) { { -#line 558 "inweb/Chapter 3/The Collater.w" +#line 560 "inweb/Chapter 3/The Collater.w" Colonies__drop_initial_breadcrumbs(substituted, cls->into_file, cls->crumbs); @@ -18880,7 +18932,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { } else if (Str__eq_wide_string(varname, L"Plugins")) { { -#line 562 "inweb/Chapter 3/The Collater.w" +#line 564 "inweb/Chapter 3/The Collater.w" Assets__include_relevant_plugins(OUT, cls->nav_pattern, cls->for_web, cls->wv, cls->into_file); @@ -18891,7 +18943,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { text_stream *detail = mr.exp[0]; { -#line 568 "inweb/Chapter 3/The Collater.w" +#line 570 "inweb/Chapter 3/The Collater.w" if (swarm_leader) if (Formats__substitute_post_processing_data(substituted, swarm_leader, detail, cls->nav_pattern) == FALSE) @@ -18904,7 +18956,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { text_stream *detail = mr.exp[0]; { -#line 576 "inweb/Chapter 3/The Collater.w" +#line 578 "inweb/Chapter 3/The Collater.w" module *M = CONTENT_IN_ITEM( Collater__heading_topmost_on_stack(cls, MODULE_LEVEL), module); if (M == NULL) @@ -18912,7 +18964,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { cls->errors_at, lpos); else { -#line 584 "inweb/Chapter 3/The Collater.w" +#line 586 "inweb/Chapter 3/The Collater.w" if (Str__eq_wide_string(detail, L"Title")) { text_stream *owner = Collater__module_owner(M, cls->for_web); if (Str__len(owner) > 0) WRITE_TO(substituted, "%S/", owner); @@ -18923,14 +18975,14 @@ void Collater__process(text_stream *OUT, collater_state *cls) { } else if (Str__eq_wide_string(detail, L"Purpose")) { TEMPORARY_TEXT(url); WRITE_TO(url, "%p", M->module_location); - Readme__write_var(substituted, url, TL_IS_228); + Readme__write_var(substituted, url, TL_IS_229); DISCARD_TEXT(url); } else { WRITE_TO(substituted, "%S for %S", varname, M->module_name); } } -#line 581 "inweb/Chapter 3/The Collater.w" +#line 583 "inweb/Chapter 3/The Collater.w" ; } @@ -18940,7 +18992,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { text_stream *detail = mr.exp[0]; { -#line 603 "inweb/Chapter 3/The Collater.w" +#line 605 "inweb/Chapter 3/The Collater.w" chapter *C = CONTENT_IN_ITEM( Collater__heading_topmost_on_stack(cls, CHAPTER_LEVEL), chapter); if (C == NULL) @@ -18948,7 +19000,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { cls->errors_at, lpos); else { -#line 611 "inweb/Chapter 3/The Collater.w" +#line 613 "inweb/Chapter 3/The Collater.w" if (Str__eq_wide_string(detail, L"Title")) { Str__copy(substituted, C->md->ch_title); } else if (Str__eq_wide_string(detail, L"Code")) { @@ -18963,7 +19015,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { } } -#line 608 "inweb/Chapter 3/The Collater.w" +#line 610 "inweb/Chapter 3/The Collater.w" ; } @@ -18973,7 +19025,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { text_stream *detail = mr.exp[0]; { -#line 627 "inweb/Chapter 3/The Collater.w" +#line 629 "inweb/Chapter 3/The Collater.w" section *S = CONTENT_IN_ITEM( Collater__heading_topmost_on_stack(cls, SECTION_LEVEL), section); if (S == NULL) @@ -18981,7 +19033,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { cls->errors_at, lpos); else { -#line 635 "inweb/Chapter 3/The Collater.w" +#line 637 "inweb/Chapter 3/The Collater.w" if (Str__eq_wide_string(detail, L"Title")) { Str__copy(substituted, S->md->sect_title); } else if (Str__eq_wide_string(detail, L"Purpose")) { @@ -19008,7 +19060,7 @@ void Collater__process(text_stream *OUT, collater_state *cls) { } } -#line 632 "inweb/Chapter 3/The Collater.w" +#line 634 "inweb/Chapter 3/The Collater.w" ; } @@ -19017,56 +19069,68 @@ void Collater__process(text_stream *OUT, collater_state *cls) { } else if (Regexp__match(&mr, varname, L"Docs")) { { -#line 664 "inweb/Chapter 3/The Collater.w" +#line 666 "inweb/Chapter 3/The Collater.w" Pathnames__relative_URL(substituted, Filenames__up(cls->into_file), Pathnames__from_text(Colonies__home())); } #line 497 "inweb/Chapter 3/The Collater.w" +; + } else if (Regexp__match(&mr, varname, L"Assets")) { + +{ +#line 671 "inweb/Chapter 3/The Collater.w" + pathname *P = Colonies__assets_path(); + if (P == NULL) P = Filenames__up(cls->into_file); + Pathnames__relative_URL(substituted, + Filenames__up(cls->into_file), P); + +} +#line 499 "inweb/Chapter 3/The Collater.w" ; } else if (Regexp__match(&mr, varname, L"URL \"(%c+)\"")) { text_stream *link_text = mr.exp[0]; { -#line 669 "inweb/Chapter 3/The Collater.w" +#line 677 "inweb/Chapter 3/The Collater.w" Pathnames__relative_URL(substituted, Filenames__up(cls->into_file), Pathnames__from_text(link_text)); } -#line 500 "inweb/Chapter 3/The Collater.w" +#line 502 "inweb/Chapter 3/The Collater.w" ; } else if (Regexp__match(&mr, varname, L"Link \"(%c+)\"")) { text_stream *link_text = mr.exp[0]; { -#line 674 "inweb/Chapter 3/The Collater.w" +#line 682 "inweb/Chapter 3/The Collater.w" WRITE_TO(substituted, "into_file); WRITE_TO(substituted, "\">"); } -#line 503 "inweb/Chapter 3/The Collater.w" +#line 505 "inweb/Chapter 3/The Collater.w" ; } else if (Regexp__match(&mr, varname, L"Menu \"(%c+)\"")) { text_stream *menu_name = mr.exp[0]; { -#line 679 "inweb/Chapter 3/The Collater.w" +#line 687 "inweb/Chapter 3/The Collater.w" if (cls->inside_navigation_submenu) WRITE_TO(substituted, ""); WRITE_TO(substituted, "

%S