Lines Matching refs:href

18  * Determine if a href needs rebasing.
20 static bool href_needs_rebasing(std::string const &href)
24 if ( href.empty() || (href[0] == '#') ) {
31 std::string scheme = Glib::uri_parse_scheme(href);
40 } else if (Glib::path_is_absolute(href)) {
47 * - We assume that if xlink:href is absolute then we honour it in preference to
48 * sodipodi:absref even if sodipodi:absref points to an existing file while xlink:href
49 * doesn't. This is because we aren't aware of any bugs in xlink:href handling when
53 * confident of our handling of xlink:href and xlink:base, we should clear it.
62 static std::string calc_abs_href(std::string const &abs_base_dir, std::string const &href,
65 std::string ret = Glib::build_filename(abs_base_dir, href);
71 /* sodipodi:absref points to an existing file while xlink:href doesn't.
72 * This could mean that xlink:href is wrong, or it could mean that the user
76 * wrong xlink:href value may mean a bug (as has occurred in the past), we
78 g_warning("xlink:href points to non-existent file, so using sodipodi:absref instead");
81 * aren't yet confident in xlink:href interpretation); though note that
82 * honouring a foreign attribute in preference to standard SVG xlink:href and
84 * we hope to have enough confidence in our xlink:href and xlink:base handling
111 GQuark const href_key = g_quark_from_static_string("xlink:href");
114 /* First search attributes for xlink:href and sodipodi:absref, putting the rest in ret.
116 * However, if we find that xlink:href doesn't need rebasing, then return immediately
139 * no xlink:href attribute. However, retaining it might be more cautious.
160 // std::string Inkscape::XML::rebase_href_attrs( std::string const &oldAbsBase, std::string const &newAbsBase, gchar const * /*href*/, gchar const */*absref*/ )
178 * relative URL/IRI href processing (with liburiparser).
210 * (taken from the union of the xlink:href elements listed at
221 * Note also that Inkscape only supports fragment hrefs (href="#pattern257") for many of these
229 gchar const *tmp = ir->attribute("xlink:href");
240 std::string href = uri;
241 if ( Glib::path_is_absolute(href) ) {
242 href = sp_relative_path_from_path(uri, old_abs_base);
245 if ( Glib::path_is_absolute(href) ) {
246 href = sp_relative_path_from_path(uri, new_abs_base);
253 if ( !Glib::path_is_absolute(href) ) {
254 std::replace(href.begin(), href.end(), '/', '\\');
258 /* TODO: Most of this function currently treats href as if it were a simple filename
260 * changing non-file hrefs), which breaks if href starts with a scheme or if href contains
263 if ( href_needs_rebasing(href) ) {
264 std::string abs_href = calc_abs_href(old_abs_base, href, ir->attribute("sodipodi:absref"));
280 /* Native Windows path separators are replaced with / so that the href
282 std::replace(href.begin(), href.end(), '\\', '/');
284 ir->setAttribute("xlink:href", new_href.c_str());
286 ir->setAttribute("xlink:href", g_filename_to_uri(new_href.c_str(), NULL, NULL));
292 * be wrong, then leaving it means risking leaving the wrong value (if xlink:href