livetext 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/livetext +20 -0
- data/lib/bookish.rb +212 -0
- data/lib/calibre.rb +24 -0
- data/lib/liveblog.rb +195 -0
- data/lib/livemagick.rb +131 -0
- data/lib/livetext.rb +605 -0
- data/lib/markdown.rb +30 -0
- data/lib/pyggish.rb +194 -0
- data/lib/tutorial.rb +89 -0
- data/livetext-0.5.2.gem +0 -0
- data/livetext.gemspec +99 -4
- data/test/cleanup +1 -0
- data/test/newtest +10 -0
- data/test/rawtext.inc +4 -0
- data/test/simple_mixin.rb +3 -0
- data/test/simplefile.inc +2 -0
- data/test/test.rb +77 -0
- data/test/testfiles/basic_formatting/expected-error.txt +0 -0
- data/test/testfiles/basic_formatting/expected-output.txt +10 -0
- data/test/testfiles/basic_formatting/source.ltx +8 -0
- data/test/testfiles/block_comment/expected-error.txt +0 -0
- data/test/testfiles/block_comment/expected-output.txt +5 -0
- data/test/testfiles/block_comment/source.ltx +19 -0
- data/test/testfiles/comments_ignored_1/expected-error.txt +0 -0
- data/test/testfiles/comments_ignored_1/expected-output.txt +4 -0
- data/test/testfiles/comments_ignored_1/source.ltx +7 -0
- data/test/testfiles/copy_is_raw/expected-error.txt +0 -0
- data/test/testfiles/copy_is_raw/expected-output.txt +7 -0
- data/test/testfiles/copy_is_raw/source.ltx +4 -0
- data/test/testfiles/def_method/expected-error.txt +2 -0
- data/test/testfiles/def_method/expected-output.txt +5 -0
- data/test/testfiles/def_method/source.ltx +10 -0
- data/test/testfiles/example_alpha/expected-error.txt +0 -0
- data/test/testfiles/example_alpha/expected-output.txt +23 -0
- data/test/testfiles/example_alpha/source.ltx +17 -0
- data/test/testfiles/example_alpha2/expected-error.txt +0 -0
- data/test/testfiles/example_alpha2/expected-output.txt +12 -0
- data/test/testfiles/example_alpha2/source.ltx +24 -0
- data/test/testfiles/fixit +6 -0
- data/test/testfiles/functions/expected-error.txt +0 -0
- data/test/testfiles/functions/expected-output.txt +8 -0
- data/test/testfiles/functions/source.ltx +11 -0
- data/test/testfiles/hello_world/expected-error.txt +0 -0
- data/test/testfiles/hello_world/expected-output.txt +2 -0
- data/test/testfiles/hello_world/source.ltx +2 -0
- data/test/testfiles/more_complex_vars/expected-error.txt +0 -0
- data/test/testfiles/more_complex_vars/expected-output.txt +4 -0
- data/test/testfiles/more_complex_vars/source.ltx +5 -0
- data/test/testfiles/raw_text_block/expected-error.txt +0 -0
- data/test/testfiles/raw_text_block/expected-output.txt +14 -0
- data/test/testfiles/raw_text_block/source.ltx +16 -0
- data/test/testfiles/sigil_can_change/expected-error.txt +0 -0
- data/test/testfiles/sigil_can_change/expected-output.txt +6 -0
- data/test/testfiles/sigil_can_change/source.ltx +11 -0
- data/test/testfiles/simple_copy/expected-error.txt +0 -0
- data/test/testfiles/simple_copy/expected-output.txt +7 -0
- data/test/testfiles/simple_copy/source.ltx +6 -0
- data/test/testfiles/simple_include/expected-error.txt +0 -0
- data/test/testfiles/simple_include/expected-output.txt +7 -0
- data/test/testfiles/simple_include/source.ltx +6 -0
- data/test/testfiles/simple_mixin/expected-error.txt +0 -0
- data/test/testfiles/simple_mixin/expected-output.txt +5 -0
- data/test/testfiles/simple_mixin/source.ltx +6 -0
- data/test/testfiles/simple_vars/expected-error.txt +0 -0
- data/test/testfiles/simple_vars/expected-output.txt +6 -0
- data/test/testfiles/simple_vars/source.ltx +7 -0
- data/test/testfiles/single_raw_line/expected-error.txt +0 -0
- data/test/testfiles/single_raw_line/expected-output.txt +10 -0
- data/test/testfiles/single_raw_line/source.ltx +8 -0
- metadata +76 -9
- data/dlt +0 -1
data/test/simplefile.inc
ADDED
data/test/test.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
|
3
|
+
$LOAD_PATH << "./lib"
|
4
|
+
require 'livetext'
|
5
|
+
|
6
|
+
# How these tests work - see the block comment at the bottom.
|
7
|
+
|
8
|
+
class TestingLiveText < MiniTest::Test
|
9
|
+
|
10
|
+
def external_files
|
11
|
+
tag = caller[0]
|
12
|
+
n1, n2 = tag.index("`")+6, tag.index("'")-1
|
13
|
+
base = tag[n1..n2]
|
14
|
+
name = "test/testfiles/#{base}/xxx"
|
15
|
+
|
16
|
+
src, out, exp = name.sub(/xxx/, "source.ltx"), name.sub(/xxx/, "actual-output.txt"), name.sub(/xxx/, "expected-output.txt")
|
17
|
+
err, erx = name.sub(/xxx/, "actual-error.txt"), name.sub(/xxx/, "expected-error.txt")
|
18
|
+
cmd = "./bin/livetext #{src} >#{out} 2>#{err}"
|
19
|
+
# puts cmd
|
20
|
+
system(cmd)
|
21
|
+
output, expected, errors, errexp = File.read(out), File.read(exp), File.read(err), File.read(erx)
|
22
|
+
|
23
|
+
out_ok = output == expected
|
24
|
+
err_ok = errors == errexp
|
25
|
+
bad_out = "--- Expected: \n#{expected}\n--- Output: \n#{output}\n"
|
26
|
+
bad_err = "--- Error Expected: \n#{errexp}\n--- Error Output: \n#{errors}\n"
|
27
|
+
|
28
|
+
assert(out_ok, bad_out)
|
29
|
+
assert(err_ok, bad_err)
|
30
|
+
system("rm -f #{out} #{err}") # only on success
|
31
|
+
end
|
32
|
+
|
33
|
+
def xtest_hello_world; external_files end
|
34
|
+
def xtest_basic_formatting; external_files end
|
35
|
+
|
36
|
+
def xtest_comments_ignored_1; external_files end
|
37
|
+
def xtest_block_comment; external_files end
|
38
|
+
|
39
|
+
def xtest_simple_vars; external_files end
|
40
|
+
def xtest_more_complex_vars; external_files end
|
41
|
+
|
42
|
+
def xtest_sigil_can_change; external_files end
|
43
|
+
|
44
|
+
def xtest_def_method; external_files end
|
45
|
+
|
46
|
+
def xtest_single_raw_line; external_files end
|
47
|
+
|
48
|
+
def test_simple_include; external_files end
|
49
|
+
def test_simple_mixin; external_files end
|
50
|
+
def test_simple_copy; external_files end
|
51
|
+
def test_copy_is_raw; external_files end
|
52
|
+
def xtest_raw_text_block; external_files end
|
53
|
+
|
54
|
+
def xtest_example_alpha; external_files end
|
55
|
+
def xtest_example_alpha2; external_files end
|
56
|
+
|
57
|
+
def xtest_functions; external_files end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
=begin
|
63
|
+
|
64
|
+
You can add any ordinary test method above. But so far, all these tests simply
|
65
|
+
call external_files.
|
66
|
+
|
67
|
+
The external_files method works this way:
|
68
|
+
- If the test (caller) method is test_my_silly_feature, then we will
|
69
|
+
look for a directory called testfiles/my_silly_feature
|
70
|
+
- In here, there must be a source.ltx, expected-output.txt, and expected-error.txt
|
71
|
+
- Technically, any of these can be empty
|
72
|
+
- We run livetext on the source and compare actual vs expected (stdout, stderr)
|
73
|
+
- The "real" output gets checked first
|
74
|
+
- Of course, both must compare correctly for the test to pass
|
75
|
+
|
76
|
+
=end
|
77
|
+
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Here are examples of <b>boldface</b> and <i>italics</i> and <tt>code</tt>
|
2
|
+
as well as <b>more complex</b> examples of <i>italicized text</i>
|
3
|
+
and <tt>code font</tt>.
|
4
|
+
<p>
|
5
|
+
|
6
|
+
Here are some random punctuation marks:
|
7
|
+
# . @ <b> <i></b> <tt></i></tt> : ; % ^ & $
|
8
|
+
<p>
|
9
|
+
|
10
|
+
Oops, forgot to escape these: * _ `
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Here is an alphabetized list:
|
2
|
+
<p>
|
3
|
+
|
4
|
+
aardvark
|
5
|
+
anamorphic
|
6
|
+
anarchist
|
7
|
+
bellicose
|
8
|
+
cytology
|
9
|
+
ectomorph
|
10
|
+
fishmonger
|
11
|
+
fusillade
|
12
|
+
glyph
|
13
|
+
gryphon
|
14
|
+
halcyon
|
15
|
+
manicotti
|
16
|
+
mataeotechny
|
17
|
+
pareidolia
|
18
|
+
quark
|
19
|
+
zootrope
|
20
|
+
zymurgy
|
21
|
+
<p>
|
22
|
+
|
23
|
+
I hope that worked.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.def alpha
|
2
|
+
text = _body.join
|
3
|
+
text.gsub!(/\n/, " ")
|
4
|
+
words = text.split.sort
|
5
|
+
words.each {|w| _puts " #{w}" }
|
6
|
+
.end
|
7
|
+
Here is an alphabetized list:
|
8
|
+
|
9
|
+
.alpha
|
10
|
+
fishmonger anarchist aardvark glyph gryphon
|
11
|
+
halcyon zymurgy mataeotechny zootrope
|
12
|
+
pareidolia manicotti quark bellicose anamorphic
|
13
|
+
cytology fusillade ectomorph
|
14
|
+
.end
|
15
|
+
|
16
|
+
|
17
|
+
I hope that worked.
|
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
.def alpha
|
2
|
+
cols = _args.first
|
3
|
+
cols = "1" if cols == ""
|
4
|
+
cols = cols.to_i
|
5
|
+
raise "Columns must be 1-5" unless cols.between?(1,5)
|
6
|
+
text = _body.join
|
7
|
+
text.gsub!(/\n/, " ")
|
8
|
+
words = text.split.sort
|
9
|
+
words.each_slice(cols) do |row|
|
10
|
+
row.each {|w| _print '%-15s' % w }
|
11
|
+
_puts
|
12
|
+
end
|
13
|
+
.end
|
14
|
+
Here is an alphabetized list:
|
15
|
+
|
16
|
+
.alpha 3
|
17
|
+
fishmonger anarchist aardvark glyph gryphon
|
18
|
+
halcyon zymurgy mataeotechny zootrope
|
19
|
+
pareidolia manicotti quark bellicose anamorphic
|
20
|
+
cytology fusillade ectomorph
|
21
|
+
.end
|
22
|
+
|
23
|
+
|
24
|
+
I hope that worked a second time.
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
This text block will be passed thru
|
2
|
+
with no interpretation or processing:
|
3
|
+
.comment
|
4
|
+
This isn't a
|
5
|
+
real comment.
|
6
|
+
.end This isn't picked up.
|
7
|
+
|
8
|
+
.not_a_method
|
9
|
+
|
10
|
+
And this stuff won't be munged: `alpha _beta *gamma
|
11
|
+
Or this: `(alpha male) _(beta max) *(gamma rays)
|
12
|
+
<p>
|
13
|
+
|
14
|
+
I hope that worked.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
This text block will be passed thru
|
2
|
+
with no interpretation or processing:
|
3
|
+
.raw
|
4
|
+
.comment
|
5
|
+
This isn't a
|
6
|
+
real comment.
|
7
|
+
.end This isn't picked up.
|
8
|
+
|
9
|
+
.not_a_method
|
10
|
+
|
11
|
+
And this stuff won't be munged: `alpha _beta *gamma
|
12
|
+
Or this: `(alpha male) _(beta max) *(gamma rays)
|
13
|
+
__EOF__
|
14
|
+
|
15
|
+
|
16
|
+
I hope that worked.
|
File without changes
|
File without changes
|
File without changes
|