www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.internals - [Documentation] Add copyable text "import ..." under title

reply Andrey <saasecondbox yandex.ru> writes:
Hello,
I have an idea. Let's add on all pages in documentation that 
describe some importable entity (function, class, template...) in 
place under the title a special <p></p> field with text: "import 
..." and a button "Copy to clipboard" near that copies that text.

For example let's take the page 
"https://dlang.org/library/std/uni/is_upper.html" for function 
isUpper.
Under the title "Function std.uni.isUpper" we add <p></p> field 
with text:
 import std.uni : isUpper;
and a button. User will press that button, copy import instruction and after that can paste it in his code. I think this enchancement will be useful. Imagine that you search in docs for some function/class/template etc. To use it you must import it your code. What you will do? - copy text in title "std.uni.isUpper". Then you will write word "import" with space and paste in code, then remove last dot and write " : ". Finally will write semicolon. Press one button and after CTRL+V is better and faster from my point of view. What do you think?
Feb 08 2020
parent Sebastian Wilzbach <seb wilzba.ch> writes:
Hi Andrey,

This has been tried before in 2016: 
https://github.com/dlang/dlang.org/pull/1330

You might be able to reuse some parts of this PR.

Cheers,

Seb

On February 8, 2020 13:05:39 Andrey via Dlang-internal 
<dlang-internal puremagic.com> wrote:

 Hello,
 I have an idea. Let's add on all pages in documentation that
 describe some importable entity (function, class, template...) in
 place under the title a special <p></p> field with text: "import
 ..." and a button "Copy to clipboard" near that copies that text.

 For example let's take the page
 "https://dlang.org/library/std/uni/is_upper.html" for function
 isUpper.
 Under the title "Function std.uni.isUpper" we add <p></p> field
 with text:
 import std.uni : isUpper;
and a button. User will press that button, copy import instruction and after that can paste it in his code. I think this enchancement will be useful. Imagine that you search in docs for some function/class/template etc. To use it you must import it your code. What you will do? - copy text in title "std.uni.isUpper". Then you will write word "import" with space and paste in code, then remove last dot and write " : ". Finally will write semicolon. Press one button and after CTRL+V is better and faster from my point of view. What do you think?
Feb 08 2020