# Is the link an abreviation?
var is_abbrev = false
+ # Create a link with a title.
init with_title(link: String, title: nullable String) do
self.link = link
self.title = title
class BlockCode
super Block
+ # Number of char to skip at the beginning of the line.
+ #
+ # Block code lines start at 4 spaces.
+ protected var line_start = 4
+
redef fun emit(v) do v.decorator.add_code(v, self)
redef fun emit_lines(v) do
var line = block.first_line
while line != null do
if not line.is_empty then
- v.decorator.append_code(v, line.value, 4, line.value.length)
+ v.decorator.append_code(v, line.value, line_start, line.value.length)
end
v.addn
line = line.next
# this class is only used for typing purposes.
class BlockFence
super BlockCode
+
+ # Fence code lines start at 0 spaces.
+ redef var line_start = 0
end
# A markdown headline.
# Is the next line empty?
var next_empty: Bool = false is writable
+ # Initialize a new MDLine from its string value
init(value: String) do
self.value = value
self.leading = process_leading
line = line.next
end
# build block
- var bk: Block
if line != null and not line.is_empty then
var block = v.current_block.split(line.prev.as(not null))
if v.in_list and not was_empty then
# Create a new block kind based on this line.
protected fun block_kind(block: MDBlock): BlockList is abstract
+ # Extract string value from `MDLine`.
protected fun extract_value(line: MDLine): String is abstract
end
var c0: Char
var c1: Char
var c2: Char
- var c3: Char
if pos > 0 then
c0 = self[pos - 1]
else
c2 = ' '
end
- if pos + 3 < length then
- c3 = self[pos + 3]
- else
- c3 = ' '
- end
if c == '*' then
if c1 == '*' then