From a372dd80bdf749bb4cea4a60496c3e2d98f31f82 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 14 Sep 2024 08:06:26 +0300 Subject: [PATCH] add plain text maker --- .../tab/page/content/text/gemini/reader.cpp | 20 +++++++++++++++---- .../tab/page/content/text/gemini/reader.hpp | 4 ++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/app/browser/main/tab/page/content/text/gemini/reader.cpp b/src/app/browser/main/tab/page/content/text/gemini/reader.cpp index 05881f94..1be901ef 100644 --- a/src/app/browser/main/tab/page/content/text/gemini/reader.cpp +++ b/src/app/browser/main/tab/page/content/text/gemini/reader.cpp @@ -161,7 +161,7 @@ Glib::ustring Reader::make( continue; } - // Header + // Quote Glib::ustring quote; if (Line::Match::quote(line, quote)) @@ -177,10 +177,11 @@ Glib::ustring Reader::make( // @TODO other tags.. + // Default pango.append( - line.append( - "\n" - ) // @TODO + Make::plain( + line + ) ); } @@ -261,6 +262,17 @@ Glib::ustring Reader::Make::link( ); } +Glib::ustring Reader::Make::plain( + const Glib::ustring & TEXT +) { + return Glib::ustring::sprintf( + "%s\n", + Glib::Markup::escape_text( + TEXT + ) + ); +} + Glib::ustring Reader::Make::quote( const Glib::ustring & TEXT ) { diff --git a/src/app/browser/main/tab/page/content/text/gemini/reader.hpp b/src/app/browser/main/tab/page/content/text/gemini/reader.hpp index feaf543e..0d0b2d38 100644 --- a/src/app/browser/main/tab/page/content/text/gemini/reader.hpp +++ b/src/app/browser/main/tab/page/content/text/gemini/reader.hpp @@ -52,6 +52,10 @@ namespace app::browser::main::tab::page::content::text::gemini const Glib::ustring & ALT ); + static Glib::ustring plain( + const Glib::ustring & TEXT + ); + static Glib::ustring quote( const Glib::ustring & TEXT );