Merge branch 'org-mode-file-links' of https://github.com/hugoduncan/gollum into hugoduncan-org-mode-file-links
This commit is contained in:
@@ -121,7 +121,18 @@ module Gollum
|
|||||||
if $1 == "'" && $3 != "'"
|
if $1 == "'" && $3 != "'"
|
||||||
"[[#{$2}]]#{$3}"
|
"[[#{$2}]]#{$3}"
|
||||||
elsif $2.include?('][')
|
elsif $2.include?('][')
|
||||||
|
if $2[0..4] == 'file:'
|
||||||
|
pre = $1
|
||||||
|
post = $3
|
||||||
|
parts = $2.split('][')
|
||||||
|
parts[0][0..4] = ""
|
||||||
|
link = "#{parts[1]}|#{parts[0].sub(/\.org/,'')}"
|
||||||
|
id = Digest::SHA1.hexdigest(link)
|
||||||
|
@tagmap[id] = link
|
||||||
|
"#{pre}#{id}#{post}"
|
||||||
|
else
|
||||||
$&
|
$&
|
||||||
|
end
|
||||||
else
|
else
|
||||||
id = Digest::SHA1.hexdigest($2)
|
id = Digest::SHA1.hexdigest($2)
|
||||||
@tagmap[id] = $2
|
@tagmap[id] = $2
|
||||||
|
|||||||
@@ -440,6 +440,12 @@ context "Markup" do
|
|||||||
compare(content, output, 'org')
|
compare(content, output, 'org')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "org mode style double file links" do
|
||||||
|
content = "a [[file:f.org][Google]] b"
|
||||||
|
output = "<p class=\"title\">a <a class=\"internal absent\" href=\"/f\">Google</a> b</p>"
|
||||||
|
compare(content, output, 'org')
|
||||||
|
end
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# TeX
|
# TeX
|
||||||
|
|||||||
Reference in New Issue
Block a user