From 08f55a75c55aeaa23512e5052260225883a81a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Fri, 3 Jun 2016 14:07:30 +0200 Subject: [PATCH] Fix top page links and line number anchors. Fixes issue 16114, issue 15700 and issue 15701. --- dpl-docs/dub.selections.json | 2 +- dpl-docs/views/layout.dt | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/dpl-docs/dub.selections.json b/dpl-docs/dub.selections.json index 08c76bad4d..7d73bfd0b3 100644 --- a/dpl-docs/dub.selections.json +++ b/dpl-docs/dub.selections.json @@ -2,7 +2,7 @@ "fileVersion": 1, "versions": { "backtrace-d": "~master", - "ddox": "0.15.5", + "ddox": "0.15.6", "experimental_allocator": "2.70.0-b1", "hyphenate": "1.1.1", "libasync": "0.7.9", diff --git a/dpl-docs/views/layout.dt b/dpl-docs/views/layout.dt index aef92ac4e0..d656246ae6 100644 --- a/dpl-docs/views/layout.dt +++ b/dpl-docs/views/layout.dt @@ -166,27 +166,31 @@ html(lang='en-US') - project = "druntime", path_prefix = "src/"; - else - project = "phobos", path_prefix = ""; - - if( auto decl = cast(Declaration)info.node ) line_suffix = "#L"~to!string(decl.line); - - filename = replace(modname, ".", "/"); + - if (info.docGroups.length == 1) + - if (auto decl = cast(Declaration)info.docGroups[0].members[0]) line_suffix = "#L"~to!string(decl.line); + - if (info.node.module_.isPackageModule) + - filename = replace(modname, ".", "/") ~ "/package.d"; + - else + - filename = replace(modname, ".", "/") ~ ".d"; - if( modname ) .tip.smallprint - a(href='https://github.com/dlang/#{project}/blob/#{version_id}/#{path_prefix}#{filename}.d#{line_suffix}') + a(href='https://github.com/dlang/#{project}/blob/#{version_id}/#{path_prefix}#{filename}#{line_suffix}') | View source code div - | Display the source code in #{filename}.d from which this + | Display the source code in #{filename} from which this | page was generated on github. .tip.smallprint - - auto pagename = modname ? path_prefix ~ filename : "index" ; - a(href="https://issues.dlang.org/enter_bug.cgi?bug_file_loc=http%3A%2F%2Fdlang.org/library/#{pagename}.html&bug_severity=enhancement&component=#{project}&op_sys=All&priority=P3&product=D&rep_platform=All&short_desc=%5B#{title}%5D&version=D2") Report a bug + - auto pagename = modname ? path_prefix ~ replace(modname, ".", "/") : "index"; + a(href="https://issues.dlang.org/enter_bug.cgi?bug_file_loc=http%3A%2F%2Fdlang.org/#{ddox_dir}#{pagename}.html&bug_severity=enhancement&component=#{project}&op_sys=All&priority=P3&product=D&rep_platform=All&short_desc=%5B#{title}%5D&version=D2") Report a bug div | If you spot a problem with this page, click here to create a | Bugzilla issue. - if( modname ) .tip.smallprint - a(href='https://github.com/dlang/#{project}/edit/master/#{path_prefix}#{filename}.d') + a(href='https://github.com/dlang/#{project}/edit/master/#{path_prefix}#{filename}#{line_suffix}') | Improve this page div | Quickly fork, edit online, and submit a pull request for this page.