mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-29 20:44:25 +00:00
resolve relative links
This commit is contained in:
parent
e8e46a6217
commit
1c5a8d58f0
@ -351,6 +351,7 @@ void Page::navigation_reload(
|
||||
// Set content driver
|
||||
pageContent->update(
|
||||
page::Content::TEXT_GEMINI,
|
||||
pageNavigation->get_request_text(),
|
||||
buffer
|
||||
);
|
||||
|
||||
|
@ -40,7 +40,8 @@ Glib::ustring Content::get_title()
|
||||
// Setters
|
||||
void Content::update(
|
||||
const MIME & MIME,
|
||||
const Glib::ustring & DATA
|
||||
const Glib::ustring & REQUEST,
|
||||
const Glib::ustring & SOURCE
|
||||
) {
|
||||
// Cleanup, free memory
|
||||
if (contentText != nullptr)
|
||||
@ -63,7 +64,8 @@ void Content::update(
|
||||
|
||||
contentText = new content::Text(
|
||||
content::Text::Type::GEMINI,
|
||||
DATA
|
||||
REQUEST,
|
||||
SOURCE
|
||||
);
|
||||
|
||||
title = contentText->get_title();
|
||||
|
@ -42,7 +42,8 @@ namespace app::browser::main::tab::page
|
||||
// Actions
|
||||
void update(
|
||||
const MIME & MIME,
|
||||
const Glib::ustring & DATA
|
||||
const Glib::ustring & REQUEST,
|
||||
const Glib::ustring & SOURCE
|
||||
);
|
||||
|
||||
// Getters
|
||||
|
@ -6,7 +6,8 @@ using namespace app::browser::main::tab::page::content;
|
||||
|
||||
Text::Text(
|
||||
const Type & TYPE,
|
||||
const Glib::ustring & TEXT
|
||||
const Glib::ustring & REQUEST,
|
||||
const Glib::ustring & SOURCE
|
||||
) {
|
||||
switch (TYPE)
|
||||
{
|
||||
@ -14,7 +15,8 @@ Text::Text(
|
||||
|
||||
set_child(
|
||||
* Gtk::make_managed<text::Gemini>(
|
||||
TEXT,
|
||||
REQUEST,
|
||||
SOURCE,
|
||||
title
|
||||
)
|
||||
);
|
||||
@ -25,7 +27,7 @@ Text::Text(
|
||||
|
||||
set_child(
|
||||
* Gtk::make_managed<text::Plain>(
|
||||
TEXT
|
||||
SOURCE
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -30,7 +30,8 @@ namespace app::browser::main::tab::page::content
|
||||
*/
|
||||
Text(
|
||||
const Type & TYPE,
|
||||
const Glib::ustring & TEXT
|
||||
const Glib::ustring & REQUEST,
|
||||
const Glib::ustring & SOURCE
|
||||
);
|
||||
|
||||
// Getters
|
||||
|
@ -4,6 +4,7 @@
|
||||
using namespace app::browser::main::tab::page::content::text;
|
||||
|
||||
Gemini::Gemini(
|
||||
const Glib::ustring & REQUEST,
|
||||
const Glib::ustring & GEMTEXT,
|
||||
Glib::ustring & title
|
||||
) : Gtk::Viewport( // add scrolled window features to childs
|
||||
@ -17,6 +18,7 @@ Gemini::Gemini(
|
||||
|
||||
set_child(
|
||||
* Gtk::make_managed<gemini::Reader>(
|
||||
REQUEST,
|
||||
GEMTEXT,
|
||||
title
|
||||
)
|
||||
|
@ -14,6 +14,7 @@ namespace app::browser::main::tab::page::content::text
|
||||
public:
|
||||
|
||||
Gemini(
|
||||
const Glib::ustring & REQUEST,
|
||||
const Glib::ustring & GEMTEXT,
|
||||
Glib::ustring & title
|
||||
);
|
||||
|
@ -3,6 +3,7 @@
|
||||
using namespace app::browser::main::tab::page::content::text::gemini;
|
||||
|
||||
Reader::Reader(
|
||||
const Glib::ustring & REQUEST,
|
||||
const Glib::ustring & GEMTEXT,
|
||||
Glib::ustring & title
|
||||
) {
|
||||
@ -47,6 +48,7 @@ Reader::Reader(
|
||||
{
|
||||
markup.append(
|
||||
Make::link(
|
||||
REQUEST,
|
||||
address,
|
||||
date,
|
||||
alt
|
||||
@ -245,6 +247,7 @@ Glib::ustring Reader::Make::header(
|
||||
}
|
||||
|
||||
Glib::ustring Reader::Make::link(
|
||||
const Glib::ustring & BASE,
|
||||
const Glib::ustring & ADDRESS,
|
||||
const Glib::ustring & DATE,
|
||||
const Glib::ustring & ALT
|
||||
@ -265,25 +268,15 @@ Glib::ustring Reader::Make::link(
|
||||
);
|
||||
}
|
||||
|
||||
/* @TODO
|
||||
|
||||
GError * error;
|
||||
|
||||
g_uri_resolve_relative(
|
||||
get_text().c_str(),
|
||||
get_text().c_str(),
|
||||
G_URI_FLAGS_NONE,
|
||||
&error
|
||||
);
|
||||
|
||||
if (NULL)
|
||||
|
||||
*/
|
||||
|
||||
return Glib::ustring::sprintf(
|
||||
"<a href=\"%s\" title=\"%s\">%s</a>\n",
|
||||
Glib::Markup::escape_text(
|
||||
ADDRESS // @TODO to absolute
|
||||
g_uri_resolve_relative(
|
||||
BASE.c_str(),
|
||||
ADDRESS.c_str(),
|
||||
G_URI_FLAGS_NONE,
|
||||
NULL // GError * @TODO
|
||||
)
|
||||
),
|
||||
Glib::Markup::escape_text(
|
||||
ADDRESS
|
||||
|
@ -48,6 +48,7 @@ namespace app::browser::main::tab::page::content::text::gemini
|
||||
);
|
||||
|
||||
static Glib::ustring link(
|
||||
const Glib::ustring & REQUEST,
|
||||
const Glib::ustring & ADDRESS,
|
||||
const Glib::ustring & DATE,
|
||||
const Glib::ustring & ALT
|
||||
@ -68,6 +69,7 @@ namespace app::browser::main::tab::page::content::text::gemini
|
||||
public:
|
||||
|
||||
Reader(
|
||||
const Glib::ustring & REQUEST,
|
||||
const Glib::ustring & GEMTEXT,
|
||||
Glib::ustring & title
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user