Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Modifications

This project was created with an intentionally simple example with e-mail addresses so that you would come away with a good understanding of how macros work. The real power of macros comes into play when you start dealing with large blocks of text that would normally have to be typed in manually. Think about using macros for things like whole blocks of HTML code, nav bars, tables, recurring lists, copyright notices, multimedia plug-in code, and so on. For example, try copying the code for the COPYRIGHT and TABLE macros from the Project1.macro on the CD into your MarkupSource.macro file. After you do, apply the COPYRIGHT and TABLE macros to a document and examine what they insert on the page. You'll see that it's possible to include almost anything in a macro definition, including large blocks of text or HTML code. Just remember to enclose all of your code within 2 unique delimiter characters for each macro.

Figure 1.12 The COPYRIGHT macro inserts a copyright slug.

Figure 1.13 The TABLE macro inserts a complete HTML table and makes calls to additional macros.

If you do some JavaScript programming or frequently use CSS definitions, the JavaScript and CSS macros can save loads of time with recurring code. A favorite script, function, or CSS definition can easily be made into a macro that will save your from having to retype the code each time you use it.

  • + Share This
  • 🔖 Save To Your Account