Pagini
Workshops
Parteneri
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
sesiuni:compiler:highlighting [2014/07/13 22:25] freescale created |
sesiuni:compiler:highlighting [2014/07/16 11:02] (current) apicus [Task 1] |
||
---|---|---|---|
Line 22: | Line 22: | ||
* <html><span style="font-family:monospace">std::string Prologue(const std::string &title)</span></html> - generates everything up to (and including) the **<pre>** tag; its output will be inserted before the text of the source file; | * <html><span style="font-family:monospace">std::string Prologue(const std::string &title)</span></html> - generates everything up to (and including) the **<pre>** tag; its output will be inserted before the text of the source file; | ||
* <html><span style="font-family:monospace">std::string Epilogue(void)</span></html> - returns the closing tags starting from **</pre>**; | * <html><span style="font-family:monospace">std::string Epilogue(void)</span></html> - returns the closing tags starting from **</pre>**; | ||
- | * <html><span style="font-family:monospace">std::string HighlightingBeginTag(const std::string &color)</span></html> - generates a <span> tag with the color given as argument (you can choose colors from [[http://www.w3schools.com/html/html_colornames.asp | this list]]); its output will be inserted at appropriate places within the text of the source code; | + | * <html><span style="font-family:monospace">std::string HighlightingBeginTag(const std::string &color)</span></html> - generates a **<span>** tag with the color given as argument (you can choose colors from [[http://www.w3schools.com/html/html_colornames.asp | this list]]); its output will be inserted at appropriate places within the text of the source code; |
- | * <html><span style="font-family:monospace">std::string HighlightingEndTag(void)</span></html> - returns the </span> tag. | + | * <html><span style="font-family:monospace">std::string HighlightingEndTag(void)</span></html> - returns the **</span>** tag. |
== Task 1 == | == Task 1 == | ||
Build and run the project on a few sample code files. You should obtain HTML files that can be viewed in the browser. You may however notice some problems (hint: try to include a system header in your test file). | Build and run the project on a few sample code files. You should obtain HTML files that can be viewed in the browser. You may however notice some problems (hint: try to include a system header in your test file). | ||
+ | If you want to run on your own machine, you can find the project <del>[[https://drive.google.com/file/d/0BzSnL_TVXUA3ZlRkMVlCRUdiNUE/edit?usp=sharing | here]]</del> [[https://drive.google.com/file/d/0BzSnL_TVXUA3TVBhUERTdnBwVW8/edit?usp=sharing | here]]. | ||
== Task 2 == | == Task 2 == | ||
The first thing that we have to do in order to get our highlighter to work right is to escape special HTML characters such as the angular brackets. //HTMLSupport.h// offers a method for escaping several HTML characters that could cause problems: <html><span style="font-family:monospace">std::string EscapeText(const std::string &text, bool &isDifferent)</span></html>. | The first thing that we have to do in order to get our highlighter to work right is to escape special HTML characters such as the angular brackets. //HTMLSupport.h// offers a method for escaping several HTML characters that could cause problems: <html><span style="font-family:monospace">std::string EscapeText(const std::string &text, bool &isDifferent)</span></html>. |