Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
/ rant3 Public archive

Commit

Permalink
Merge pull request #108 from TheBerkin/dev-3.0
Browse files Browse the repository at this point in the history
Rant 3
  • Loading branch information
TheBerkin authored Apr 18, 2017
2 parents 897259e + 166e7fd commit dec6bda
Show file tree
Hide file tree
Showing 276 changed files with 51,298 additions and 17,293 deletions.
25 changes: 25 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
These people have all supported the development of this project at some point;
be it financially, by offering skills/knowledge, or some other way.
Thank you.

## Contributors

### Programmers
- Andrew Rogers ([@cpancake](https://github.com/cpancake))
- Santeri Kasvi ([@Spanfile](https://github.com/Spanfile))

### Localization
- Tamme Schichler ([@Tamschi](https://github.com/Tamschi))

## Financial Support

- [Michael Nielsen](https://twitter.com/Nosteme)

### Patreon ($5 or more pledged)

- [Pål Trefall](https://www.patreon.com/user/creators?u=4929142) ([@ptrefall](https://github.com/ptrefall))
- [Key Wraith](https://www.patreon.com/user/creators?u=4336045)

## Special Thanks

- [@voraciousviolet](https://github.com/voraciousviolet) - _Offered valuable ideas and support in the early stages of the project, as well as for its predecessor, the "Moist Banana" story generator._
29 changes: 21 additions & 8 deletions CmdLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Rant.Common
{
internal static class CmdLine
{
private static readonly Dictionary<string, string> Arguments = new Dictionary<string, string>();
private static readonly Dictionary<string, List<string>> Arguments = new Dictionary<string, List<string>>();
private static readonly HashSet<string> Flags = new HashSet<string>();
private static readonly List<string> Paths = new List<String>();

Expand All @@ -33,7 +33,14 @@ static CmdLine()
{
if (isProperty)
{
Arguments[args[i - 1].TrimStart('-')] = args[i];
var name = args[i - 1].TrimStart('-');
if (Arguments.ContainsKey(name))
Arguments[name].Add(args[i]);
else
{
Arguments[name] = new List<string>();
Arguments[name].Add(args[i]);
}
isProperty = false;
}
else if (args[i].StartsWith("--"))
Expand All @@ -55,20 +62,26 @@ static CmdLine()

public static string Property(string name)
{
string arg;
if (!Arguments.TryGetValue(name.ToLower(), out arg))
List<string> args;
if (!Arguments.TryGetValue(name.ToLower(), out args))
{
arg = "";
return "";
}
return arg;
return args.First();
}

public static string Property(string name, string defaultValue)
{
string arg;
return !Arguments.TryGetValue(name.ToLower(), out arg) ? defaultValue : arg;
List<string> args;
return !Arguments.TryGetValue(name.ToLower(), out args) ? defaultValue : args.First();
}

public static IEnumerable<string> Properties(string name)
{
List<string> args;
return Arguments.TryGetValue(name.ToLower(), out args) ? args : new List<string>();
}

public static bool Flag(string name) => Flags.Contains(name);
}
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Nicholas Fleck
Copyright (c) 2014-present Nicholas Fleck

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
148 changes: 61 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,48 @@
<p align="center">
<img src="http://i.imgur.com/Vx7LyRP.png" alt="Rant logo"></img>
<img src="http://i.imgur.com/Vx7LyRP.png" alt="Rant logo" height="225px" width="225px"></img>
</p>
<br/>

<p align="center">
<a href="https://ci.appveyor.com/project/TheBerkin/rant/branch/master/artifacts">
<img src="https://ci.appveyor.com/api/projects/status/2vn0imlns20n739a/branch/master?svg=true&passingText=Master%20Build%20Passing&pendingText=Master%20Build%20Pending&failingText=Master%20Build%20Failing" alt="Build status">
</img>
</a>
<a href="https://ci.appveyor.com/project/TheBerkin/rant/branch/dev/artifacts">
<img src="https://ci.appveyor.com/api/projects/status/2vn0imlns20n739a/branch/dev?svg=true&passingText=Dev%20Build%20Passing&pendingText=Dev%20Build%20Pending&failingText=Dev%20Build%20Is%20Kill" alt="Build status">
</img>
</a>
</p>

##What is Rant?

Rant is a language for procedurally generating text, written in C#. It combines a markup language with functional and imperative programming concepts to deliver a powerful, but easy-to-use tool for adding rich variations to your text. The ultimate goal of Rant is to augment your creativity with the boundless potential of randomness, helping you consider your next great idea as not just a static concept, but a seed for countless possibilities.
**Rant** is an all-purpose procedural text engine
that is most simply described as the opposite of Regex.
It has been refined to include a dizzying array of features for handling everything from
the most basic of string generation tasks to advanced dialogue generation,
code templating, automatic formatting, and more.

[berkin.me/rant](http://berkin.me/rant)
The goal of the project is to enable developers of all kinds
to automate repetitive writing tasks with a high degree of creative freedom.

##Features of Rant
## Features

* Recursive, weighted branching with customizable selection strategies
* Dictionary queries
* Automation for capitalization, rhyming, and indefinite articles
* Multiple output support
* Richard, an experimental embedded scripting language
* Probability modifiers
* Loops, conditionals, and subroutines
* Package loader for easy resource management
* Unmanaged function exports for use in C/C++ applications *(Windows only, sorry!)*
* Compatible with Unity
* **And a whole lot more!**
* Recursive, weighted branching with several selection modes
* Queryable dictionaries
* Automatic capitalization, rhyming, English indefinite articles, and multi-lingual number verbalization
* Print to multiple separate outputs
* Probability modifiers for pattern elements
* Loops, conditional statements, and subroutines
* Fully-functional object model
* Import/Export resources easily with the .rantpkg format
* Compatible with Unity 2017
* *And much, much, much more...*

##Examples
## Examples

**Fill in the blanks**
**Liven up a narrative with a few simple queries.**
```
<name-male> likes to <verb-transitive> <noun.s> with <pron.poss-male> pet <noun-animal> on <timenoun.s-dayofweek>.
<name-male> likes to <verb-transitive> <noun.pl> with <pro.dposs-male> pet <noun-animal> on <noun.pl -dayofweek>.
```
```
Alick likes to mount shuttlecocks with his pet bat on Mondays.
```

---

**Generate ten random numbers between 1 and 50 and spell them out**
**Count to ten and spell it out.**
```
[case:sentence][numfmt:verbal-en][rep:10][sep:\s]{[num:1;50].}
[case:sentence][numfmt:verbal][rs:10;\s]{[rn].}
```
```
Four. Ten. Thirteen. Fifteen. Eighteen. Twenty four. Seven. Forty eight. Nineteen. Twenty five.
One. Two. Three. Four. Five. Six. Seven. Eight. Nine. Ten.
```

---
Expand All @@ -69,68 +61,50 @@ The drug dug the smug plug.

---

**?????**
```
[rs:16;\N]
{
[r:50]{([rr])\u2593|([re])\s}
}
```
```
▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓▓ ▓ ▓ ▓ ▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓ ▓▓▓ ▓ ▓
▓▓▓▓▓▓ ▓▓▓▓▓ ▓ ▓▓▓ ▓ ▓ ▓ ▓▓▓▓ ▓▓ ▓ ▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓ ▓ ▓ ▓▓ ▓▓ ▓▓
▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓ ▓ ▓▓ ▓ ▓ ▓ ▓ ▓ ▓▓▓▓ ▓
▓▓▓▓▓▓▓▓▓▓ ▓▓▓ ▓▓▓▓▓▓ ▓ ▓ ▓▓
▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓ ▓▓ ▓▓▓ ▓ ▓ ▓ ▓ ▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓
▓▓▓▓▓▓▓▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓ ▓▓ ▓
▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓▓
▓▓▓▓▓▓▓▓▓▓ ▓ ▓ ▓▓ ▓ ▓▓▓▓▓▓▓ ▓ ▓ ▓
▓▓▓▓▓▓▓▓▓▓ ▓ ▓▓ ▓▓▓ ▓▓▓▓▓ ▓ ▓▓
▓▓▓▓ ▓▓▓▓▓▓▓ ▓▓▓ ▓ ▓▓▓ ▓ ▓ ▓ ▓
▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ▓ ▓▓ ▓▓▓ ▓▓ ▓
▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓ ▓ ▓ ▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓ ▓ ▓▓▓ ▓
```

## NuGet
Rant is also available as a [NuGet package](https://www.nuget.org/packages/Rant/).
Enter this command in your package manager,
and the latest version of Rant will automagically get installed in your project:

##NuGet
Rant is also available as a [NuGet package](https://www.nuget.org/packages/Rant/). Punch the following into your package manager console and smash the Enter key enthusiastically to get it:
```
PM> Install-Package Rant
```

Or if development builds are your thing:

```
PM> Install-Package Rant -Pre
```

But remember, the latest version will always be available on the repository first.

##License
## License
Rant is provided under [The MIT License](https://github.com/TheBerkin/Rant/blob/master/LICENSE).

##Improve Rant
If there is something you want fixed, added, or changed, feel free to submit an issue/pull request. You are welcome to help with any of the following:
* Documentation
* Fixing bugs
* Optimization
* New functions
* New language features
* Improving old language features
* New API features
* Formatting support for other cultures

##Learn Rant
See [berkin.me/rantdocs](http://berkin.me/rantdocs) for full documentation of the API and Rant language, as well as additional example code.

##Support Rant
If you love my work and want to support it by donating, you can do so [here](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&encrypted=-----BEGIN+PKCS7-----MIIHFgYJKoZIhvcNAQcEoIIHBzCCBwMCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCnAa5a%2BlNDRPC3XmQ9m0fiEQcJzDJ0ukikmnDuVGFs%2BrGHX23SXuDeWT8v7FOAPu6Rdipva1soJIjJTUuk0HiEzwPAiSVjkV%2Fj8NSlcbPNnSyHEmiE7%2BDzKpJBGGA4WH8gwbtDUQ%2Be9ILdjUJIZ2KSwcWwbxexk0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ELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbYIBADAMBgNVHRMEBTADAQH%2FMA0GCSqGSIb3DQEBBQUAA4GBAIFfOlaagFrl71%2Bjq6OKidbWFSE%2BQ4FqROvdgIONth%2B8kSK%2F%2FY%2F4ihuE4Ymvzn5ceE3S%2FiBSQQMjyvb%2Bs2TWbQYDwcp129OPIbD9epdr4tJOUNiSojw7BHwYRiPh58S1xGlFgHFXwrEBb3dgNbMUa%2Bu4qectsMAXpVHnD9wIyfmHMYIBmjCCAZYCAQEwgZQwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xNTA2MjYwMzI3MjdaMCMGCSqGSIb3DQEJBDEWBBS8ixZRspLeAGmBXnwP4OjcWr228TANBgkqhkiG9w0BAQEFAASBgHnORUb9B9jxH0olsERVeNBf9hok18rGVNIvIedgiojMKSQb13UsNbN4ys%2BWln4OsOhcNh%2FKo2UthrwEB0gZEVNnD6%2BuDL1ogyFAadA3VNHrni7H7iCk3WrgsxgIynHGV68yAOqbcwp8WizAR%2BlHTaxRaZ2jwQ2O%2FRVI%2FkJ34QGs-----END+PKCS7-----%0A++++++++). Donating isn't required, but it's much appreciated!

##Other projects
If you like Rant, you may also like these other, Rant-related projects:
* [**RIDE**](http://github.com/RantLang/RIDE): The official (and highly WIP) Rant IDE
* [**Rantionary**](http://github.com/TheBerkin/Rantionary): The official Rant dictionary

:squirrel:
## Improve Rant
If there is something you want fixed, added, or changed, feel free to submit an issue/pull request; I will try to get back to you within a day. If you would like to translate Rant into your native language, simply write a .lang file for it [like this one here](https://github.com/TheBerkin/Rant/blob/dev-3.0/Rant/Localization/en-US.lang).

## Rant Resources
* [Rant Homepage](http://berkin.me/rant)
* [Rant Documentation](http://berkin.me/rantdocs)
* [Rantionary - Rant Standard Dictionary](https://github.com/TheBerkin/Rantionary)

## Build Status

<a href="https://ci.appveyor.com/project/TheBerkin/rant/branch/master/artifacts">
<img src="https://ci.appveyor.com/api/projects/status/2vn0imlns20n739a/branch/master?svg=true&passingText=Master%20Build%20Passing&pendingText=Master%20Build%20Pending&failingText=Master%20Build%20Failing" alt="Build status" />
</a>
<br/>
<a href="https://ci.appveyor.com/project/TheBerkin/rant/branch/dev/artifacts">
<img src="https://ci.appveyor.com/api/projects/status/2vn0imlns20n739a/branch/dev?svg=true&passingText=Dev%20Build%20Passing&pendingText=Dev%20Build%20Pending&failingText=Dev%20Build%20Is%20Kill" alt="Build status" />
</a>

## Support My Projects
<br/>
<p align="center">
<a href="https://patreon.com/Berkin"><img src="https://s3.amazonaws.com/patreon_public_assets/toolbox/patreon.png" width="20%" height="20%" /></a>
</p>

If you love my work, please consider supporting me on [Patreon](https://patreon.com/Berkin). Alternatively, I also accept donations through [PayPal](http://paypal.me/nicholasfleck).
Donations help me make projects like Rant even better. Thank you.


2 changes: 1 addition & 1 deletion Rave/App.config → Rant.Benchmark/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
19 changes: 13 additions & 6 deletions Rave/CmdLine.cs → Rant.Benchmark/CmdLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,34 @@
using System.Collections.Generic;
using System.Linq;

namespace Rave
namespace Rant.Common
{
internal static class CmdLine
{
private static readonly Dictionary<string, string> Arguments = new Dictionary<string, string>();
private static readonly HashSet<string> Flags = new HashSet<string>();
private static readonly List<string> Paths = new List<String>();

public static readonly string Command = String.Empty;

/// <summary>
/// Determines whether the user specified a question mark as the argument.
/// </summary>
public static readonly bool Help;

static CmdLine()
{
var args = Environment.GetCommandLineArgs().Skip(1).ToArray();
int argc = args.Length;
if (argc == 0) return;

Command = args[0].ToLower().Trim();
if (argc == 1 && args[0] == "?")
{
Help = true;
return;
}

bool isProperty = false;
bool isProperty = false;

for (int i = 1; i < args.Length; i++)
for (int i = 0; i < args.Length; i++)
{
if (isProperty)
{
Expand Down
Loading

0 comments on commit dec6bda

Please sign in to comment.