class_docstr: Represents a content.
  
  :param content: the string to parse, containing the original content.
  :param metadata: the metadata associated to this page (optional).
  :param settings: the settings dictionary (optional).
  :param source_path: The location of the source of this content (if any).
  :param context: The shared context between generators.
code: def _link_replacer(self, siteurl, m):
      what = m.group("what")
      value = urlparse(m.group("value"))
      path = value.path
      origin = m.group("path")
  
      # urllib.parse.urljoin() produces `a.html` for urljoin("..", "a.html")
      # so if RELATIVE_URLS are enabled, we fall back to os.path.join() to
      # properly get `../a.html`. However, os.path.join() produces
      # `baz/http://foo/bar.html` for join("baz", "http://foo/bar.html")
      # instead of correct "http://foo/bar.html", so one has to pick a side
      # as there is no silver bullet.
      if self.settings["RELATIVE_URLS"]:
          joiner = os.path.join
      else:
          joiner = urljoin
  
          # However, it's not *that* simple: urljoin("blog", "index.html")
          # produces just `index.html` instead of `blog/index.html` (unlike
          # os.path.join()), so in order to get a correct answer one needs to
          # append a trailing slash to siteurl in that case. This also makes
          # the new behavior fully compatible with Pelican 3.7.1.
          if not siteurl.endswith("/"):
              siteurl += "/"
  
      # XXX Put this in a different location.
      if what in {"filename", "static", "attach"}:
  
          def _get_linked_content(key, url):
              nonlocal value
  
              def _find_path(path):
                  if path.startswith("/"):
                      path = path[1:]
                  else:
                      # relative to the source path of this content
                      path = self.get_relative_source_path(
                          os.path.join(self.relative_dir, path)
                      )
                  return self._context[key].get(path, None)
  
              # try path
              result = _find_path(url.path)
              if result is not None:
                  return result
  
              # try unquoted path
              result = _find_path(unquote(url.path))
              if result is not None:
                  return result
  
              # try html unescaped url
              unescaped_url = urlparse(unescape(url.geturl()))
              result = _find_path(unescaped_url.path)
              if result is not None:
                  value = unescaped_url
                  return result
  
              # check if a static file is linked with {filename}
              if what == "filename" and key == "generated_content":
                  linked_content = _get_linked_content(
                      "static_content", value
                  )
                  if linked_content:
                      logger.warning(
                          "{filename} used for linking to static"
                          " content %s in %s. Use {static} instead",
                          value.path,
                          self.get_relative_source_path(),
                      )
                      return linked_content
  
              return None
  
          if what == "filename":
              key = "generated_content"
          else:
              key = "static_content"
  
          linked_content = _get_linked_content(key, value)
          if linked_content:
              if what == "attach":
                  linked_content.attach_to(self)
              origin = joiner(siteurl, linked_content.url)
              origin = origin.replace("\\", "/")  # for Windows paths.
          else:
              logger.warning(
                  "Unable to find '%s', skipping url replacement.",
                  value.geturl(),
                  extra={
                      "limit_msg": (
                          "Other resources were not found "
                          "and their urls not replaced"
                      )
                  },
              )
      elif what == "category":
          origin = joiner(siteurl, Category(path, self.settings).url)
      elif what == "tag":
          origin = joiner(siteurl, Tag(path, self.settings).url)
      elif what == "index":
          origin = joiner(siteurl, self.settings["INDEX_SAVE_AS"])
      elif what == "author":
          origin = joiner(siteurl, Author(path, self.settings).url)
      else:
          logger.warning(
              "Replacement Indicator '%s' not recognized, "
              "skipping replacement",
              what,
          )
  
      # keep all other parts, such as query, fragment, etc.
      parts = list(value)
      parts[2] = origin
      origin = urlunparse(parts)
  
      return "".join(
          (
              m.group("markup"),
              m.group("quote"),
              origin,
              m.group("quote"),
          )
      )
  
imports: import copy
  import datetime
  import locale
  import logging
  import os
  import re
  from datetime import timezone
  from html import unescape
  from urllib.parse import unquote, urljoin, urlparse, urlunparse
  from pelican.plugins import signals
  from pelican.settings import DEFAULT_CONFIG
  from pelican.utils import deprecated_attribute, memoized, path_to_url, posixize_path, sanitised_join, set_date_tzinfo, slugify, truncate_html_words
  from pelican.urlwrappers import Author, Category, Tag, URLWrapper
label_desc: Use image node_id 11 for calling the Content obj's underlying member method code with example usage: obj._link_replacer(siteurl, m) and returns: str, None, self, result, result, result, linked_content