From 52813d732800105389894b406653c5002c2d8819 Mon Sep 17 00:00:00 2001 From: Jake Stockwin Date: Tue, 22 Sep 2020 09:26:35 +0100 Subject: [PATCH] [docs] Fix typo in simple memo example --- CHANGELOG.md | 2 ++ docs/source/examples/simple_memo.rst | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa8cfd4d..bc59a59b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Fixed a typo in simple memo example in the documentation. ([#121](https://github.com/jstockwin/py-pdf-parser/pull/121)) ## [0.5.0] - 2020-07-05 ### Added diff --git a/docs/source/examples/simple_memo.rst b/docs/source/examples/simple_memo.rst index 25622721..b2e02a7d 100644 --- a/docs/source/examples/simple_memo.rst +++ b/docs/source/examples/simple_memo.rst @@ -47,7 +47,7 @@ We will extract the "TO:", "FROM:", "DATE:" and "SUBJECT:" elements as reference .. image:: /screenshots/simple_memo_example/top.png :height: 200px -To extract the element which says "TO:", we can simply run :meth:`document.elements.filter_by_font("TO:") `. This returns a new :class:`~py_pdf_parser.filtering.ElementList` which contains all the elements in the document with text equal to "TO:". In this case, there should only be one element in the list. We could just use ``[0]`` on the element list to access the element in question, however, there is a convenience function, :func:`~py_pdf_parser.filtering.ElementList.extract_single_element` on the :class:`~py_pdf_parser.filtering.ElementList` class to handle this case. This essentially checks if the list has a single element and returns the element for you, otherwise it raises an exception. Use of this is encouraged to make your code more robust and to make any errors more explicit. +To extract the element which says "TO:", we can simply run :meth:`document.elements.filter_by_text_equal("TO:") `. This returns a new :class:`~py_pdf_parser.filtering.ElementList` which contains all the elements in the document with text equal to "TO:". In this case, there should only be one element in the list. We could just use ``[0]`` on the element list to access the element in question, however, there is a convenience function, :func:`~py_pdf_parser.filtering.ElementList.extract_single_element` on the :class:`~py_pdf_parser.filtering.ElementList` class to handle this case. This essentially checks if the list has a single element and returns the element for you, otherwise it raises an exception. Use of this is encouraged to make your code more robust and to make any errors more explicit. .. code-block:: python