Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linkification in docs: refactor, fix edge cases and add specs #9817

Merged
merged 7 commits into from
Nov 11, 2020

Conversation

oprypin
Copy link
Member

@oprypin oprypin commented Oct 11, 2020

Summary of the outcome:

  • Methods will no longer be detected after an arbitrary word, e.g. foo.bar can be detected as just .bar for the current type with the first part just ignored.
    • In some cases that can be seen as a regression, but I think generally it's better to avoid accidental false positives.
    • Only the special case self.bar is preserved as before.
  • Detection of ::Type.method is fixed to find the whole thing, not just the .method part (also see previous item).
  • Detection of Foo.bar() will now include the empty brackets themselves, instead of the old Foo.bar().
  • Detection of bar() didn't work at all, now does.
  • aFoo would've been detected as aFoo; now it won't.
  • Code is greatly simplified and now has tests.

@oprypin
Copy link
Member Author

oprypin commented Oct 11, 2020

Diff after this for stdlib

diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/BigDecimal.html docs2/BigDecimal.html
--- docs1/BigDecimal.html	
+++ docs2/BigDecimal.html	
@@ -4976 +4976 @@
-          <p>Returns <em>num</em>. Useful for generic code that does <code>T<a href="BigDecimal.html#new(num:Float)-class-method">.new(...)</a></code> with <code>T</code>
+          <p>Returns <em>num</em>. Useful for generic code that does <code>T.new(...)</code> with <code>T</code>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/BigInt.html docs2/BigInt.html
--- docs1/BigInt.html	
+++ docs2/BigInt.html	
@@ -5737 +5737 @@
-          <p>Returns <em>num</em>. Useful for generic code that does <code>T<a href="BigInt.html#new(num:Int::Signed)-class-method">.new(...)</a></code> with <code>T</code>
+          <p>Returns <em>num</em>. Useful for generic code that does <code>T.new(...)</code> with <code>T</code>
@@ -6831 +6831 @@
-<ul><li><code>q = x<a href="BigInt.html#tdiv(other:Int):BigInt-instance-method">.tdiv(y)</a></code> is rounded toward zero</li><li><code>r = x<a href="BigInt.html#remainder(other:Int):BigInt-instance-method">.remainder(y)</a></code> has the sign of the first argument</li><li><code>x == q*y + r</code></li></ul>
+<ul><li><code>q = x.tdiv(y)</code> is rounded toward zero</li><li><code>r = x.remainder(y)</code> has the sign of the first argument</li><li><code>x == q*y + r</code></li></ul>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Crystal/Macros/ProcPointer.html docs2/Crystal/Macros/ProcPointer.html
--- docs1/Crystal/Macros/ProcPointer.html	
+++ docs2/Crystal/Macros/ProcPointer.html	
@@ -3667 +3667 @@
-  <p>A proc pointer, like <code>->my_var.some_method(String)</code></p>
+  <p>A proc pointer, like <code>->my_var.some_method(<a href="../../String.html">String</a>)</code></p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Crystal/Macros/TypeNode.html docs2/Crystal/Macros/TypeNode.html
--- docs1/Crystal/Macros/TypeNode.html	
+++ docs2/Crystal/Macros/TypeNode.html	
@@ -4532 +4532 @@
-methods by invoking <code>type<a href="../../Crystal/Macros/TypeNode.html#class:TypeNode-instance-method">.class</a><a href="../../Crystal/Macros/TypeNode.html#methods:ArrayLiteral(Def)-instance-method">.methods</a></code>.</p>
+methods by invoking <code>type.class.methods</code>.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Digest/Base.html docs2/Digest/Base.html
--- docs1/Digest/Base.html	
+++ docs2/Digest/Base.html	
@@ -4127 +4127 @@
-<p><span class="flag purple">NOTE</span>  <code>.dup<a href="../Digest/Base.html#final:Bytes-instance-method">.final</a></code> call may be used to get an intermediate hash value.</p>
+<p><span class="flag purple">NOTE</span>  <code>.dup.final</code> call may be used to get an intermediate hash value.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/File/Info.html docs2/File/Info.html
--- docs1/File/Info.html	
+++ docs2/File/Info.html	
@@ -4135 +4135 @@
-<code>type<a href="../File/Info.html#directory?-instance-method">.directory?</a></code>.</p>
+<code>type.directory?</code>.</p>
@@ -4157 +4157 @@
-<code>type<a href="../File/Info.html#file?-instance-method">.file?</a></code>.</p>
+<code>type.file?</code>.</p>
@@ -4379 +4379 @@
-Shortcut for <code>type<a href="../File/Info.html#symlink?-instance-method">.symlink?</a></code>.</p>
+Shortcut for <code>type.symlink?</code>.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Hash/Entry.html docs2/Hash/Entry.html
--- docs1/Hash/Entry.html	
+++ docs2/Hash/Entry.html	
@@ -4117 +4117 @@
-<p>This method must have the property that <code>a == b</code> implies <code>a<a href="../Hash/Entry.html#hash-instance-method">.hash</a> == b<a href="../Hash/Entry.html#hash-instance-method">.hash</a></code>.</p>
+<p>This method must have the property that <code>a == b</code> implies <code>a.hash == b.hash</code>.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Int.html docs2/Int.html
--- docs1/Int.html	
+++ docs2/Int.html	
@@ -6603 +6603 @@
-<ul><li><code>q = x<a href="Int.html#tdiv(other:Int)-instance-method">.tdiv(y)</a></code> is rounded toward zero</li><li><code>r = x<a href="Int.html#remainder(other:Int)-instance-method">.remainder(y)</a></code> has the sign of the first argument</li><li><code>x == q*y + r</code></li></ul>
+<ul><li><code>q = x.tdiv(y)</code> is rounded toward zero</li><li><code>r = x.remainder(y)</code> has the sign of the first argument</li><li><code>x == q*y + r</code></li></ul>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Iterable.html docs2/Iterable.html
--- docs1/Iterable.html	
+++ docs2/Iterable.html	
@@ -3755 +3755 @@
-          <div class="summary"><p>Same as <code>each<a href="Iterable.html#cycle(n)-instance-method">.cycle(n)</a></code>.</p></div>
+          <div class="summary"><p>Same as <code>each.cycle(n)</code>.</p></div>
@@ -3762 +3762 @@
-          <div class="summary"><p>Same as <code>each<a href="Iterable.html#cycle-instance-method">.cycle</a></code>.</p></div>
+          <div class="summary"><p>Same as <code>each.cycle</code>.</p></div>
@@ -3804 +3804 @@
-          <div class="summary"><p>Same as <code>each<a href="Iterable.html#slice_after(pattern,reuse:Bool%7CArray(T)=false)-instance-method">.slice_after(reuse, &block)</a></code>.</p></div>
+          <div class="summary"><p>Same as <code>each.slice_after(reuse, &block)</code>.</p></div>
@@ -3811 +3811 @@
-          <div class="summary"><p>Same as <code>each<a href="Iterable.html#slice_after(pattern,reuse:Bool%7CArray(T)=false)-instance-method">.slice_after(pattern, reuse)</a></code>.</p></div>
+          <div class="summary"><p>Same as <code>each.slice_after(pattern, reuse)</code>.</p></div>
@@ -3818 +3818 @@
-          <div class="summary"><p>Same as <code>each<a href="Iterable.html#slice_before(pattern,reuse:Bool%7CArray(T)=false)-instance-method">.slice_before(reuse, &block)</a></code>.</p></div>
+          <div class="summary"><p>Same as <code>each.slice_before(reuse, &block)</code>.</p></div>
@@ -3825 +3825 @@
-          <div class="summary"><p>Same as <code>each<a href="Iterable.html#slice_before(pattern,reuse:Bool%7CArray(T)=false)-instance-method">.slice_before(pattern, reuse)</a></code>.</p></div>
+          <div class="summary"><p>Same as <code>each.slice_before(pattern, reuse)</code>.</p></div>
@@ -3917 +3917 @@
-          <p>Same as <code>each<a href="Iterable.html#cycle(n)-instance-method">.cycle(n)</a></code>.</p>
+          <p>Same as <code>each.cycle(n)</code>.</p>
@@ -3938 +3938 @@
-          <p>Same as <code>each<a href="Iterable.html#cycle-instance-method">.cycle</a></code>.</p>
+          <p>Same as <code>each.cycle</code>.</p>
@@ -4064 +4064 @@
-          <p>Same as <code>each<a href="Iterable.html#slice_after(pattern,reuse:Bool%7CArray(T)=false)-instance-method">.slice_after(reuse, &block)</a></code>.</p>
+          <p>Same as <code>each.slice_after(reuse, &block)</code>.</p>
@@ -4085 +4085 @@
-          <p>Same as <code>each<a href="Iterable.html#slice_after(pattern,reuse:Bool%7CArray(T)=false)-instance-method">.slice_after(pattern, reuse)</a></code>.</p>
+          <p>Same as <code>each.slice_after(pattern, reuse)</code>.</p>
@@ -4106 +4106 @@
-          <p>Same as <code>each<a href="Iterable.html#slice_before(pattern,reuse:Bool%7CArray(T)=false)-instance-method">.slice_before(reuse, &block)</a></code>.</p>
+          <p>Same as <code>each.slice_before(reuse, &block)</code>.</p>
@@ -4127 +4127 @@
-          <p>Same as <code>each<a href="Iterable.html#slice_before(pattern,reuse:Bool%7CArray(T)=false)-instance-method">.slice_before(pattern, reuse)</a></code>.</p>
+          <p>Same as <code>each.slice_before(pattern, reuse)</code>.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/JSON.html docs2/JSON.html
--- docs1/JSON.html	
+++ docs2/JSON.html	
@@ -3699 +3699 @@
-<code>T.from_json_object_key?(key : String) : T?</code> method, which can return <code>nil</code>
+<code>T.from_json_object_key?(key : <a href="String.html">String</a>) : T?</code> method, which can return <code>nil</code>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Log.html docs2/Log.html
--- docs1/Log.html	
+++ docs2/Log.html	
@@ -3712 +3712 @@
-<p>That way, any <code><a href="Log.html#info(*,exception:Exception?=nil,&)-class-method">Log.info</a></code> call within the <code>DB</code> module will use the <code>db</code> source. And not the top-level <code><a href="Log.html">::Log</a><a href="Log.html#info(*,exception:Exception?=nil,&)-class-method">.info</a></code>.</p>
+<p>That way, any <code><a href="Log.html#info(*,exception:Exception?=nil,&)-class-method">Log.info</a></code> call within the <code>DB</code> module will use the <code>db</code> source. And not the top-level <code><a href="Log.html#info(*,exception:Exception?=nil,&)-class-method">::Log.info</a></code>.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Object.html docs2/Object.html
--- docs1/Object.html	
+++ docs2/Object.html	
@@ -4402 +4402 @@
-(<code>!foo</code>) but it can also be written as a regular method call (<code>foo<a href="Object.html#!:Bool-instance-method">.!</a></code>).</p>
+(<code>!foo</code>) but it can also be written as a regular method call (<code>foo.!</code>).</p>
@@ -4780 +4780 @@
-<p>This method must have the property that <code>a == b</code> implies <code>a<a href="Object.html#hash-instance-method">.hash</a> == b<a href="Object.html#hash-instance-method">.hash</a></code>.</p>
+<p>This method must have the property that <code>a == b</code> implies <code>a.hash == b.hash</code>.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/OpenSSL/SSL/Server.html docs2/OpenSSL/SSL/Server.html
--- docs1/OpenSSL/SSL/Server.html	
+++ docs2/OpenSSL/SSL/Server.html	
@@ -3788 +3788 @@
-          <div class="summary"><p>Implements <code><a href="../../Socket/Server.html">::Socket::Server</a><a href="../../OpenSSL/SSL/Server.html#accept:OpenSSL::SSL::Socket::Server-instance-method">#accept</a></code>.</p></div>
+          <div class="summary"><p>Implements <code><a href="../../Socket/Server.html#accept:IO-instance-method">::Socket::Server#accept</a></code>.</p></div>
@@ -3795 +3795 @@
-          <div class="summary"><p>Implements <code><a href="../../Socket/Server.html">::Socket::Server</a><a href="../../OpenSSL/SSL/Server.html#accept?:OpenSSL::SSL::Socket::Server?-instance-method">#accept?</a></code>.</p></div>
+          <div class="summary"><p>Implements <code><a href="../../Socket/Server.html#accept?:IO?-instance-method">::Socket::Server#accept?</a></code>.</p></div>
@@ -4214 +4214 @@
-          <p>Implements <code><a href="../../Socket/Server.html">::Socket::Server</a><a href="../../OpenSSL/SSL/Server.html#accept:OpenSSL::SSL::Socket::Server-instance-method">#accept</a></code>.</p>
+          <p>Implements <code><a href="../../Socket/Server.html#accept:IO-instance-method">::Socket::Server#accept</a></code>.</p>
@@ -4216 +4216 @@
-<p>This method calls <code>@wrapped<a href="../../OpenSSL/SSL/Server.html#accept:OpenSSL::SSL::Socket::Server-instance-method">.accept</a></code> and wraps the resulting IO in a SSL socket (<code><a href="../../OpenSSL/SSL/Socket/Server.html">OpenSSL::SSL::Socket::Server</a></code>) with <code><a href="../../OpenSSL/SSL/Server.html#context:OpenSSL::SSL::Context::Server-instance-method">#context</a></code> configuration.</p>
+<p>This method calls <code>@wrapped.accept</code> and wraps the resulting IO in a SSL socket (<code><a href="../../OpenSSL/SSL/Socket/Server.html">OpenSSL::SSL::Socket::Server</a></code>) with <code><a href="../../OpenSSL/SSL/Server.html#context:OpenSSL::SSL::Context::Server-instance-method">#context</a></code> configuration.</p>
@@ -4237 +4237 @@
-          <p>Implements <code><a href="../../Socket/Server.html">::Socket::Server</a><a href="../../OpenSSL/SSL/Server.html#accept?:OpenSSL::SSL::Socket::Server?-instance-method">#accept?</a></code>.</p>
+          <p>Implements <code><a href="../../Socket/Server.html#accept?:IO?-instance-method">::Socket::Server#accept?</a></code>.</p>
@@ -4239 +4239 @@
-<p>This method calls <code>@wrapped<a href="../../OpenSSL/SSL/Server.html#accept?:OpenSSL::SSL::Socket::Server?-instance-method">.accept?</a></code> and wraps the resulting IO in a SSL socket (<code><a href="../../OpenSSL/SSL/Socket/Server.html">OpenSSL::SSL::Socket::Server</a></code>) with <code><a href="../../OpenSSL/SSL/Server.html#context:OpenSSL::SSL::Context::Server-instance-method">#context</a></code> configuration.</p>
+<p>This method calls <code>@wrapped.accept?</code> and wraps the resulting IO in a SSL socket (<code><a href="../../OpenSSL/SSL/Socket/Server.html">OpenSSL::SSL::Socket::Server</a></code>) with <code><a href="../../OpenSSL/SSL/Server.html#context:OpenSSL::SSL::Context::Server-instance-method">#context</a></code> configuration.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Path.html docs2/Path.html
--- docs1/Path.html	
+++ docs2/Path.html	
@@ -3696 +3696 @@
-<ul><li><code><a href="Path.html#posix(path:Path):Path-class-method">Path.posix</a>()</code> creates a new POSIX path</li><li><code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows</a>()</code> creates a new Windows path</li><li><code><a href="Path.html#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">Path.new</a>()</code> means <code><a href="Path.html#posix(path:Path):Path-class-method">Path.posix</a></code> on POSIX platforms and <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows</a>()</code>
+<ul><li><code><a href="Path.html#posix(path:Path):Path-class-method">Path.posix()</a></code> creates a new POSIX path</li><li><code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows()</a></code> creates a new Windows path</li><li><code><a href="Path.html#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">Path.new()</a></code> means <code><a href="Path.html#posix(path:Path):Path-class-method">Path.posix</a></code> on POSIX platforms and <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows()</a></code>
@@ -4526 +4526 @@
-<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows</a>()</code>,
+<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows()</a></code>,
@@ -4550 +4550 @@
-<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows</a>()</code>,
+<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows()</a></code>,
@@ -4611 +4611 @@
-<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows</a>()</code>,
+<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows()</a></code>,
@@ -4651 +4651 @@
-<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows</a>()</code>,
+<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows()</a></code>,
@@ -4675 +4675 @@
-<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows</a>()</code>,
+<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows()</a></code>,
@@ -4699 +4699 @@
-<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows</a>()</code>,
+<p>When compiling for a windows target, this is equal to <code><a href="Path.html#windows(name:String=&quot;&quot;):Path-class-method">Path.windows()</a></code>,
@@ -5554 +5554 @@
-<p>That means with normalized paths <code>base<a href="Path.html#join(part):Path-instance-method">.join(target.relative_to(base)</a>)</code> is
+<p>That means with normalized paths <code>base.join(target.relative_to(base))</code> is
@@ -5585 +5585 @@
-<p>That means with normalized paths <code>base<a href="Path.html#join(part):Path-instance-method">.join(target.relative_to(base)</a>)</code> is
+<p>That means with normalized paths <code>base.join(target.relative_to(base))</code> is
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Pointer.html docs2/Pointer.html
--- docs1/Pointer.html	
+++ docs2/Pointer.html	
@@ -4633 +4633 @@
-That is, this is <code>(self<a href="Pointer.html#address:UInt64-instance-method">.address</a> - other<a href="Pointer.html#address:UInt64-instance-method">.address</a>) / sizeof(T)</code>.</p>
+That is, this is <code>(self<a href="Pointer.html#address:UInt64-instance-method">.address</a> - other.address) / sizeof(T)</code>.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Slice.html docs2/Slice.html
--- docs1/Slice.html	
+++ docs2/Slice.html	
@@ -5805 +5805 @@
-e.g. <code>dest<a href="Slice.html#size:Int32-instance-method">.size</a> < self<a href="Slice.html#size:Int32-instance-method">.size</a></code>.</p>
+e.g. <code>dest.size < self<a href="Slice.html#size:Int32-instance-method">.size</a></code>.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/String.html docs2/String.html
--- docs1/String.html	
+++ docs2/String.html	
@@ -6349 +6349 @@
-<p>In this case the implementation just returns the result of calling <code>value<a href="String.html#to_s:String-instance-method">.to_s</a></code>.</p>
+<p>In this case the implementation just returns the result of calling <code>value.to_s</code>.</p>
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/Time.html docs2/Time.html
--- docs1/Time.html	
+++ docs2/Time.html	
@@ -5670 +5670 @@
-<p>For example, adding <code>1<a href="Time.html#month:Int32-instance-method">.month</a></code> to <code>2007-03-31</code> would result in the invalid
+<p>For example, adding <code>1.month</code> to <code>2007-03-31</code> would result in the invalid
@@ -5704 +5704 @@
-<p>For example, subtracting <code>1<a href="Time.html#month:Int32-instance-method">.month</a></code> from <code>2007-05-31</code> would result in the invalid
+<p>For example, subtracting <code>1.month</code> from <code>2007-05-31</code> would result in the invalid
diff -U0 -r '--exclude=*.js' '--exclude=*.json' '--exclude=Crystal.html' '--ignore-matching-lines=<meta name="generator"' docs1/toplevel.html docs2/toplevel.html
--- docs1/toplevel.html	
+++ docs2/toplevel.html	
@@ -4511 +4511 @@
-<p><em>type</em> must be a constant or <code>typeof()</code> expression. It cannot be evaluated at runtime.</p>
+<p><em>type</em> must be a constant or <code><a href="toplevel.html#typeof(*expression):Class-class-method">typeof()</a></code> expression. It cannot be evaluated at runtime.</p>
@@ -4593 +4593 @@
-<p><em>type</em> must be a constant or <code>typeof()</code> expression. It cannot be evaluated at runtime.
+<p><em>type</em> must be a constant or <code><a href="toplevel.html#typeof(*expression):Class-class-method">typeof()</a></code> expression. It cannot be evaluated at runtime.
@@ -5010 +5010 @@
-<p><em>type</em> must be a constant or <code>typeof()</code> expression. It cannot be evaluated
+<p><em>type</em> must be a constant or <code><a href="toplevel.html#typeof(*expression):Class-class-method">typeof()</a></code> expression. It cannot be evaluated

