markup-email 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 255a04759cfb52a73199e4d2ddb9026505895b50
4
- data.tar.gz: dacd5e1c6771f3d5c9ea1f0c030ffa274d1f6dd7
3
+ metadata.gz: 5848ea7ff048c4eb8f664692385323318d417f1e
4
+ data.tar.gz: c69df35ab4ff7a26bb466b1b60e6895cd01b29ef
5
5
  SHA512:
6
- metadata.gz: 1d476bcbcfe0e9b4973ca8f19d373d17cb0483d2826405dc1dd36ecda25c77a4210d7a03b12c4804192959073019388d1e987b73fc8f230454db142570918bff
7
- data.tar.gz: 584f3ecbf023e70e0a5942082b0c60c29df0f58f1fa152654c39fbc94fe599c5a6f36d4831346f8f6851946d41415bb75f6c165a40e3afbf4f929ee0b01a3f48
6
+ metadata.gz: ecd3ff77e1fafdd3418f20b5e2e9754f66d36ccc9bdeac51babcffd18b0114bf0e2023c510f57d12750b9e3f9ec5a3ba8eb0f7b577b3781b605e8f28f76b3d56
7
+ data.tar.gz: 7781af8eb3d7dd88fa076a6f00c73328a844a2080d06e6a3d21c0c31cf67d8898f79103ed32f8e8a5d7356c2d482bfc0761b05499847c294d9a6938743d19d5d
data/README.md CHANGED
@@ -1,2 +1,72 @@
1
1
  # MarkupEmail
2
2
  > Converting Markup to e-mails
3
+
4
+ ## Installation
5
+ From [rubygems.org](https://rubygems.org/gems/markup-email)
6
+ ```shell
7
+ gem install markup-email
8
+ # Then use the executables
9
+ markup-email [file] [options]
10
+ ```
11
+ From source (without gems)
12
+ ```shell
13
+ git clone https://github.com/Demonstrandum/MarkupEmail.git && cd MarkupEmail
14
+ cat *.gemspec # Read through and download all runtime dependencies
15
+ ruby -Ilib bin/markup-email [file] [options] # Then you can use the program
16
+ ```
17
+
18
+ ## Usage
19
+ Basic usage:
20
+ `markup-email [markup file] [options]`<br />
21
+ e.g. `markup-email -s email.md -t 'Special E-mail'`
22
+
23
+ Options:
24
+
25
+ | Option | Description |
26
+ | ----------------------|:-------------:|
27
+ | -s, --sanitize | Sanitizes all html/markdown by removing potentialy harmful tags or their attributes |
28
+ | -t, --title | The subsequent word/argument will be set as the title |
29
+ | -h, --help, help | Brings up the help menu (same as this) |
30
+
31
+
32
+ Your chosen markdown requires these packages accordingly:
33
+ - .markdown, .mdown, .mkdn, .md -- `gem install commonmarker`
34
+ - .textile -- `gem install RedCloth`
35
+ - .rdoc -- `gem install rdoc -v 3.6.1`
36
+ - .org -- `gem install org-ruby`
37
+ - .creole -- `gem install creole`
38
+ - .mediawiki, .wiki -- `gem install wikicloth`
39
+ - .rst -- `python3 -m pip install sphinx`
40
+ - .asciidoc, .adoc, .asc -- `gem install asciidoctor`
41
+ - .pod -- Pod::Simple::XHTML comes with Perl >= 5.10.
42
+
43
+ Delete the example `.html` in this repo's `examples` folder and generate it yourself
44
+ ```shell
45
+ $ markup-email -s -t veryExampleWow examples/example.md
46
+
47
+ Title is : veryExampleWow
48
+ Filename is : veryExampleWow.html
49
+
50
+ Markup/HTML will be sanitized,
51
+ (`class=...` attributes and <script> tags will be disalowed).
52
+ ```
53
+ ### E-mail it
54
+ Then open `examples/veryExampleWow.html` in your browser and see for yourself, then you can open it in a text-editor, view the source and copy it in to your e-mail editor as `HTML` source.
55
+
56
+ ## In Ruby
57
+ *Can* also be used in Ruby
58
+ ```ruby
59
+ require 'markup_email'
60
+
61
+ file = ... # Markdup file
62
+ title = ... # Title of the page
63
+
64
+ markup = MarkupEmail::Convert.new(file, title, sanitize)
65
+ puts markup.content # Will print the pure HTML
66
+
67
+ markup.write "#{file.split('.')[0..-2].join('.')}-converted.html" # Makes a new file
68
+ # If `file` was equal to "hello.there.md"
69
+ # then the new file from `markup.write()` would be called
70
+ # "hello.there-converted.html"
71
+ ```
72
+ If this is not sufficient, perhaps see the [rubydoc.info](http://www.rubydoc.info/gems/markup-email/MarkupEmail/) for autogenerated documentation.
data/bin/markup-email CHANGED
@@ -12,7 +12,16 @@ if '-h'.arg? || '--help'.arg? || 'help'.arg?
12
12
 
13
13
  Basic usage:
14
14
  markup-email [markup file] [options]
15
- e.g. `markup-email email.rst`
15
+ e.g. `markup-email email.md`
16
+
17
+ Options:
18
+ -s, --sanitize Sanitizes all html/markdown by removing
19
+ potentialy harmful tags or their attributes
20
+
21
+ -t, --title The subsequent word/argument will be set as
22
+ the title
23
+
24
+ -h, --help, help Brings up this menu.
16
25
 
17
26
  Your chosen markdown requires these packages accordingly:
18
27
  - .markdown, .mdown, .mkdn, .md -- `gem install commonmarker`
@@ -8,6 +8,7 @@ require 'rouge'
8
8
  module MarkupEmail
9
9
  class HTMLify
10
10
  attr_accessor :title
11
+ attr_reader :content
11
12
  def initialize content
12
13
  @content = content
13
14
  end
@@ -52,10 +53,7 @@ HTML
52
53
  <meta name="viewport" content="width=device-width, initial-scale=1">
53
54
  HTML
54
55
 
55
- #
56
56
  @content = document.to_s
57
57
  end
58
-
59
- def content; @content; end
60
58
  end
61
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markup-email
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Demonstrandum