reference-feed-subtitle_detail.rst 3.7 KB

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