-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice_assigner.rb
More file actions
67 lines (67 loc) · 1.51 KB
/
practice_assigner.rb
File metadata and controls
67 lines (67 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# require './paragraph_parser'
# require './header_parser'
# require './strong_parser'
# require './emphasis_parser'
# require './unordered_list_parser'
# require './ordered_list_parser'
# require 'pry'
#
#
# class ParserAssigner
#
# def initialize
# @chunks = []
# @assigned_chunks = []
# end
#
# def make_array(string)
# @chunks = string.split("\n\n")
# end
#
# def assign_parser
# @assigned_chunks = @chunks.map do |chunk|
# assign_chunk
# end
# p @assigned_chunks
# end
#
# def assign_chunk
# outer_tags
# inner_tags
# end
#
# def outer_tags(chunk)
# if chunk[0] == "#"
# head = HeaderParser.new(chunk)
# chunk = head.header_parser
# elsif chunk.start_with?("* ")
# ulist= UnorderedListParser.new(chunk)
# chunk = ulist.unordered_list_parser
# elsif chunk.start_with?("1. ")
# olist = OrderedListParser.new(chunk)
# chunk = olist.ordered_list_parser
# else
# paragraph = ParagraphParser.new(chunk)
# chunk = paragraph.paragraph_parser
# end
# end
#
# def inner_tags(chunk)
# if chunk.include?("**")
# strong = StrongParser.new(chunk)
# chunk = strong.strong_parser
# elsif chunk.include?("*")
# emphasis = EmphasisParser.new(chunk)
# chunk = emphasis.emphasis_parser
# else
# chunk
# end
# end
#
# end
#
# if __FILE__ == $0
# parser = ParserAssigner.new
# parser.make_array("# What a nice **header**.\n\nAnd a *paragraph* too.")
# p parser.assign_parser
# end