add pdf command line option
This commit is contained in:
		@@ -10,13 +10,15 @@ def get_parser():
 | 
				
			|||||||
    # required arg
 | 
					    # required arg
 | 
				
			||||||
    parser.add_argument("inputFile", help="name of the csv file to used as input, e.g. quiz.csv",
 | 
					    parser.add_argument("inputFile", help="name of the csv file to used as input, e.g. quiz.csv",
 | 
				
			||||||
                        type=str)
 | 
					                        type=str)
 | 
				
			||||||
 | 
					    parser.add_argument('-pdf', '--pdf', action='store_true',
 | 
				
			||||||
 | 
					                        help="converts markdown file to pdf")
 | 
				
			||||||
    return parser
 | 
					    return parser
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def command_line_runner():
 | 
					def command_line_runner():
 | 
				
			||||||
    parser = get_parser()
 | 
					    parser = get_parser()
 | 
				
			||||||
    args = parser.parse_args()
 | 
					    args = parser.parse_args()
 | 
				
			||||||
    converter.write_markdown_file(args.inputFile)
 | 
					    converter.convert(args.inputFile, args.pdf)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,12 @@ class QuestionAndAnswers:
 | 
				
			|||||||
        return "QuestionAndAnswers: Question: {}, Answers: {}, Category: {}".format(self.question, self.answerArray, self.category)
 | 
					        return "QuestionAndAnswers: Question: {}, Answers: {}, Category: {}".format(self.question, self.answerArray, self.category)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def convert(csv_path, output_pdf=False):
 | 
				
			||||||
 | 
					    write_markdown_file(csv_path)
 | 
				
			||||||
 | 
					    if(output_pdf):
 | 
				
			||||||
 | 
					        to_pdf("slide-deck.md")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def write_markdown_file(csv_path):
 | 
					def write_markdown_file(csv_path):
 | 
				
			||||||
    # csv_path = "quiz-example.csv"
 | 
					    # csv_path = "quiz-example.csv"
 | 
				
			||||||
    markdown_path = "slide-deck.md"
 | 
					    markdown_path = "slide-deck.md"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,3 +6,4 @@ pywin32==227
 | 
				
			|||||||
requests==2.25.1
 | 
					requests==2.25.1
 | 
				
			||||||
urllib3==1.26.5
 | 
					urllib3==1.26.5
 | 
				
			||||||
websocket-client==1.1.0
 | 
					websocket-client==1.1.0
 | 
				
			||||||
 | 
					six==1.16.0 # needed for docker to run properly
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user