Skip to content

peitek/PresentationCodeFormatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

The project got superseded by the CodeImageGenerator project, which creates generally usable images instead of Presentation-specific output.

PresentationCodeFormatter

PresentationCodeFormatter is a Python script, which converts Java files/functions to a text file, which is readable by Presentation. This includes a rough custom syntax highlighting with Pygments.

I personally use this to convert short code snippets for empirical research on program comprehension (see Brains on Code). This means the script is personalized to my specific usage and probably not directly useful to you without changes.

Disclaimer: I am not a Python programmer. I'm always grateful for feedback on how to improve my code.

Features

The main feature is to read all files from a directory and attempting to add syntax highlighting compatible with the syntax of Presentation to the output file(s).

Implemented so far:

  • Reads all files from a directory, and parses one at a time
  • Extracts just the function code from the file (and ignores the class, comments, etc around it)
  • Uses Pygments to create syntax highlighting for each function
  • Parses Pygments syntax highlighting to a Presentation-compatible format (still may be incomplete)
  • Wraps code into a Presentation variable for seamless integration
  • Output in separate files, or one large file

Roadmap

Things I still want to add:

  • Command line support
  • Better configuration (in particular the output color scheme)
  • Allow multiple functions per file
  • Allow functions besides public int, public String, public boolean
  • Only read Java files
  • Support for more languages than just Java

Setup

The project should run in any Python environment. It was developed and tested with the PyCharms IDE.

License

MIT License

Copyright (c) 2017 Norman Peitek

About

This script formats program code in a way that the Presentation software displays it with configurable syntax highlighting.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages