reference-entry-title_detail.rst 3.6 KB

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