From 293e0f7427c088ae09d5298da67ab436638d4280 Mon Sep 17 00:00:00 2001
From: Graham Nelson
Date: Mon, 13 Jun 2022 19:43:47 +0100
Subject: [PATCH] Added wrapper functions for CSS spans
---
README.md | 2 +-
Tangled/inweb.c | 38 ++++++++++++++++++++---------
build.txt | 4 +--
docs/foundation-module/4-sm.html | 10 ++++----
docs/foundation-module/5-htm.html | 34 ++++++++++++++++++--------
docs/goldbach/goldbach.pdf | Bin 251998 -> 251998 bytes
foundation-module/Chapter 5/HTML.w | 14 +++++++++++
7 files changed, 73 insertions(+), 29 deletions(-)
diff --git a/README.md b/README.md
index 2268743..06b4987 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Inweb 7.1.0
-v7.1.0-beta+1B09 'Escape to Danger' (3 June 2022)
+v7.1.0-beta+1B10 'Escape to Danger' (13 June 2022)
## About Inweb
diff --git a/Tangled/inweb.c b/Tangled/inweb.c
index 0b19064..54db75c 100644
--- a/Tangled/inweb.c
+++ b/Tangled/inweb.c
@@ -3856,9 +3856,13 @@ wchar_t * HTML__translate_colour_name(wchar_t *original) ;
void HTML__begin_colour(OUTPUT_STREAM, text_stream *col) ;
#line 888 "inweb/foundation-module/Chapter 5/HTML.w"
void HTML__end_colour(OUTPUT_STREAM) ;
-#line 896 "inweb/foundation-module/Chapter 5/HTML.w"
+#line 895 "inweb/foundation-module/Chapter 5/HTML.w"
+void HTML__begin_span(OUTPUT_STREAM, text_stream *class_name) ;
+#line 902 "inweb/foundation-module/Chapter 5/HTML.w"
+void HTML__end_span(OUTPUT_STREAM) ;
+#line 910 "inweb/foundation-module/Chapter 5/HTML.w"
void HTML__write_xml_safe_text(OUTPUT_STREAM, text_stream *txt) ;
-#line 927 "inweb/foundation-module/Chapter 5/HTML.w"
+#line 941 "inweb/foundation-module/Chapter 5/HTML.w"
void HTML__put(OUTPUT_STREAM, int charcode) ;
#line 106 "inweb/foundation-module/Chapter 5/Epub Ebooks.w"
ebook * Epub__new(text_stream *title, char *prefix) ;
@@ -8981,11 +8985,11 @@ int CommandLine__read_pair_p(text_stream *opt, text_stream *opt_val, int N,
; innocuous = TRUE; break;
case VERSION_CLSW: {
PRINT("inweb");
- char *svn = "7.1.0-beta+1B08";
+ char *svn = "7.1.0-beta+1B09";
if (svn[0]) PRINT(" version %s", svn);
char *vname = "Escape to Danger";
if (vname[0]) PRINT(" '%s'", vname);
- char *d = "2 June 2022";
+ char *d = "3 June 2022";
if (d[0]) PRINT(" (%s)", d);
PRINT("\n");
innocuous = TRUE; break;
@@ -14758,7 +14762,19 @@ void HTML__end_colour(OUTPUT_STREAM) {
HTML_CLOSE("span");
}
-#line 896 "inweb/foundation-module/Chapter 5/HTML.w"
+#line 895 "inweb/foundation-module/Chapter 5/HTML.w"
+void HTML__begin_span(OUTPUT_STREAM, text_stream *class_name) {
+ if (Str__len(class_name) > 0) {
+ HTML_OPEN_WITH("span", "class=\"%S\"", class_name);
+ } else {
+ HTML_OPEN("span");
+ }
+}
+void HTML__end_span(OUTPUT_STREAM) {
+ HTML_CLOSE("span");
+}
+
+#line 910 "inweb/foundation-module/Chapter 5/HTML.w"
void HTML__write_xml_safe_text(OUTPUT_STREAM, text_stream *txt) {
LOOP_THROUGH_TEXT(pos, txt) {
wchar_t c = Str__get(pos);
@@ -14771,20 +14787,20 @@ void HTML__write_xml_safe_text(OUTPUT_STREAM, text_stream *txt) {
}
}
-#line 924 "inweb/foundation-module/Chapter 5/HTML.w"
+#line 938 "inweb/foundation-module/Chapter 5/HTML.w"
text_stream *source_ref_fields[3] = { NULL, NULL, NULL }; /* paraphrase, filename, line */
int source_ref_field = -1; /* which field we are buffering */
void HTML__put(OUTPUT_STREAM, int charcode) {
{
-#line 951 "inweb/foundation-module/Chapter 5/HTML.w"
+#line 965 "inweb/foundation-module/Chapter 5/HTML.w"
if ((source_ref_field >= 0) && (charcode != SOURCE_REF_CHAR)) {
PUT_TO(source_ref_fields[source_ref_field], charcode); return;
}
}
-#line 928 "inweb/foundation-module/Chapter 5/HTML.w"
+#line 942 "inweb/foundation-module/Chapter 5/HTML.w"
;
switch(charcode) {
case '"': WRITE("""); break;
@@ -14802,7 +14818,7 @@ void HTML__put(OUTPUT_STREAM, int charcode) {
#ifdef WORDS_MODULE
case SOURCE_REF_CHAR:
{
-#line 956 "inweb/foundation-module/Chapter 5/HTML.w"
+#line 970 "inweb/foundation-module/Chapter 5/HTML.w"
source_ref_field++;
if (source_ref_field == 3) {
source_ref_field = -1;
@@ -14819,7 +14835,7 @@ void HTML__put(OUTPUT_STREAM, int charcode) {
}
}
-#line 943 "inweb/foundation-module/Chapter 5/HTML.w"
+#line 957 "inweb/foundation-module/Chapter 5/HTML.w"
; break;
#endif
@@ -33205,7 +33221,7 @@ void Ctags__write(web *W, filename *F) {
WRITE("!_TAG_FILE_SORTED\t0\t/0=unsorted, 1=sorted, 2=foldcase/\n");
WRITE("!_TAG_PROGRAM_AUTHOR\tGraham Nelson\t/graham.nelson@mod-langs.ox.ac.uk/\n");
WRITE("!_TAG_PROGRAM_NAME\tinweb\t//\n");
- WRITE("!_TAG_PROGRAM_VERSION\t7.1.0-beta+1B08\t/built 2 June 2022/\n");
+ WRITE("!_TAG_PROGRAM_VERSION\t7.1.0-beta+1B09\t/built 3 June 2022/\n");
}
#line 47 "inweb/Chapter 6/Ctags Support.w"
diff --git a/build.txt b/build.txt
index bef3cf7..058d839 100644
--- a/build.txt
+++ b/build.txt
@@ -1,3 +1,3 @@
Prerelease: beta
-Build Date: 3 June 2022
-Build Number: 1B09
+Build Date: 13 June 2022
+Build Number: 1B10
diff --git a/docs/foundation-module/4-sm.html b/docs/foundation-module/4-sm.html
index 9587cee..e242614 100644
--- a/docs/foundation-module/4-sm.html
+++ b/docs/foundation-module/4-sm.html
@@ -88,7 +88,7 @@ access.
-text_stream * Str::new ( void ) {
+text_stream * Str::new ( void ) {
return Str::new_with_capacity (32);
}
@@ -184,7 +184,7 @@ thing plus a little extra, for efficiency's sake.
-int Str::atoi ( text_stream * S , int index ) {
+int Str::atoi ( text_stream * S , int index ) {
char buffer [32];
int i = 0 ;
for ( string_position P = Str::at ( S , index );
@@ -198,7 +198,7 @@ thing plus a little extra, for efficiency's sake.
-int Str::len ( text_stream * S ) {
+int Str::len ( text_stream * S ) {
return Streams::get_position ( S );
}
@@ -277,7 +277,7 @@ at those positions may well not be, of course.)
-wchar_t Str::get ( string_position P ) {
+wchar_t Str::get ( string_position P ) {
if (( P . S == NULL ) || ( P . index < 0 )) return 0 ;
return Streams::get_char_at_index ( P . S , P . index );
}
@@ -319,7 +319,7 @@ at those positions may well not be, of course.)
-void Str::clear ( text_stream * S ) {
+void Str::clear ( text_stream * S ) {
Str::truncate ( S , 0 );
}
diff --git a/docs/foundation-module/5-htm.html b/docs/foundation-module/5-htm.html
index 10a3e08..dbb8574 100644
--- a/docs/foundation-module/5-htm.html
+++ b/docs/foundation-module/5-htm.html
@@ -50,7 +50,7 @@ function togglePopup(material_id) {
Utility functions for writing HTML.
-
+
@@ -509,7 +509,7 @@ these in its World index, for instance, to clarify what abbreviations mean.)
-void HTML::icon_with_tooltip ( OUTPUT_STREAM , text_stream * icon_name ,
+void HTML::icon_with_tooltip ( OUTPUT_STREAM , text_stream * icon_name ,
text_stream * tip , text_stream * tip2 ) {
TEMPORARY_TEXT ( img )
WRITE_TO ( img , "border=0 src=%S " , icon_name );
@@ -958,7 +958,21 @@ need to run quickly.
HTML_CLOSE ( "span" );
}
-
+
+
+void HTML::begin_span ( OUTPUT_STREAM , text_stream * class_name ) {
+ if ( Str::len ( class_name ) > 0 ) {
+ HTML_OPEN_WITH ( "span" , "class=\"%S\"" , class_name );
+ } else {
+ HTML_OPEN ( "span" );
+ }
+}
+void HTML::end_span ( OUTPUT_STREAM ) {
+ HTML_CLOSE ( "span" );
+}
+
+
@@ -974,7 +988,7 @@ need to run quickly.
}
}
-
(a) if the and modules are both present, we recognise
@@ -996,7 +1010,7 @@ respectively. These do not occur in Inform source text.
int source_ref_field = -1;
void HTML::put ( OUTPUT_STREAM , int charcode ) {
- Buffer into one of the source reference fields 27.1 ;
+ Buffer into one of the source reference fields 28.1 ;
switch ( charcode ) {
case '"' : WRITE ( """ ); break ;
case '<' : WRITE ( "<" ); break ;
@@ -1011,14 +1025,14 @@ respectively. These do not occur in Inform source text.
# endif
# ifdef WORDS_MODULE
- case SOURCE_REF_CHAR: Deal with a source reference field divider 27.2 ; break ;
+ case SOURCE_REF_CHAR: Deal with a source reference field divider 28.2 ; break ;
# endif
default: PUT ( charcode ); break ;
}
}
-
@@ -1026,8 +1040,8 @@ respectively. These do not occur in Inform source text.
PUT_TO ( source_ref_fields [ source_ref_field ], charcode ); return ;
}
-This code is used in §27 .
-This code is used in §28 .
+
@@ -1046,7 +1060,7 @@ respectively. These do not occur in Inform source text.
Str::clear ( source_ref_fields [ source_ref_field ]);
}
-This code is used in §27 .
+This code is used in §28 .
diff --git a/docs/goldbach/goldbach.pdf b/docs/goldbach/goldbach.pdf
index 2e9031f9cf19f2b0f0f07d2595bd5889694d265e..badd859a60ad1f8e6e37fd38981697b024bd71ea 100644
GIT binary patch
delta 139
zcmcb&f&bnH{)QID7N#xCd?&RHjSVeLjEzmS4Gh%{4AeEb^nLSFToOxC6*OF|j0}v7
z49s9kwp*TLUdQWfX6|TeU}))T=<4ihWN7N@W@cdS;%4ORX6WYVXkcz>r(i=!$#$*l
H%qENgS<)lp
delta 139
zcmcb&f&bnH{)QID7N#xCd?&RHj17$p%}tE84Gh%{4AeEb^nLSFToOxC6*OF|j0}v7
z49s9kwp*TLUdQWfWawt;>gH@_;^Jg(ZtiSg?q*=-=wje%=4@%=W^7_+r(i=!$#$*l
H%qENgSs^3U
diff --git a/foundation-module/Chapter 5/HTML.w b/foundation-module/Chapter 5/HTML.w
index 11117ba..fbefefa 100644
--- a/foundation-module/Chapter 5/HTML.w
+++ b/foundation-module/Chapter 5/HTML.w
@@ -889,6 +889,20 @@ void HTML::end_colour(OUTPUT_STREAM) {
HTML_CLOSE("span");
}
+@h Spans by class.
+
+=
+void HTML::begin_span(OUTPUT_STREAM, text_stream *class_name) {
+ if (Str::len(class_name) > 0) {
+ HTML_OPEN_WITH("span", "class=\"%S\"", class_name);
+ } else {
+ HTML_OPEN("span");
+ }
+}
+void HTML::end_span(OUTPUT_STREAM) {
+ HTML_CLOSE("span");
+}
+
@h Writing text.
To begin with, to XML: