<commit_before># Snippets

A simple, developer focused CMS for Rails. 

## Installation

Until the gem is available use:

```
# Gemfile
gem 'snippets', :git => 'git://github.com/saltybits/snippets.git'
```

```
bundle					     # install snippets
rails g snippets:install     # generates migration that adds the required tables
bundle exec rake db:migrate  # run the migration
```

## Configuration

Configurations is done through a simple initializer.

```
# config/initializers/snippets.rb

Snippets.config do |config|
	config.title = "Website Title"
	config.url = "http://snippets.dev"
	config.username = "admin"
	config.password = "password"

	config.sitemap do
		welcome do
			headline
			message
		end

		...
	end
end
```

Make sure to mount the Snippets engine!

```
# config/routes.rb

Rails.application.routes.draw do
  mount Snippets::Engine => '/admin'
end
```

## Editting Snippets

Go to `website.com/admin` and enter the username and password you've chosen (default is 'admin' / 'password').

Use the texteditor to edit the snippets' content.

## Embedding Snippets

```
# views/users/welcome.html.erb

<h1><%= Snippets.get('welcome/headline') %></h1>
<p><%= Snippets.get('welcome/message') %></p>

# or, use `Snippets.get!` if to allow the welcome message to be marked up
<div class="welcome-message"><%= Snippets.get!('welcome/message') %></div>
```<commit_msg>Minor readme clarification<commit_after># Snippets

A simple, developer focused CMS for Rails. 

## Installation

Until the gem is available use:

```
# Gemfile
gem 'snippets', :git => 'git://github.com/saltybits/snippets.git'
```

```
bundle					     # install snippets
rails g snippets:install     # generates migration that adds the required tables
bundle exec rake db:migrate  # run the migration
```

## Configuration

Configurations is done through a simple initializer.

```
# config/initializers/snippets.rb

Snippets.config do |config|
	config.title = "Website Title"
	config.url = "http://snippets.dev"
	config.username = "admin"
	config.password = "password"

	config.sitemap do
		welcome do
			headline
			message
		end

		...
	end
end
```

Make sure to mount the Snippets engine!

```
# config/routes.rb

Rails.application.routes.draw do
  mount Snippets::Engine => '/admin'
end
```

## Editting Snippets

Go to `website.com/admin` and enter the username and password you've chosen (default is 'admin' / 'password').

Use the texteditor to edit the snippets' content.

## Embedding Snippets

```
# views/users/welcome.html.erb

<h1><%= Snippets.get('welcome/headline') %></h1>
<p><%= Snippets.get('welcome/message') %></p>

# or, use `Snippets.get!` to allow the welcome message to be marked up.
# (equivalent to `Snippets.get(...).html_safe`)
<div class="welcome-message"><%= Snippets.get!('welcome/message') %></div>
```
{'fraction_non_alphanumeric': 0.14051938811810744, 'fraction_numerical': 0.001422981145499822, 'mean_word_length': 4.094202898550725, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4750459', 'n_tokens_mistral': 1011, 'n_tokens_neox': 913, 'n_words': 276}