diff --git a/assets/images/docs-2.png b/assets/images/docs-2.png index 208aeade..0aa1a105 100644 Binary files a/assets/images/docs-2.png and b/assets/images/docs-2.png differ diff --git a/assets/images/docs-2@2x.png b/assets/images/docs-2@2x.png index fb263017..e6e018aa 100644 Binary files a/assets/images/docs-2@2x.png and b/assets/images/docs-2@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index c54e8fe7..47d694d9 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ "2017-09-03", - "New documentations: Nim and Vulkan" + "New documentations: D, Nim and Vulkan" ], [ "2017-07-23", "New documentation: Godot" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 11be6211..28884fc2 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -193,6 +193,11 @@ credits = [ '2012-2017 Manas Technology Solutions', 'Apache', 'https://raw.githubusercontent.com/crystal-lang/crystal/master/LICENSE' + ], [ + 'D', + '1999-2017 The D Language Foundation', + 'Boost', + 'https://raw.githubusercontent.com/dlang/phobos/master/LICENSE_1_0.txt' ], [ 'D3.js', '2010-2017 Michael Bostock', diff --git a/assets/javascripts/vendor/prism.js b/assets/javascripts/vendor/prism.js index 288a9c7f..b55bdecd 100644 --- a/assets/javascripts/vendor/prism.js +++ b/assets/javascripts/vendor/prism.js @@ -1,4 +1,4 @@ -/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+cpp+coffeescript+ruby+elixir+erlang+go+java+json+kotlin+lua+nginx+nim+perl+php+python+crystal+rust+scss+sql+typescript */ +/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+cpp+coffeescript+ruby+d+elixir+erlang+go+java+json+kotlin+lua+nginx+nim+perl+php+python+crystal+rust+scss+sql+typescript */ var _self = (typeof window !== 'undefined') ? window // if in browser : ( @@ -976,6 +976,70 @@ delete Prism.languages.coffeescript['template-string']; } ]; }(Prism)); +Prism.languages.d = Prism.languages.extend('clike', { + 'string': [ + // r"", x"" + /\b[rx]"(\\.|[^\\"])*"[cwd]?/, + // q"[]", q"()", q"<>", q"{}" + /\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/, + // q"IDENT + // ... + // IDENT" + /\bq"([_a-zA-Z][_a-zA-Z\d]*)(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\1"/, + // q"//", q"||", etc. + /\bq"(.)[\s\S]*?\1"/, + // Characters + /'(?:\\'|\\?[^']+)'/, + + /(["`])(\\.|(?!\1)[^\\])*\1[cwd]?/ + ], + + 'number': [ + // The lookbehind and the negative look-ahead try to prevent bad highlighting of the .. operator + // Hexadecimal numbers must be handled separately to avoid problems with exponent "e" + /\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i, + { + pattern: /((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i, + lookbehind: true + } + ], + + // In order: $, keywords and special tokens, globally defined symbols + 'keyword': /\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/, + 'operator': /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/ +}); + + +Prism.languages.d.comment = [ + // Shebang + /^\s*#!.+/, + // /+ +/ + { + // Allow one level of nesting + pattern: /(^|[^\\])\/\+(?:\/\+[\s\S]*?\+\/|[\s\S])*?\+\//, + lookbehind: true + } +].concat(Prism.languages.d.comment); + +Prism.languages.insertBefore('d', 'comment', { + 'token-string': { + // Allow one level of nesting + pattern: /\bq\{(?:|\{[^}]*\}|[^}])*\}/, + alias: 'string' + } +}); + +Prism.languages.insertBefore('d', 'keyword', { + 'property': /\B@\w*/ +}); + +Prism.languages.insertBefore('d', 'function', { + 'register': { + // Iasm registers + pattern: /\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/, + alias: 'variable' + } +}); Prism.languages.elixir = { // Negative look-ahead is needed for string interpolation // Negative look-behind is needed to avoid highlighting markdown headers in diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 566ef90d..c2c62f3d 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -175,3 +175,4 @@ ._icon-godot:before { background-position: -4rem -2rem; @extend %doc-icon-2; } ._icon-nim:before { background-position: -5rem -2rem; @extend %doc-icon-2; @extend %darkIconFix !optional; } ._icon-vulkan:before { background-position: -6rem -2rem; @extend %doc-icon-2; @extend %darkIconFix !optional; } +._icon-d:before { background-position: -7rem -2rem; @extend %doc-icon-2; } diff --git a/assets/stylesheets/pages/_d.scss b/assets/stylesheets/pages/_d.scss index 821b5ce3..b90ab8ec 100644 --- a/assets/stylesheets/pages/_d.scss +++ b/assets/stylesheets/pages/_d.scss @@ -1,44 +1,9 @@ ._d { - > .description, > .documentation-section { padding-left: 1rem; } - > .description > h2, header > h3, > h2 { @extend %block-heading; } - .description > h1 { font-size: 1rem; } - .method-description > h2, h3, h4, h5, h6 { font-size: 1em; } + h2 { @extend %block-heading; } + h3, .d_decl { @extend %block-label, %label-blue; } + .d_decl { @extend %code; } - .d_decl { - font-weight: $boldFontWeight; - @extend %block-label, %label-blue; + p > code, li > code, td > code, dd > code { @extend %label; } - + .d_decl { margin-top: -.5em; } - } - - > .meta { - @extend %note, %note-blue; - - > dd { margin: 0; } - > dd + dt { margin-top: .5em; } - } - - a.method-click-advice { - float: right; - font-size: .75rem; - color: $linkColor; - cursor: pointer; - @extend %user-select-none; - - &:hover { text-decoration: underline; } - } - - .method-description { position: relative; } - - .method-source-code { - display: none; - position: absolute; - z-index: 1; - top: 0; - right: 0; - background: rgba($contentBackground, .95); - box-shadow: 0 1em 1em 1em $contentBackground; - - > pre { margin: 0; } - } + span.red { color: $textColorRed; } } diff --git a/lib/docs/filters/d/clean_html.rb b/lib/docs/filters/d/clean_html.rb index 8beaed51..675816f9 100644 --- a/lib/docs/filters/d/clean_html.rb +++ b/lib/docs/filters/d/clean_html.rb @@ -2,9 +2,75 @@ module Docs class D class CleanHtmlFilter < Filter def call - css('.d_decl > div > span.def-anchor').each do |node| - node.parent.parent['id'] = node['id'] + @doc = at_css("#content") + + css('#tools', '#copyright').remove + + css('td > b', 'h1 > span').each do |node| + node.before(node.children).remove end + + css('span.d_inlinecode').each do |node| + node.name = 'code' + node.remove_attribute('class') + end + + css('.keyval').each do |node| + key = node.at_css('.key') + dt = key.inner_html + dd = if val = node.at_css('.val') + val.inner_html + else + siblings = [] + siblings << key while key = key.next + siblings.map(&:to_html).join + end + node.replace("