reference-entry-summary_detail.rst 3.7 KB

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