mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
resolve relative links
This commit is contained in:
parent
e8e46a6217
commit
1c5a8d58f0
9 changed files with 28 additions and 23 deletions
|
|
@ -351,6 +351,7 @@ void Page::navigation_reload(
|
||||||
// Set content driver
|
// Set content driver
|
||||||
pageContent->update(
|
pageContent->update(
|
||||||
page::Content::TEXT_GEMINI,
|
page::Content::TEXT_GEMINI,
|
||||||
|
pageNavigation->get_request_text(),
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@ Glib::ustring Content::get_title()
|
||||||
// Setters
|
// Setters
|
||||||
void Content::update(
|
void Content::update(
|
||||||
const MIME & MIME,
|
const MIME & MIME,
|
||||||
const Glib::ustring & DATA
|
const Glib::ustring & REQUEST,
|
||||||
|
const Glib::ustring & SOURCE
|
||||||
) {
|
) {
|
||||||
// Cleanup, free memory
|
// Cleanup, free memory
|
||||||
if (contentText != nullptr)
|
if (contentText != nullptr)
|
||||||
|
|
@ -63,7 +64,8 @@ void Content::update(
|
||||||
|
|
||||||
contentText = new content::Text(
|
contentText = new content::Text(
|
||||||
content::Text::Type::GEMINI,
|
content::Text::Type::GEMINI,
|
||||||
DATA
|
REQUEST,
|
||||||
|
SOURCE
|
||||||
);
|
);
|
||||||
|
|
||||||
title = contentText->get_title();
|
title = contentText->get_title();
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ namespace app::browser::main::tab::page
|
||||||
// Actions
|
// Actions
|
||||||
void update(
|
void update(
|
||||||
const MIME & MIME,
|
const MIME & MIME,
|
||||||
const Glib::ustring & DATA
|
const Glib::ustring & REQUEST,
|
||||||
|
const Glib::ustring & SOURCE
|
||||||
);
|
);
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@ using namespace app::browser::main::tab::page::content;
|
||||||
|
|
||||||
Text::Text(
|
Text::Text(
|
||||||
const Type & TYPE,
|
const Type & TYPE,
|
||||||
const Glib::ustring & TEXT
|
const Glib::ustring & REQUEST,
|
||||||
|
const Glib::ustring & SOURCE
|
||||||
) {
|
) {
|
||||||
switch (TYPE)
|
switch (TYPE)
|
||||||
{
|
{
|
||||||
|
|
@ -14,7 +15,8 @@ Text::Text(
|
||||||
|
|
||||||
set_child(
|
set_child(
|
||||||
* Gtk::make_managed<text::Gemini>(
|
* Gtk::make_managed<text::Gemini>(
|
||||||
TEXT,
|
REQUEST,
|
||||||
|
SOURCE,
|
||||||
title
|
title
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -25,7 +27,7 @@ Text::Text(
|
||||||
|
|
||||||
set_child(
|
set_child(
|
||||||
* Gtk::make_managed<text::Plain>(
|
* Gtk::make_managed<text::Plain>(
|
||||||
TEXT
|
SOURCE
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ namespace app::browser::main::tab::page::content
|
||||||
*/
|
*/
|
||||||
Text(
|
Text(
|
||||||
const Type & TYPE,
|
const Type & TYPE,
|
||||||
const Glib::ustring & TEXT
|
const Glib::ustring & REQUEST,
|
||||||
|
const Glib::ustring & SOURCE
|
||||||
);
|
);
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
using namespace app::browser::main::tab::page::content::text;
|
using namespace app::browser::main::tab::page::content::text;
|
||||||
|
|
||||||
Gemini::Gemini(
|
Gemini::Gemini(
|
||||||
|
const Glib::ustring & REQUEST,
|
||||||
const Glib::ustring & GEMTEXT,
|
const Glib::ustring & GEMTEXT,
|
||||||
Glib::ustring & title
|
Glib::ustring & title
|
||||||
) : Gtk::Viewport( // add scrolled window features to childs
|
) : Gtk::Viewport( // add scrolled window features to childs
|
||||||
|
|
@ -17,6 +18,7 @@ Gemini::Gemini(
|
||||||
|
|
||||||
set_child(
|
set_child(
|
||||||
* Gtk::make_managed<gemini::Reader>(
|
* Gtk::make_managed<gemini::Reader>(
|
||||||
|
REQUEST,
|
||||||
GEMTEXT,
|
GEMTEXT,
|
||||||
title
|
title
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ namespace app::browser::main::tab::page::content::text
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Gemini(
|
Gemini(
|
||||||
|
const Glib::ustring & REQUEST,
|
||||||
const Glib::ustring & GEMTEXT,
|
const Glib::ustring & GEMTEXT,
|
||||||
Glib::ustring & title
|
Glib::ustring & title
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
using namespace app::browser::main::tab::page::content::text::gemini;
|
using namespace app::browser::main::tab::page::content::text::gemini;
|
||||||
|
|
||||||
Reader::Reader(
|
Reader::Reader(
|
||||||
|
const Glib::ustring & REQUEST,
|
||||||
const Glib::ustring & GEMTEXT,
|
const Glib::ustring & GEMTEXT,
|
||||||
Glib::ustring & title
|
Glib::ustring & title
|
||||||
) {
|
) {
|
||||||
|
|
@ -47,6 +48,7 @@ Reader::Reader(
|
||||||
{
|
{
|
||||||
markup.append(
|
markup.append(
|
||||||
Make::link(
|
Make::link(
|
||||||
|
REQUEST,
|
||||||
address,
|
address,
|
||||||
date,
|
date,
|
||||||
alt
|
alt
|
||||||
|
|
@ -245,6 +247,7 @@ Glib::ustring Reader::Make::header(
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::ustring Reader::Make::link(
|
Glib::ustring Reader::Make::link(
|
||||||
|
const Glib::ustring & BASE,
|
||||||
const Glib::ustring & ADDRESS,
|
const Glib::ustring & ADDRESS,
|
||||||
const Glib::ustring & DATE,
|
const Glib::ustring & DATE,
|
||||||
const Glib::ustring & ALT
|
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(
|
return Glib::ustring::sprintf(
|
||||||
"<a href=\"%s\" title=\"%s\">%s</a>\n",
|
"<a href=\"%s\" title=\"%s\">%s</a>\n",
|
||||||
Glib::Markup::escape_text(
|
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(
|
Glib::Markup::escape_text(
|
||||||
ADDRESS
|
ADDRESS
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ namespace app::browser::main::tab::page::content::text::gemini
|
||||||
);
|
);
|
||||||
|
|
||||||
static Glib::ustring link(
|
static Glib::ustring link(
|
||||||
|
const Glib::ustring & REQUEST,
|
||||||
const Glib::ustring & ADDRESS,
|
const Glib::ustring & ADDRESS,
|
||||||
const Glib::ustring & DATE,
|
const Glib::ustring & DATE,
|
||||||
const Glib::ustring & ALT
|
const Glib::ustring & ALT
|
||||||
|
|
@ -68,6 +69,7 @@ namespace app::browser::main::tab::page::content::text::gemini
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Reader(
|
Reader(
|
||||||
|
const Glib::ustring & REQUEST,
|
||||||
const Glib::ustring & GEMTEXT,
|
const Glib::ustring & GEMTEXT,
|
||||||
Glib::ustring & title
|
Glib::ustring & title
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue