Skip to content

Commit

Permalink
[docs] Fix typo in simple memo example
Browse files Browse the repository at this point in the history
  • Loading branch information
jstockwin committed Sep 22, 2020
1 parent 9213bf7 commit 52813d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/simple_memo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:") <py_pdf_parser.filtering.ElementList.filter_by_font>`. 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:") <py_pdf_parser.filtering.ElementList.filter_by_text_equal>`. 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
Expand Down

0 comments on commit 52813d7

Please sign in to comment.