reference-feed-title_detail.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. .. _reference.feed.title_detail:
  2. :py:attr:`feed.title_detail`
  3. ============================
  4. A dictionary with details about the feed title.
  5. .. _reference.feed.title_detail.value:
  6. :py:attr:`feed.title_detail.value`
  7. ----------------------------------
  8. Same as :ref:`reference.feed.title`.
  9. If this contains :abbr:`HTML (HyperText Markup Language)` or :abbr:`XHTML
  10. (Extensible HyperText Markup Language)`, it is :ref:`sanitized
  11. <advanced.sanitization>` by default.
  12. If this contains :abbr:`HTML (HyperText Markup Language)` or :abbr:`XHTML
  13. (Extensible HyperText Markup Language)`, certain (X)HTML elements within this
  14. value may contain relative :abbr:`URI (Uniform Resource Identifier)`\s. If so,
  15. they are :ref:`resolved according to a set of rules <advanced.base>`.
  16. .. _reference.feed.title_detail.type:
  17. :py:attr:`feed.title_detail.type`
  18. ---------------------------------
  19. The content type of the feed title.
  20. Most likely values for :py:attr:`~feed.title_detail.type`:
  21. * :mimetype:`text/plain`
  22. * :mimetype:`text/html`
  23. * :mimetype:`application/xhtml+xml`
  24. For Atom feeds, the content type is taken from the type attribute, which
  25. defaults to :mimetype:`text/plain` if not specified. For :abbr:`RSS (Rich Site
  26. Summary)` feeds, the content type is auto-determined by inspecting the content,
  27. and defaults to :mimetype:`text/html`. Note that this may cause silent data
  28. loss if the value contains plain text with angle brackets. There is nothing I
  29. can do about this problem; it is a limitation of :abbr:`RSS (Rich Site
  30. Summary)`.
  31. Future enhancement: some versions of :abbr:`RSS (Rich Site Summary)` clearly
  32. specify that certain values default to :mimetype:`text/plain`, and
  33. :program:`Universal Feed Parser` should respect this, but it doesn't yet.
  34. .. _reference.feed.title_detail.language:
  35. :py:attr:`feed.title_detail.language`
  36. -------------------------------------
  37. The language of the feed title.
  38. :py:attr:`~feed.title_detail.language` is supposed to be a language code, as
  39. specified by `:abbr:`RFC (Request For Comments)` 3066
  40. <http://www.ietf.org/rfc/rfc3066.txt>`_, but publishers have been known to
  41. publish random values like "English" or "German". :program:`Universal Feed
  42. Parser` does not do any parsing or normalization of language codes.
  43. :py:attr:`~feed.title_detail.language` may come from the element's xml:lang
  44. attribute, or it may inherit from a parent element's xml:lang, or the
  45. Content-Language :abbr:`HTTP (Hypertext Transfer Protocol)` header. If the
  46. feed does not specify a language, :py:attr:`~feed.title_detail.language` will
  47. be ``None``, the :program:`Python` null value.
  48. :py:attr:`feed.title_detail.base`
  49. ---------------------------------
  50. The original base :abbr:`URI (Uniform Resource Identifier)` for links within
  51. the feed title.
  52. :py:attr:`~feed.title_detail.base` is only useful in rare situations and can
  53. usually be ignored. It is the original base :abbr:`URI (Uniform Resource
  54. Identifier)` for this value, as specified by the element's xml:base attribute,
  55. or a parent element's xml:base, or the appropriate :abbr:`HTTP (Hypertext
  56. Transfer Protocol)` header, or the :abbr:`URI (Uniform Resource Identifier)` of
  57. the feed. (See :ref:`advanced.base` for more details.) By the time you see
  58. it, :program:`Universal Feed Parser` has already resolved relative links in all
  59. values where it makes sense to do so. *Clients should never need to manually
  60. resolve relative links.*
  61. .. rubric:: Comes from
  62. * /atom03:feed/atom03:title
  63. * /atom10:feed/atom10:title
  64. * /rdf:RDF/rdf:channel/dc:title
  65. * /rdf:RDF/rdf:channel/rdf:title
  66. * /rss/channel/dc:title
  67. * /rss/channel/title
  68. .. seealso::
  69. * :ref:`reference.feed.title`