Description of the problem
It seems that there is no function in the HTML4 library that has the signature
HTML4.html -> string. Could such a function be added to the HTML4 library?
If not, is there any way to convert a HTML4.html value into a string?
Comments from smlnj-gforge
Original smlnj-gforge bug number 308
Submitted on 2022-05-14 at 00:38:00
comment by @JohnReppy on 2022-06-30 13:36:00 +000 UTC
It is straightforward to generate a string from the existing API. Using a CharBuffer.buffer, the following code does so:
fun toString html = let
val buf = CharBuffer.new 1024
in
HTML4Print.prHTML {
putc = fn c => CharBuffer.add1 (buf, c),
puts = fn s => CharBuffer.addVec (buf, s)
} html;
CharBuffer.contents buf
end;
I've added this sample code to the header comment for the HTML4Print module and will include it in the documentation (when we get to it).
comment by @JohnReppy on 2022-07-11 18:50:00 +000 UTC
Moved to feature requests
Description of the problem
It seems that there is no function in the HTML4 library that has the signature
HTML4.html -> string. Could such a function be added to the HTML4 library?
If not, is there any way to convert a HTML4.html value into a string?
Comments from smlnj-gforge
Original smlnj-gforge bug number 308
Submitted on 2022-05-14 at 00:38:00
comment by @JohnReppy on 2022-06-30 13:36:00 +000 UTC
It is straightforward to generate a string from the existing API. Using a
CharBuffer.buffer, the following code does so:I've added this sample code to the header comment for the
HTML4Printmodule and will include it in the documentation (when we get to it).comment by @JohnReppy on 2022-07-11 18:50:00 +000 UTC
Moved to feature requests