Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic support for callout blocks #29

Merged
merged 11 commits into from
May 17, 2022
Merged

Add basic support for callout blocks #29

merged 11 commits into from
May 17, 2022

Commits on May 10, 2022

  1. Add basic support for callout blocks

    Currently, it just prints the content of the block but ignores the emoji
    and color.
    
    Closes #26
    johndgiese committed May 10, 2022
    Configuration menu
    Copy the full SHA
    9438df5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    aa8027a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9a24b47 View commit details
    Browse the repository at this point in the history

Commits on May 15, 2022

  1. Refactor block class constructor

    Previously, the Block class constructor would iterate through all of the
    top-level keys of the Notion block objects, dynamically adding
    them all as attributes the the Block instance. Then, it would loop
    through all of the block-specific keys and also add them as attributes.
    Although this was working, in some cases the block-specific keys
    would over-ride the top-level keys (e.g., the "type" key in particular
    was being shadowed in a few cases).
    
    Dynamically adding the keys makes it more difficult to read and debug the code,
    since you don't know what keys are going to be set until run-time. This
    makes writing plugins more difficult. Also, errors due to changes in the
    notion API (or even issues with poorly constructed mock test data) don't
    appear until the expected keys are used in the `to_pandoc` calls, rather
    than during the constructors.
    
    This commit explicilty sets all of the top-level keys. It also moves the
    "type" key into the "notion_type" attribute, which avoids shadowing
    issues if the block-specific object has a "type" key. The "id" key was
    also moved to "notion_id".
    
    After making this change, the unit tests were failing since now some of
    the top-level keys that previously weren't being set in the unit tests
    were now missing. To ensure that these keys are always present, the
    tests were updated to use a set of mock objects that ensure the keys
    always exist.
    
    Furthermore, the tests related to the rich_text objects were split out
    into their own file.
    
    Duplication in the test was also removed through the addition of the
    `process_block` and `process_parent_block` functions.
    
    There is a second refactor which I believe should occur, which is to
    move the block-specific attributes into each block's constructors. This
    will make the block-specific attribute construction more explicit as
    well, which is good for all of the reasons stated above. A bit of work
    in this direction was made, but more work is needed.
    johndgiese committed May 15, 2022
    Configuration menu
    Copy the full SHA
    348ae2f View commit details
    Browse the repository at this point in the history
  2. Rename block classes so they all end with "Block"

    Although it makes a few of the names kind of long, the consistency seems
    worthwhile.
    johndgiese committed May 15, 2022
    Configuration menu
    Copy the full SHA
    f253a13 View commit details
    Browse the repository at this point in the history
  3. Delete notion complex list file; fix typos

    The json file isn't needed or worth maintaining now that we have end to
    end tests.
    johndgiese committed May 15, 2022
    Configuration menu
    Copy the full SHA
    5ace528 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6d0f7e0 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    6da5016 View commit details
    Browse the repository at this point in the history

Commits on May 16, 2022

  1. Make block-specific attributes explicit; remove the placeholder block…

    … classes
    
    See the deleted TODO comments in the commit for the motiviation for
    these refactors.
    johndgiese committed May 16, 2022
    Configuration menu
    Copy the full SHA
    7778902 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a6885e8 View commit details
    Browse the repository at this point in the history

Commits on May 17, 2022

  1. Fix a few bugs

    - Remove a leftover print statement
    - Fix argument bug
    - Fix issue with block retrieval that (I think) was due to the notion
      API changing out from under us.
    johndgiese committed May 17, 2022
    Configuration menu
    Copy the full SHA
    7fd90a5 View commit details
    Browse the repository at this point in the history