proper autolinks in html
This commit is contained in:
parent
acf03f6b36
commit
c31365115b
|
@ -1,4 +1,4 @@
|
|||
#!/bin/ruby
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'io/console/size'
|
||||
|
@ -116,8 +116,6 @@ class OptionNavigator
|
|||
end
|
||||
end
|
||||
|
||||
return unless $PROGRAM_NAME == __FILE__
|
||||
|
||||
options = {
|
||||
include: [],
|
||||
nav: OptionNavigator.new
|
||||
|
@ -162,7 +160,7 @@ renderer_opts["hsize"] ||= IO.console_size[1]
|
|||
input = ARGV[0] == "-" ? $stdin.read : File.read(ARGV[0])
|
||||
output = ARGV[1] == "-" ? $stdout : File.open(ARGV[1], "w")
|
||||
doc = MMMD.parse(input)
|
||||
rclass = Renderers[options[:renderer] || "PlainTerm"]
|
||||
rclass = Renderers[options[:renderer] || "Plainterm"]
|
||||
raise StandardError, "unknown renderer: #{options[:renderer]}" unless rclass
|
||||
|
||||
renderer = rclass.call.new(doc, renderer_opts)
|
||||
|
|
|
@ -1209,7 +1209,9 @@ module PointBlank
|
|||
end
|
||||
return '<', parts[1..] unless buffer.match?(/^<[\w\-_+]+:[^<>\s]+>$/)
|
||||
|
||||
[build([buffer[1..-2]]), parts[(cutoff + 1)..]]
|
||||
obj = build([buffer[1..-2]])
|
||||
obj.properties[:uri] = buffer[1..-2]
|
||||
[obj, parts[(cutoff + 1)..]]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -98,6 +98,10 @@ module MMMD
|
|||
},
|
||||
"PointBlank::DOM::Text" => {
|
||||
sanitize: true
|
||||
},
|
||||
"PointBlank::DOM::InlineAutolink" => {
|
||||
tag: "a",
|
||||
href: true
|
||||
}
|
||||
}.freeze
|
||||
|
||||
|
@ -311,14 +315,12 @@ module MMMD
|
|||
|
||||
def read_title(element)
|
||||
title = element.properties[:title]
|
||||
title = MMMD::EntityUtils.encode_entities(title)
|
||||
title.dump
|
||||
title.inspect
|
||||
end
|
||||
|
||||
def read_link(element)
|
||||
link = element.properties[:uri]
|
||||
link = MMMD::EntityUtils.encode_entities(link)
|
||||
link.dump
|
||||
link.inspect
|
||||
end
|
||||
|
||||
def indent(text)
|
||||
|
|
|
@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|||
spec.email = "yessiest@text.512mb.org"
|
||||
spec.homepage = "https://adastra7.net/git/Yessiest/rubymark"
|
||||
spec.files = Dir["lib/**/*"]
|
||||
spec.bindir = Dir["bin/"]
|
||||
spec.bindir = Dir["bin"]
|
||||
spec.executables << "mmmdpp"
|
||||
spec.extra_rdoc_files = Dir["*.md"]
|
||||
spec.required_ruby_version = ">= 3.0.0"
|
||||
|
|
Loading…
Reference in New Issue