Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finished writing Macro Reference appendix.
- Loading branch information
Showing
8 changed files
with
595 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,256 @@ | ||
section[header[Common Macros] | ||
|
||
ref_macro[comment| | ||
Evaluates to nothing. Used to add comments in a Glyph document that will not be displayed in output files. | ||
|
||
aliases[--] | ||
example[--\[This is a comment. It will not be displayed in the output\]] | ||
] | ||
|
||
ref_macro[todo| | ||
Saves the value as a TODO item, which can be printed using the #>[todo]. | ||
|
||
example[todo\[Remember to do this.\]] | ||
] | ||
|
||
ref_macro[snippet| | ||
Evaluates to the snippet referenced by its value. | ||
|
||
aliases[&] | ||
example[&\[glang\]] | ||
] | ||
|
||
ref_macro[include| | ||
Evaluates to the contents of a text file stored in the @text/@ directory referenced by its value. If &[filter_by_ext], filters the contents of the file using the =>[#f_macros|filter macro] corresponding to the file extension. | ||
|
||
aliases[@] | ||
example[@\[introduction.textile\]] | ||
] | ||
|
||
ref_macro[ruby| | ||
Evaluates its value as Ruby code (using @Kernel#instance_eval@). | ||
|
||
aliases[%] | ||
examples[ | ||
%\[Time.now\] | ||
%\[Glyph::VERSION\] | ||
] | ||
] | ||
|
||
ref_macro[config| | ||
Evaluates to the configuration setting referenced by its value. | ||
|
||
aliases[$] | ||
example[$\[document.author\]] | ||
] | ||
|
||
ref_macro[escape| | ||
Evaluates to its value. Commonly used with the escaping delimiters @\[=@ and @=\]@. | ||
|
||
aliases[.] | ||
example[.\[=Macros are escaped here =>\[#test\].=\]] | ||
] | ||
|
||
] --[End common macros] | ||
|
||
section[header[Filter Macros|f_macros] | ||
|
||
ref_macro[textile| | ||
Uses the RedCloth gem to transform the value into HTML or LaTeX, depending on the value of the $>[filters.target]. | ||
|
||
&[called_on_files] with a @.textile@ extension. | ||
|
||
example[textile\[This is a *strong emphasis*.\]] | ||
] | ||
|
||
ref_macro[markdown| | ||
Uses a markdown converter (BlueCloth, RDiscount, Maruku or Kramdown) to transform the value into HTML if the $>[filters.target] is set to @html@. | ||
|
||
&[called_on_files] with a @.markdown@ or a @.md@ extension. | ||
|
||
example[markdown\[This is *emphasized* text.\]] | ||
] | ||
|
||
] --[End filter macros] | ||
|
||
section[header[Block Macros] | ||
|
||
ref_macro[note| | ||
Creates a note @div@ containing the value. | ||
|
||
aliases[important, caution, tip] | ||
example[note\[This is a note.\]] | ||
] | ||
|
||
ref_macro[box| | ||
Creates a titled box @div@. | ||
|
||
*Example:* | ||
|
||
code[ | ||
box\[Why boxes?\| | ||
Boxes can be used to make a section of text stand out from the rest of the document. | ||
\] | ||
] | ||
] | ||
|
||
ref_macro[code| | ||
Used to render a block of code within @pre@ and @code@ tags. For inline code, see the %>[codeph]. | ||
|
||
*Example:* | ||
|
||
code[ | ||
code\[ | ||
def hello | ||
puts "Hello World" | ||
end | ||
\] | ||
] | ||
|
||
] | ||
|
||
ref_macro[title| | ||
Renders the title of the document (based on the $>[document.title]) within a @h1@ tag. | ||
|
||
example[title\[\]] | ||
] | ||
|
||
ref_macro[subtitle| | ||
Renders the subtitle of the document (based on the $>[document.subtitle]) within a @h2@ tag. | ||
|
||
example[subtitle\[\]] | ||
] | ||
|
||
ref_macro[pubdate| | ||
Evaluates to a date string (in the format: _current-month_ _current-year_; or _%B_ _%Y_), within a @div@ tag. | ||
|
||
example[pubdate\[\]] | ||
] | ||
|
||
ref_macro[img| | ||
Includes an image in the document, optionally scaled according to the specified width and height. The image must be stored within the @images/@ directory of the current project. | ||
|
||
examples[ | ||
img\[icon.png\] | ||
img\[holidays/landscape.jpg\|70%\] | ||
img\[logo.svg\|50%\|50%\] | ||
] | ||
] | ||
|
||
ref_macro[fig| | ||
Includes an image in the document, with an optional caption. | ||
|
||
examples[ | ||
fig\[diagram.png\] | ||
fig\[graph.png\|Monthly pageviews\] | ||
] | ||
] | ||
|
||
ref_macro[table| | ||
Evaluates to an HTML table. Used in conjunction with the =>[#m_tr|@tr@], =>[#m_td|@td@] and =>[#m_th|@th@] macros. | ||
|
||
*Example:* | ||
|
||
code[ | ||
table\[ | ||
tr\[ | ||
th\[Name\] | ||
th\[Value\] | ||
\] | ||
tr\[ | ||
td\[A\] | ||
td\[1\] | ||
\] | ||
tr\[ | ||
td\[B\] | ||
td\[2\] | ||
\] | ||
\] | ||
] | ||
|
||
] | ||
|
||
ref_macro[tr|See =>[#m_table].] | ||
ref_macro[th|See =>[#m_table].] | ||
ref_macro[td|See =>[#m_table].] | ||
|
||
|
||
] --[End block macros] | ||
|
||
section[header[Inline Macros] | ||
|
||
ref_macro[anchor| | ||
Creates a named anchor (or bookmark). | ||
|
||
aliases[bookmark, #] | ||
example[#\[test\|Test Bookmark\]] | ||
] | ||
|
||
ref_macro[link| | ||
Creates an hyperlink (\.fmi[creating links|#links]). | ||
|
||
aliases[=>] | ||
examples[ | ||
=>\[#introduction\] | ||
=>\[#troub\|Troubleshooting\] | ||
=>\[http://www.h3rald.com\|H3RALD.com\] | ||
] | ||
] | ||
|
||
ref_macro[codeph| | ||
Wraps the value in a @code@ tag. | ||
|
||
example[codeph\[Kernel.instance_eval\]] | ||
|
||
] | ||
|
||
ref_macro[fmi| | ||
Creates a _For More Information_ link (for an example usage, see the %>[link]). | ||
|
||
example[fmi\[creating links\|#links\]] | ||
] | ||
|
||
] --[End inline macros] | ||
|
||
section[header[Structure Macros] | ||
|
||
ref_macro[div| | ||
Creates a @div@ tag. | ||
|
||
*Aliases:* todo[List div aliases] | ||
] | ||
|
||
ref_macro[header| | ||
Creates an @h2@, @h3@, @h4@, etc. header (\.fmi[using headers|#sec_head]). | ||
|
||
examples[ | ||
header\[Introduction\] | ||
header\[Getting Started\|gs\] | ||
] | ||
] | ||
|
||
ref_macro[document| | ||
The root macro used in every Glyph document. | ||
] | ||
|
||
ref_macro[body| | ||
Creates a @body@ tag. | ||
] | ||
|
||
ref_macro[head| | ||
Creates a @head@ tag, pre-populated with @title@ and author/copyright meta tags. | ||
] | ||
|
||
ref_macro[style| | ||
Embeds the content of a CSS or Sass file within a @style@ tag (\.fmi[stylesheets|#stylesheets]). | ||
|
||
example[style\[default.css\]] | ||
] | ||
|
||
ref_macro[toc| | ||
Generates a _Table of Contents_ based on how sections and headers are nested in the current document. | ||
|
||
example[toc\[\]] | ||
] | ||
|
||
] --[End structure macros] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters