Fixes #626.
Unified · Split
| @@ -230,7 +230,7 @@ credits = [ · 229 unmodified lines | ||
| 230 | 230 | 'https://raw.githubusercontent.com/elixir-lang/elixir/master/LICENSE' |
| 231 | 231 | ], [ |
| 232 | 232 | 'Erlang', |
| 233 | − '1999-2016 Ericsson AB', | |
| 233 | + '2010-2017 Ericsson AB', | |
| 234 | 234 | 'Apache', |
| 235 | 235 | 'https://raw.githubusercontent.com/erlang/otp/maint/LICENSE.txt' |
| 236 | 236 | ], [ |
| @@ -1066,6 +1066,50 @@ Prism.languages.elixir.string.forEach(function(o) { · 1065 unmodified lines | ||
| 1066 | 1066 | }); |
| 1067 | 1067 | |
| 1068 | 1068 | |
| 1069 | +Prism.languages.erlang = { | |
| 1070 | + 'comment': /%.+/, | |
| 1071 | + 'string': { | |
| 1072 | + pattern: /"(?:\\?.)*?"/, | |
| 1073 | + greedy: true | |
| 1074 | + }, | |
| 1075 | + 'quoted-function': { | |
| 1076 | + pattern: /'(?:\\.|[^'\\])+'(?=\()/, | |
| 1077 | + alias: 'function' | |
| 1078 | + }, | |
| 1079 | + 'quoted-atom': { | |
| 1080 | + pattern: /'(?:\\.|[^'\\])+'/, | |
| 1081 | + alias: 'atom' | |
| 1082 | + }, | |
| 1083 | + 'boolean': /\b(?:true|false)\b/, | |
| 1084 | + 'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/, | |
| 1085 | + 'number': [ | |
| 1086 | + /\$\\?./, | |
| 1087 | + /\d+#[a-z0-9]+/i, | |
| 1088 | + /(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/ | |
| 1089 | + ], | |
| 1090 | + 'function': /\b[a-z][\w@]*(?=\()/, | |
| 1091 | + 'variable': { | |
| 1092 | + // Look-behind is used to prevent wrong highlighting of atoms containing "@" | |
| 1093 | + pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/, | |
| 1094 | + lookbehind: true | |
| 1095 | + }, | |
| 1096 | + 'operator': [ | |
| 1097 | + /[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/, | |
| 1098 | + { | |
| 1099 | + // We don't want to match << | |
| 1100 | + pattern: /(^|[^<])<(?!<)/, | |
| 1101 | + lookbehind: true | |
| 1102 | + }, | |
| 1103 | + { | |
| 1104 | + // We don't want to match >> | |
| 1105 | + pattern: /(^|[^>])>(?!>)/, | |
| 1106 | + lookbehind: true | |
| 1107 | + } | |
| 1108 | + ], | |
| 1109 | + 'atom': /\b[a-z][\w@]*/, | |
| 1110 | + 'punctuation': /[()[\]{}:;,.#|]|<<|>>/ | |
| 1111 | + | |
| 1112 | +}; | |
| 1069 | 1113 | Prism.languages.go = Prism.languages.extend('clike', { |
| 1070 | 1114 | 'keyword': /\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/, |
| 1071 | 1115 | 'builtin': /\b(bool|byte|complex(64|128)|error|float(32|64)|rune|string|u?int(8|16|32|64|)|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(ln)?|real|recover)\b/, |
| @@ -24,6 +24,7 @@ app.views.DockerPage = · 23 unmodified lines | ||
| 24 | 24 | app.views.DrupalPage = |
| 25 | 25 | app.views.ElixirPage = |
| 26 | 26 | app.views.EmberPage = |
| 27 | +app.views.ErlangPage = | |
| 27 | 28 | app.views.ExpressPage = |
| 28 | 29 | app.views.FlowPage = |
| 29 | 30 | app.views.GoPage = |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | ._erlang { |
| 2 | 2 | @extend %simple; |
| 3 | 3 | |
| 4 | − h3.code { @extend %code; } | |
| 4 | + h3 > code { display: block; } | |
| 5 | 5 | code.code { @extend %label; } |
| 6 | 6 | .note { @extend %note; } |
| 7 | 7 | .warning { @extend %note, %note-red; } |
| @@ -8,7 +8,7 @@ module Docs · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | css('center:last-child').remove # copyright |
| 10 | 10 | |
| 11 | − css('center').each do |node| | |
| 11 | + css('center', '.example').each do |node| | |
| 12 | 12 | node.before(node.children).remove |
| 13 | 13 | end |
| 14 | 14 | |
| @@ -30,12 +30,10 @@ module Docs · 15 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | # others |
| 32 | 32 | |
| 33 | − # css('p > br:last-child').remove | |
| 34 | − | |
| 35 | 33 | css('a[name]').each do |node| |
| 36 | − parent = node.parent | |
| 37 | − parent = parent.parent while parent.name == 'span' | |
| 38 | − parent['id'] = node['name'] | |
| 34 | + # parent = node.parent | |
| 35 | + # parent = parent.parent while parent.name == 'span' | |
| 36 | + (node.next_element || node.parent)['id'] ||= node['name'] | |
| 39 | 37 | node.before(node.children).remove |
| 40 | 38 | end |
| 41 | 39 | |
| @@ -48,10 +46,11 @@ module Docs · 6 unmodified lines | ||
| 48 | 46 | css('p > .bold_code:first-child ~ br:last-child').each do |node| |
| 49 | 47 | parent = node.parent |
| 50 | 48 | parent.name = 'h3' |
| 51 | − parent['class'] = 'code' | |
| 52 | − parent.css('*:not(a):not(br)').each { |n| n.before(n.children).remove } | |
| 53 | − node.remove | |
| 54 | − parent.inner_html = parent.inner_html.strip | |
| 49 | + parent.css('> br').remove | |
| 50 | + parent.css('> code').each do |code| | |
| 51 | + code.css('*:not(a):not(br)').each { |n| n.before(n.children).remove } | |
| 52 | + code.inner_html = code.inner_html.gsub('<br>', "\n").strip | |
| 53 | + end | |
| 55 | 54 | end |
| 56 | 55 | |
| 57 | 56 | css('pre:not(.REFTYPES) *:not(a)', 'a[href^=javascript]').each do |node| |
| @@ -59,6 +58,7 @@ module Docs · 1 unmodified line | ||
| 59 | 58 | end |
| 60 | 59 | |
| 61 | 60 | css('pre:not(.REFTYPES)').each do |node| |
| 61 | + node['data-language'] = 'erlang' | |
| 62 | 62 | node.inner_html = node.inner_html.strip_heredoc |
| 63 | 63 | end |
| 64 | 64 | |
| @@ -80,6 +80,7 @@ module Docs · 15 unmodified lines | ||
| 80 | 80 | node = node.next_element |
| 81 | 81 | node.previous_element.remove |
| 82 | 82 | end |
| 83 | + html.gsub! %r{\n{2,}}, "\n" | |
| 83 | 84 | html.strip! |
| 84 | 85 | html << "</pre>" |
| 85 | 86 | node.before(html) |
| @@ -98,6 +99,8 @@ module Docs · 12 unmodified lines | ||
| 98 | 99 | node.remove_attribute('valign') |
| 99 | 100 | end |
| 100 | 101 | |
| 102 | + css('.bold_code').remove_attr('class') | |
| 103 | + | |
| 101 | 104 | doc |
| 102 | 105 | end |
| 103 | 106 | end |
| @@ -42,12 +42,14 @@ module Docs · 41 unmodified lines | ||
| 42 | 42 | return [] unless include_default_entry? |
| 43 | 43 | |
| 44 | 44 | if subpath.start_with?('lib/') |
| 45 | − entry_nodes.map do |node| | |
| 45 | + names = Set.new | |
| 46 | + entry_nodes.each_with_object [] do |node, entries| | |
| 46 | 47 | id = node['name'] |
| 47 | − name = id.gsub %r{\-(?<arity>.*)\z}, '/\k<arity>' | |
| 48 | + name = id.remove %r{\-\d*\z} | |
| 49 | + name << ' (type)' if name.sub!(/\Atype-/, '') | |
| 48 | 50 | name.remove! 'Module:' |
| 49 | 51 | name.prepend "#{self.name}:" |
| 50 | − [name, id] | |
| 52 | + entries << [name, id] if names.add?(name) | |
| 51 | 53 | end |
| 52 | 54 | elsif subpath.start_with?('doc/') |
| 53 | 55 | [] |
| @@ -65,7 +67,9 @@ module Docs · 11 unmodified lines | ||
| 65 | 67 | |
| 66 | 68 | def entry_nodes |
| 67 | 69 | @entry_nodes ||= if subpath.start_with?('lib/') |
| 68 | − css('div.REFBODY + p > a') | |
| 70 | + css('p + div.REFBODY').each_with_object [] do |node, result| | |
| 71 | + result.concat(node.previous_element.css('a[name]').to_a) | |
| 72 | + end | |
| 69 | 73 | elsif subpath.start_with?('erts') |
| 70 | 74 | link = at_css(".flipMenu a[href='#{File.basename(subpath, '.html')}']") |
| 71 | 75 | list = link.parent.parent |
| @@ -36,7 +36,7 @@ module Docs · 35 unmodified lines | ||
| 36 | 36 | ] |
| 37 | 37 | |
| 38 | 38 | options[:attribution] = <<-HTML |
| 39 | − © 1999–2016 Ericsson AB<br> | |
| 39 | + © 2010–2017 Ericsson AB<br> | |
| 40 | 40 | Licensed under the Apache License, Version 2.0. |
| 41 | 41 | HTML |
| 42 | 42 | |