legal_markdown 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -296,6 +296,10 @@ If you were lawyering like coders think then you would abstract these provisions
296
296
 
297
297
  Partials are simple. They use the `@import [filename]` syntax. So if your final provisions are kept in a file in the same folder called final_provisions.lmd you would put `@import final_provisions.lmd` on its own line (either within a structured headers block or outside of it) and the gem will import the contents of the partial before chewing on the whole contract. If your partial was located in another directory you just type that in just like you would on the command line `@import ~/gitlaw/contracts/commercial/partials/final_provisions.lmd` or wherever your partial is.
298
298
 
299
+ #### Date
300
+
301
+ When you are building documents sometime you simply want to put `effective_date: @today`. Try it! At this point it formats dates according to standard formating outside of the US. But if you want to change that, then simply add the date manually.
302
+
299
303
  ## A Few Gotchas
300
304
 
301
305
  * Legal_markdown is optimized primarily for contracts, legislation, and regulations. It is not optimized for cases. For memoranda and filings I use the mixin portion but not the header portion which is enough to meet my needs - in particular, when matched with Sublime Text snippets. If you area looking for a more complete solution for cases and filings I would recommend the [Precedent Gem](https://github.com/BlackacreLabs/precedent) built by [Kyle Mitchell](https://github.com/kemitchell) for [Blackacre Labs](https://github.com/BlackacreLabs)
@@ -1,3 +1,3 @@
1
1
  module LegalMarkdown
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -34,7 +34,7 @@ class LegalToMarkdown
34
34
  @output_file = ARGV[-1]
35
35
  @input_file = ARGV[-2] ? ARGV[-2] : ARGV[-1]
36
36
  begin
37
- if @output_file != "-" && @input_file != "-"
37
+ if @input_file != "-"
38
38
  source_file = File::read(@input_file) if File::exists?(@input_file) && File::readable?(@input_file)
39
39
  elsif @input_file == "-"
40
40
  source_file = STDIN.read
@@ -59,6 +59,11 @@ class LegalToMarkdown
59
59
 
60
60
  def parse_file(source)
61
61
  begin
62
+ if source[/@today/]
63
+ require 'date'
64
+ d = Date.today.strftime("%-d %B, %Y")
65
+ source.gsub!($&, d)
66
+ end
62
67
  yaml_pattern = /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
63
68
  parts = source.partition( yaml_pattern )
64
69
  if parts[1] != ""
@@ -115,7 +120,7 @@ class LegalToMarkdown
115
120
  get_it_all = $& || ""
116
121
  sub_clause = $2 || ""
117
122
  next if sub_clause[sub_pattern] && clauses_to_mixin.include?($1)
118
- content = content.gsub( get_it_all, sub_clause )
123
+ content = content.gsub( get_it_all, sub_clause.lstrip )
119
124
  clauses_to_mixin.delete( mixin ) unless content[pattern]
120
125
  end
121
126
  end
@@ -217,8 +222,10 @@ class LegalToMarkdown
217
222
  end
218
223
  end
219
224
 
220
- no_subs_array = headers["no-reset"].split(", ")
221
- no_subs_array.each{ |e| @substitutions[e][5] = :no_reset unless e == "l." || e == "l1."}
225
+ if headers["no-reset"]
226
+ no_subs_array = headers["no-reset"].split(", ")
227
+ no_subs_array.each{ |e| @substitutions[e][5] = :no_reset unless e == "l." || e == "l1."}
228
+ end
222
229
 
223
230
  return @substitutions
224
231
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legal_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  segments:
55
55
  - 0
56
- hash: 4167443837518545164
56
+ hash: 3224213833953127737
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  version: '0'
63
63
  segments:
64
64
  - 0
65
- hash: 4167443837518545164
65
+ hash: 3224213833953127737
66
66
  requirements: []
67
67
  rubyforge_project:
68
68
  rubygems_version: 1.8.25