Time for action – writing the markup parser
First, the format of the markup language needs to be explained. The first line will be a title, and then subsequent paragraphs are blank-line separated. This can be translated into an HTML file as follows.
Minimark source |
Translated HTML |
---|---|
This is the title A paragraph with some text Another paragraph |
<html><head><title>This is the title</title></head><body><h1>This is the title</h1> <p> A paragraph with some text </p> <p> Another paragraph </p></body></html> |
- Create a class called
MinimarkTranslator
in thecom.packtpub.e4.minimark.ui
package as follows:public class MinimarkTranslator { public static void convert(Reader reader, Writer writer) throws IOException { BufferedReader lines = new BufferedReader(reader); ...
Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.