Implement many more nodes
All checks were successful
CI Pipeline / build (pull_request) Successful in 12s
All checks were successful
CI Pipeline / build (pull_request) Successful in 12s
Adds these new styling and formatting nodes * strike * highlight * linebreaks * pagebreaks * Hyperlinks
This commit is contained in:
18
lib/notare/nodes/break.rb
Normal file
18
lib/notare/nodes/break.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Notare
|
||||
module Nodes
|
||||
class Break < Base
|
||||
attr_reader :type
|
||||
|
||||
def initialize(type: :line)
|
||||
super()
|
||||
@type = type
|
||||
end
|
||||
|
||||
def page?
|
||||
type == :page
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
20
lib/notare/nodes/hyperlink.rb
Normal file
20
lib/notare/nodes/hyperlink.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Notare
|
||||
module Nodes
|
||||
class Hyperlink < Base
|
||||
attr_reader :url, :rid, :runs
|
||||
|
||||
def initialize(url:, rid:)
|
||||
super()
|
||||
@url = url
|
||||
@rid = rid
|
||||
@runs = []
|
||||
end
|
||||
|
||||
def add_run(run)
|
||||
@runs << run
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -3,14 +3,18 @@
|
||||
module Notare
|
||||
module Nodes
|
||||
class Run < Base
|
||||
attr_reader :text, :bold, :italic, :underline, :style
|
||||
attr_reader :text, :bold, :italic, :underline, :strike, :highlight, :color, :style
|
||||
|
||||
def initialize(text, bold: false, italic: false, underline: false, style: nil)
|
||||
def initialize(text, bold: false, italic: false, underline: false,
|
||||
strike: false, highlight: nil, color: nil, style: nil)
|
||||
super()
|
||||
@text = text
|
||||
@bold = bold
|
||||
@italic = italic
|
||||
@underline = underline
|
||||
@strike = strike
|
||||
@highlight = highlight
|
||||
@color = color
|
||||
@style = style
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user