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

[MRG] Add syntax highlighting to code blocks #110

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Commits on Sep 3, 2021

  1. Remove the code effect

    I think the Effect may make it difficult/impossible to apply syntax
    highlighting to static text
    bkjohnson committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    9fe2ceb View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2021

  1. Render highlighted text on slide w/ placeholder

    The paint() function seems like the simplest way of rendering
    highlighted text, and it's only available on Screen or Canvas objects.
    This is why I'm not using an Effect for a code block.
    bkjohnson committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    08b6f1f View commit details
    Browse the repository at this point in the history
  2. Remove screen from the tuple

    We are no longer calling the _code() function, so we don't need to store
    the data in the same way. The code element tells us what to render, and
    the row will tell us where to place it on the slide.
    
    _code() will be removed later.
    bkjohnson committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    904015c View commit details
    Browse the repository at this point in the history
  3. Refactor into function for rendering entire block

    From this function we should be able to get the language from the block,
    then highlight and paint line by line
    bkjohnson committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    98982e7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9a6452e View commit details
    Browse the repository at this point in the history
  5. Avoid going out of range on the slides index

    Once we get to the restart page, the animation loop keeps running and we
    get an error if we try to set `cur_slide` normally.
    bkjohnson committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    9b195dd View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2021

  1. Configuration menu
    Copy the full SHA
    abadc0f View commit details
    Browse the repository at this point in the history
  2. Switch parsers and don't use raw_text prop

    This solves the character rendering problems
    bkjohnson committed Sep 6, 2021
    Configuration menu
    Copy the full SHA
    cf796e1 View commit details
    Browse the repository at this point in the history
  3. Add padded box around code

    bkjohnson committed Sep 6, 2021
    Configuration menu
    Copy the full SHA
    5f9a6c8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    01f243a View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2021

  1. Add to code_blocks directly instead of effects

    I don't like modifying slide.code_blocks in the get_effects function.
    The reason I'm doing it is because that is where we determine what row
    the code block will go on.
    bkjohnson committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    b76a280 View commit details
    Browse the repository at this point in the history
  2. Refactor relationship between Slide and Slideshow

    I don't want to get too carried away with this type of thing for this
    PR. I'm doing this to hopefully make it more obvious where code_blocks
    is coming from.
    bkjohnson committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    f866e19 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    62ed159 View commit details
    Browse the repository at this point in the history
  4. Reorder imports & rename variable

    This is just a bit of cleanup for organization & clarity.
    bkjohnson committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    e8f8e55 View commit details
    Browse the repository at this point in the history
  5. Refactor has_code to be based on code_blocks

    I tested this change by putting a fireworks effect on the slide and
    checking to see if I got the ValueError.
    bkjohnson committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    c6041b8 View commit details
    Browse the repository at this point in the history
  6. Use a custom asciimatics renderer instead

    This feels more in line with the Scene/Effect structure of the project.
    bkjohnson committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    952e692 View commit details
    Browse the repository at this point in the history
  7. Remove extra whitespace

    bkjohnson committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    f0d1405 View commit details
    Browse the repository at this point in the history
  8. Add colour & bg args back in

    This doesn't change the functionality - I'm just doing this since there
    isn't a particular reason to remove them, and I want to make the PR diff
    smaller.
    bkjohnson committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    c5ce9b2 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    d564b3c View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    4db2276 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    972eccf View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2021

  1. Don't try to guess the language

    A user might use a code block and intentionally leave out the language
    for displaying logs or other things.
    bkjohnson committed Sep 15, 2021
    Configuration menu
    Copy the full SHA
    0675d97 View commit details
    Browse the repository at this point in the history