mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:58:11 +00:00
LibWeb: Add debug toggle for dumping gemini documents
This commit is contained in:
parent
c8322719c6
commit
fa5217ff4f
1 changed files with 11 additions and 2 deletions
|
@ -38,6 +38,8 @@
|
||||||
#include <LibWeb/Page/Frame.h>
|
#include <LibWeb/Page/Frame.h>
|
||||||
#include <LibWeb/Page/Page.h>
|
#include <LibWeb/Page/Page.h>
|
||||||
|
|
||||||
|
//#define GEMINI_DEBUG 1
|
||||||
|
|
||||||
namespace Web {
|
namespace Web {
|
||||||
|
|
||||||
FrameLoader::FrameLoader(Frame& frame)
|
FrameLoader::FrameLoader(Frame& frame)
|
||||||
|
@ -115,9 +117,16 @@ static RefPtr<DOM::Document> create_image_document(const ByteBuffer& data, const
|
||||||
|
|
||||||
static RefPtr<DOM::Document> create_gemini_document(const ByteBuffer& data, const URL& url)
|
static RefPtr<DOM::Document> create_gemini_document(const ByteBuffer& data, const URL& url)
|
||||||
{
|
{
|
||||||
auto gemini_document = Gemini::Document::parse({ (const char*)data.data(), data.size() }, url);
|
StringView gemini_data { data };
|
||||||
|
auto gemini_document = Gemini::Document::parse(gemini_data, url);
|
||||||
|
String html_data = gemini_document->render_to_html();
|
||||||
|
|
||||||
return HTML::parse_html_document(gemini_document->render_to_html(), url, "utf-8");
|
#if GEMINI_DEBUG
|
||||||
|
dbgln("Gemini data:\n\"\"\"{}\"\"\"", gemini_data);
|
||||||
|
dbgln("Converted to HTML:\n\"\"\"{}\"\"\"", html_data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return HTML::parse_html_document(move(html_data), url, "utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<DOM::Document> FrameLoader::create_document_from_mime_type(const ByteBuffer& data, const URL& url, const String& mime_type, const String& encoding)
|
RefPtr<DOM::Document> FrameLoader::create_document_from_mime_type(const ByteBuffer& data, const URL& url, const String& mime_type, const String& encoding)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue