<commit_before># Literate Ruby

A simple Ruby script that lets you enjoy literate programming in Ruby a little
bit more.

## How do I use it?

Given a `.litrb` file like the following (let's call it `example.litrb`):

    # Literate Programming Is Fun

    Literate programming is a great way to document your code, making it easily
    accessible and well-explained to the reader. For example, below we define
    a function that prints "Hello World", then run it.

        def hello
          puts "Hello, World!"
        end

If the `literate-ruby.rb` script is run on this file, it will generate two
files:

- `example.rb` will contain all the code from the `.litrb` file, waiting to be
  run by Ruby:

```ruby
# example.rb

def hello
  puts "Hello, World!"
end
```

- `example.html` will contain the converted markdown from the file, with
  syntax-highlighted Ruby:

```html
<!-- example.html -->
<h1>Literate Programming Is Fun</h1>

<p>Literate programming is a great way to document your code, making it easily
accessible and well-explained to the reader. For example, below we define
a function that prints "Hello World", then run it.</p>

<div class="highlight"><pre><span class="k">def</span> <span class="nf">hello</span>
  <span class="nb">puts</span> <span class="s2">&quot;Hello, World!&quot;</span>
<span class="k">end</span>
</pre></div>
```

## Dependencies:

Literate Ruby makes use of the following gems:

- [rdicount][]
- [pygments.rb][]

To install RDiscount, you'll need at least a basic build system, since it's
implemented in C.

If you have a Pygments install (`which pygmentize`), Pygments.rb will use that.
If not, it will need to use an external web service to perform syntax
highlighting.

[rdicount]: https://github.com/davidfstr/rdiscount/
[pygments.rb]: https://github.com/tmm1/pygments.rb

## TODO:

- support for directly running `.litrb` files
- support for processing a dir of `.litrb` fils

## License

MIT. Plain and simple. See `LICENSE` for more details.<commit_msg>TODO for stdin/stdout<commit_after># Literate Ruby

A simple Ruby script that lets you enjoy literate programming in Ruby a little
bit more.

## How do I use it?

Given a `.litrb` file like the following (let's call it `example.litrb`):

    # Literate Programming Is Fun

    Literate programming is a great way to document your code, making it easily
    accessible and well-explained to the reader. For example, below we define
    a function that prints "Hello World", then run it.

        def hello
          puts "Hello, World!"
        end

If the `literate-ruby.rb` script is run on this file, it will generate two
files:

- `example.rb` will contain all the code from the `.litrb` file, waiting to be
  run by Ruby:

```ruby
# example.rb

def hello
  puts "Hello, World!"
end
```

- `example.html` will contain the converted markdown from the file, with
  syntax-highlighted Ruby:

```html
<!-- example.html -->
<h1>Literate Programming Is Fun</h1>

<p>Literate programming is a great way to document your code, making it easily
accessible and well-explained to the reader. For example, below we define
a function that prints "Hello World", then run it.</p>

<div class="highlight"><pre><span class="k">def</span> <span class="nf">hello</span>
  <span class="nb">puts</span> <span class="s2">&quot;Hello, World!&quot;</span>
<span class="k">end</span>
</pre></div>
```

## Dependencies:

Literate Ruby makes use of the following gems:

- [rdicount][]
- [pygments.rb][]

To install RDiscount, you'll need at least a basic build system, since it's
implemented in C.

If you have a Pygments install (`which pygmentize`), Pygments.rb will use that.
If not, it will need to use an external web service to perform syntax
highlighting.

[rdicount]: https://github.com/davidfstr/rdiscount/
[pygments.rb]: https://github.com/tmm1/pygments.rb

## TODO:

- support for directly running `.litrb` files
- support for processing a dir of `.litrb` fils
- support for reading Literate Ruby from stdin and outputting html or ruby to
  stdout

## License

MIT. Plain and simple. See `LICENSE` for more details.
{'fraction_non_alphanumeric': 0.10951569724993916, 'fraction_numerical': 0.0019469457288878072, 'mean_word_length': 3.8696682464454977, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 4, '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': '1581141', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1242, 'n_words': 541}