Fix documentation links to try/catch section (#5349)

* Fix documentation links to try/catch section

Consistently use `#try-catch` for the section (and `#try` for the demo)

* Fix documentation source
This commit is contained in:
Erik Demaine 2021-09-15 13:39:38 -04:00 committed by GitHub
parent b90bc2459a
commit b0946c3c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 8 deletions

View File

@ -555,7 +555,8 @@ pre .xml .cdata {
<a href="#destructuring">Destructuring Assignment</a>
<a href="#fat-arrow">Bound and Generator Functions</a>
<a href="#embedded">Embedded JavaScript</a>
<a href="#switch">Switch and Try/Catch</a>
<a href="#switch">Switch/When/Else</a>
<a href="#try-catch">Try/Catch/Finally</a>
<a href="#comparisons">Chained Comparisons</a>
<a href="#strings">String Interpolation, Block Strings, and Block Comments</a>
<a href="#tagged-template-literals">Tagged Template Literals</a>
@ -853,7 +854,7 @@ cubes = (function() {
<h2>Language Reference</h2>
<p><em>This reference is structured so that it can be read from top to bottom, if you like. Later sections use ideas and syntax previously introduced. Familiarity with JavaScript is assumed. In all of the following examples, the source CoffeeScript is provided on the left, and the direct compilation into JavaScript is on the right.</em></p>
<p><em>Many of the examples can be run (where it makes sense) by pressing the <strong>run</strong> button on the right, and can be loaded into the “Try CoffeeScript” console by pressing the <strong>load</strong> button on the left.</em></p>
<p>First, the basics: CoffeeScript uses significant whitespace to delimit blocks of code. You dont need to use semicolons <code>;</code> to terminate expressions, ending the line will do just as well (although semicolons can still be used to fit multiple expressions onto a single line). Instead of using curly braces <code>{ }</code> to surround blocks of code in <a href="#literals">functions</a>, <a href="#conditionals">if-statements</a>, <a href="#switch">switch</a>, and <a href="#try">try/catch</a>, use indentation.</p>
<p>First, the basics: CoffeeScript uses significant whitespace to delimit blocks of code. You dont need to use semicolons <code>;</code> to terminate expressions, ending the line will do just as well (although semicolons can still be used to fit multiple expressions onto a single line). Instead of using curly braces <code>{ }</code> to surround blocks of code in <a href="#literals">functions</a>, <a href="#conditionals">if-statements</a>, <a href="#switch">switch</a>, and <a href="#try-catch">try/catch</a>, use indentation.</p>
<p>You dont need to use parentheses to invoke a function if youre passing arguments. The implicit call wraps forward to the end of the line or block expression.<br>
<code>console.log sys.inspect object</code><code>console.log(sys.inspect(object));</code></p>

View File

@ -630,7 +630,8 @@ textarea {
<a href="#async-functions" class="nav-link" data-action="sidebar-nav">Async Functions</a>
<a href="#classes" class="nav-link" data-action="sidebar-nav">Classes</a>
<a href="#prototypal-inheritance" class="nav-link" data-action="sidebar-nav">Prototypal Inheritance</a>
<a href="#switch" class="nav-link" data-action="sidebar-nav">Switch and Try/Catch</a>
<a href="#switch" class="nav-link" data-action="sidebar-nav">Switch/When/Else</a>
<a href="#try-catch" class="nav-link" data-action="sidebar-nav">Try/Catch/Finally</a>
<a href="#comparisons" class="nav-link" data-action="sidebar-nav">Chained Comparisons</a>
<a href="#regexes" class="nav-link" data-action="sidebar-nav">Block Regular Expressions</a>
<a href="#tagged-template-literals" class="nav-link" data-action="sidebar-nav">Tagged Template Literals</a>
@ -1083,7 +1084,7 @@ coffee --compile --transpile --inline-map some-file.coffee
<h2>Language Reference</h2>
<p><em>This reference is structured so that it can be read from top to bottom, if you like. Later sections use ideas and syntax previously introduced. Familiarity with JavaScript is assumed. In all of the following examples, the source CoffeeScript is provided on the left, and the direct compilation into JavaScript is on the right.</em></p>
<p><em>Many of the examples can be run (where it makes sense) by pressing the</em> <small></small> <em>button on the right. The CoffeeScript on the left is editable, and the JavaScript will update as you edit.</em></p>
<p>First, the basics: CoffeeScript uses significant whitespace to delimit blocks of code. You dont need to use semicolons <code>;</code> to terminate expressions, ending the line will do just as well (although semicolons can still be used to fit multiple expressions onto a single line). Instead of using curly braces <code>{ }</code> to surround blocks of code in <a href="#literals">functions</a>, <a href="#conditionals">if-statements</a>, <a href="#switch">switch</a>, and <a href="#try">try/catch</a>, use indentation.</p>
<p>First, the basics: CoffeeScript uses significant whitespace to delimit blocks of code. You dont need to use semicolons <code>;</code> to terminate expressions, ending the line will do just as well (although semicolons can still be used to fit multiple expressions onto a single line). Instead of using curly braces <code>{ }</code> to surround blocks of code in <a href="#literals">functions</a>, <a href="#conditionals">if-statements</a>, <a href="#switch">switch</a>, and <a href="#try-catch">try/catch</a>, use indentation.</p>
<p>You dont need to use parentheses to invoke a function if youre passing arguments. The implicit call wraps forward to the end of the line or block expression.<br>
<code>console.log sys.inspect object</code><code>console.log(sys.inspect(object));</code></p>
@ -4035,7 +4036,7 @@ grade = (function() {
</aside>
</section>
<section id="try">
<section id="try-catch">
<h2>Try/Catch/Finally</h2>
<p><code>try</code> expressions have the same semantics as <code>try</code> statements in JavaScript, though in CoffeeScript, you may omit <em>both</em> the catch and finally parts. The catch part may also omit the error parameter if it is not needed.</p>
<aside class="code-example container-fluid bg-ribbed-dark" data-example="try">

View File

@ -4,7 +4,7 @@ _This reference is structured so that it can be read from top to bottom, if you
_Many of the examples can be run (where it makes sense) by pressing the_ <small></small> _button on the right. The CoffeeScript on the left is editable, and the JavaScript will update as you edit._
First, the basics: CoffeeScript uses significant whitespace to delimit blocks of code. You dont need to use semicolons `;` to terminate expressions, ending the line will do just as well (although semicolons can still be used to fit multiple expressions onto a single line). Instead of using curly braces `{ }` to surround blocks of code in [functions](#literals), [if-statements](#conditionals), [switch](#switch), and [try/catch](#try), use indentation.
First, the basics: CoffeeScript uses significant whitespace to delimit blocks of code. You dont need to use semicolons `;` to terminate expressions, ending the line will do just as well (although semicolons can still be used to fit multiple expressions onto a single line). Instead of using curly braces `{ }` to surround blocks of code in [functions](#literals), [if-statements](#conditionals), [switch](#switch), and [try/catch](#try-catch), use indentation.
You dont need to use parentheses to invoke a function if youre passing arguments. The implicit call wraps forward to the end of the line or block expression.<br>
`console.log sys.inspect object``console.log(sys.inspect(object));`

View File

@ -105,7 +105,7 @@
<section id="switch">
<%= htmlFor('switch') %>
</section>
<section id="try">
<section id="try-catch">
<%= htmlFor('try') %>
</section>
<section id="comparisons">

View File

@ -36,7 +36,8 @@
<a href="#async-functions" class="nav-link" data-action="sidebar-nav">Async Functions</a>
<a href="#classes" class="nav-link" data-action="sidebar-nav">Classes</a>
<a href="#prototypal-inheritance" class="nav-link" data-action="sidebar-nav">Prototypal Inheritance</a>
<a href="#switch" class="nav-link" data-action="sidebar-nav">Switch and Try/Catch</a>
<a href="#switch" class="nav-link" data-action="sidebar-nav">Switch/When/Else</a>
<a href="#try-catch" class="nav-link" data-action="sidebar-nav">Try/Catch/Finally</a>
<a href="#comparisons" class="nav-link" data-action="sidebar-nav">Chained Comparisons</a>
<a href="#regexes" class="nav-link" data-action="sidebar-nav">Block Regular Expressions</a>
<a href="#tagged-template-literals" class="nav-link" data-action="sidebar-nav">Tagged Template Literals</a>