0.0
No commit activity in last 3 years
No release in over 3 years
A simple file/string templating system.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Tag Formatter

Tag Formatter (for a lack of a better name) is—of course—a basic templating system that takes in text input with "tags", and replaces those tags with text as defined by the programmer.

Installation

Installation via gem

gem install tag_formatter

Installation via GIT

git clone git://github.com/mseymour/tag_formatter.git
cd tag_formatter/
gem build tag_formatter.gemspec
gem install tag_formatter-0.0.3.gem

Usage

Valid option symbols for configuring an instance of TagFormatter:

  • tags (Hash)
  • tag_start (String)
  • tag_end (String)
  • inline_comment_delimiter (String)
  • block_comment_start (String)
  • block_comment_end (String)

Formatting a block of text using the default options:

text = <<-HEREDOC
Hello, I am {firstname} {lastname}.
I like {something}. #Something can be anything.
/*I do not know about you,
but block comments are pretty rad.*/
HEREDOC

tf = TagFormatter.new text, tags: {firstname: "Mark", lastname: "Seymour", something: "listening to music"}

puts tf.parse #=> Hello, I am Mark Seymour.\nI like listening to music.

Formatting a block of text using user-supplied options:

tf = TagFormatter.new "I like to %verb% it, %verb% it!", tags: {verb: "move"}, tag_start: '%', tag_end: '%'
puts tf.parse #=> I like to move it, move it!

Contribute

Any and all issues should be reported via the Issues tab in Github.

Fixes, additions, patches, etc. are greatly welcome.

Author information