@oprypin oprypin changed the title Linkification in docs: fix edge cases and add specs Linkification in docs: refactor, fix edge cases and add specs Oct 11, 2020
@bcardiff bcardiff added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:docs-generator labels Oct 26, 2020
@straight-shoota
Copy link
Member

straight-shoota commented Oct 30, 2020

Could you please add a textual description of this change? It's really helpful for documentation and tracability. Reviewers should not have to extract the meaning of a PR from its implementation and the result diff. Thanks.

@oprypin
Copy link
Member Author

oprypin commented Oct 30, 2020

Added PR description:

Linkification in docs: refactor, fix edge cases and add specs

Summary of the outcome:

* Methods will no longer be detected after an arbitrary word, e.g. `foo.bar` can be detected as just `.bar` for the current type with the first part just ignored.
   * In some cases that can be seen as a regression, but I think generally it's better to avoid accidental false positives.
   * Only the special case `self.bar` is preserved as before.
* Detection of `::Type.method` is fixed to find the whole thing, not just the `.method` part (also see previous item).
* Detection of `Foo.bar()` will now include the empty brackets themselves, instead of the old `Foo.bar`().
* Detection of `bar()` didn't work at all, now does.
* `aFoo` would've been detected as a`Foo`; now it won't.
* Code is greatly simplified and now has tests.

@bcardiff bcardiff added this to the 1.0.0 milestone Nov 6, 2020
@bcardiff bcardiff merged commit 5eda5be into crystal-lang:master Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:docs-generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants