Skip to content

Commit

Permalink
Fix invalid HTML comments
Browse files Browse the repository at this point in the history
The line "---" indicated to the pre-DocC build system's code testing
infrastructure that the code listing contains a blank line at that
point.  However, two hyphens in a row is invalid inside of an HTML
<!-- --> style comment.

Changed to blank lines because that was another way to spell the same
thing in the old test system (although it might have been fragile, and
was less used), but more importantly we're unlikely to use the old test
system again.  These test expectation lines were preserved during the
export to assist writing new expectation markup in some future testing
system.

Bulk edit via:

    sed -i'' -e 's/^ *--- *$//' TSPL.docc/*/*.md

Confirmed no change to the Render JSON from DocC.
  • Loading branch information
amartini51 committed Sep 27, 2024
1 parent 8f7c1b7 commit 17b204b
Show file tree
Hide file tree
Showing 32 changed files with 288 additions and 288 deletions.
38 changes: 19 additions & 19 deletions TSPL.docc/GuidedTour/GuidedTour.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ occupations["Jayne"] = "Public Relations"
```swifttest
-> var fruits = ["strawberries", "limes", "tangerines"]
-> fruits[1] = "grapes"
---
-> var occupations = [
"Malcolm": "Captain",
"Kaylee": "Mechanic",
Expand Down Expand Up @@ -317,7 +317,7 @@ let emptyDictionary: [String: Float] = [:]
```swifttest
-> let emptyArray: [String] = []
-> let emptyDictionary: [String: Float] = [:]
---
-> let anotherEmptyArray = [String]()
-> let emptyDictionary = [String: Float]()
```
Expand Down Expand Up @@ -432,7 +432,7 @@ if let name = optionalName {
-> var optionalString: String? = "Hello"
-> print(optionalString == nil)
<- false
---
-> var optionalName: String? = "John Appleseed"
-> var greeting = "Hello!"
-> if let name = optionalName {
Expand Down Expand Up @@ -658,7 +658,7 @@ print(m)
}
-> print(n)
<- 128
---
-> var m = 2
-> repeat {
m *= 2
Expand Down Expand Up @@ -1132,11 +1132,11 @@ class NamedShape {
-> class NamedShape {
var numberOfSides: Int = 0
var name: String
---
init(name: String) {
self.name = name
}
---
func simpleDescription() -> String {
return "A shape with \(numberOfSides) sides."
}
Expand Down Expand Up @@ -1202,17 +1202,17 @@ test.simpleDescription()
```swifttest
-> class Square: NamedShape {
var sideLength: Double
---
init(sideLength: Double, name: String) {
self.sideLength = sideLength
super.init(name: name)
numberOfSides = 4
}
---
func area() -> Double {
return sideLength * sideLength
}
---
override func simpleDescription() -> String {
return "A square with sides of length \(sideLength)."
}
Expand Down Expand Up @@ -1276,13 +1276,13 @@ print(triangle.sideLength)
```swifttest
-> class EquilateralTriangle: NamedShape {
var sideLength: Double = 0.0
---
init(sideLength: Double, name: String) {
self.sideLength = sideLength
super.init(name: name)
numberOfSides = 3
}
---
var perimeter: Double {
get {
return 3.0 * sideLength
Expand All @@ -1291,7 +1291,7 @@ print(triangle.sideLength)
sideLength = newValue / 3.0
}
}
---
override func simpleDescription() -> String {
return "An equilateral triangle with sides of length \(sideLength)."
}
Expand Down Expand Up @@ -1471,7 +1471,7 @@ let aceRawValue = ace.rawValue
case ace = 1
case two, three, four, five, six, seven, eight, nine, ten
case jack, queen, king
---
func simpleDescription() -> String {
switch self {
case .ace:
Expand Down Expand Up @@ -1562,7 +1562,7 @@ let heartsDescription = hearts.simpleDescription()
```swifttest
-> enum Suit {
case spades, hearts, diamonds, clubs
---
func simpleDescription() -> String {
switch self {
case .spades:
Expand Down Expand Up @@ -1679,10 +1679,10 @@ case let .failure(message):
case result(String, String)
case failure(String)
}
---
-> let success = ServerResponse.result("6:00 am", "8:09 pm")
-> let failure = ServerResponse.failure("Out of cheese.")
---
-> switch success {
case let .result(sunrise, sunset):
print("Sunrise is at \(sunrise) and sunset is at \(sunset).")
Expand Down Expand Up @@ -1982,7 +1982,7 @@ let bDescription = b.simpleDescription
-> let aDescription = a.simpleDescription
>> print(aDescription)
<< A very simple class. Now 100% adjusted.
---
-> struct SimpleStructure: ExampleProtocol {
var simpleDescription: String = "A simple structure"
mutating func adjust() {
Expand Down Expand Up @@ -2309,13 +2309,13 @@ print(fridgeIsOpen)
```swifttest
-> var fridgeIsOpen = false
-> let fridgeContent = ["milk", "eggs", "leftovers"]
---
-> func fridgeContains(_ food: String) -> Bool {
fridgeIsOpen = true
defer {
fridgeIsOpen = false
}
---
let result = fridgeContent.contains(food)
return result
}
Expand Down
40 changes: 20 additions & 20 deletions TSPL.docc/LanguageGuide/AccessControl.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private func somePrivateFunction() {}
-> internal class SomeInternalClass {}
-> fileprivate class SomeFilePrivateClass {}
-> private class SomePrivateClass {}
---
-> open var someOpenVariable = 0
-> public var somePublicVariable = 0
-> internal let someInternalConstant = 0
Expand Down Expand Up @@ -284,18 +284,18 @@ private class SomePrivateClass { // explicitly private class
fileprivate func someFilePrivateMethod() {} // explicitly file-private class member
private func somePrivateMethod() {} // explicitly private class member
}
---
-> class SomeInternalClass { // implicitly internal class
var someInternalProperty = 0 // implicitly internal class member
fileprivate func someFilePrivateMethod() {} // explicitly file-private class member
private func somePrivateMethod() {} // explicitly private class member
}
---
-> fileprivate class SomeFilePrivateClass { // explicitly file-private class
func someFilePrivateMethod() {} // implicitly file-private class member
private func somePrivateMethod() {} // explicitly private class member
}
---
-> private class SomePrivateClass { // explicitly private class
func somePrivateMethod() {} // implicitly private class member
}
Expand Down Expand Up @@ -557,7 +557,7 @@ you must explicitly declare the nested type as public.
-> let publicNestedInsidePublic = PublicStruct.PublicEnumInsidePublicStruct.a
-> let internalNestedInsidePublic = PublicStruct.InternalEnumInsidePublicStruct.a
-> let automaticNestedInsidePublic = PublicStruct.AutomaticEnumInsidePublicStruct.a
---
-> let internalNestedInsideInternal = InternalStruct.InternalEnumInsideInternalStruct.a
-> let automaticNestedInsideInternal = InternalStruct.AutomaticEnumInsideInternalStruct.a
```
Expand All @@ -569,12 +569,12 @@ you must explicitly declare the nested type as public.
```swifttest
// these are all expected to fail, because they're private to the other file
-> let privateNestedInsidePublic = PublicStruct.PrivateEnumInsidePublicStruct.a
---
-> let privateNestedInsideInternal = InternalStruct.PrivateEnumInsideInternalStruct.a
---
-> let privateNestedInsidePrivate = PrivateStruct.PrivateEnumInsidePrivateStruct.a
-> let automaticNestedInsidePrivate = PrivateStruct.AutomaticEnumInsidePrivateStruct.a
---
!$ error: 'PrivateEnumInsidePublicStruct' is inaccessible due to 'private' protection level
!! let privateNestedInsidePublic = PublicStruct.PrivateEnumInsidePublicStruct.a
!! ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -615,14 +615,14 @@ you must explicitly declare the nested type as public.
-> let internalNestedInsidePublic = PublicStruct.InternalEnumInsidePublicStruct.a
-> let automaticNestedInsidePublic = PublicStruct.AutomaticEnumInsidePublicStruct.a
-> let privateNestedInsidePublic = PublicStruct.PrivateEnumInsidePublicStruct.a
---
-> let internalNestedInsideInternal = InternalStruct.InternalEnumInsideInternalStruct.a
-> let automaticNestedInsideInternal = InternalStruct.AutomaticEnumInsideInternalStruct.a
-> let privateNestedInsideInternal = InternalStruct.PrivateEnumInsideInternalStruct.a
---
-> let privateNestedInsidePrivate = PrivateStruct.PrivateEnumInsidePrivateStruct.a
-> let automaticNestedInsidePrivate = PrivateStruct.AutomaticEnumInsidePrivateStruct.a
---
!$ error: 'InternalEnumInsidePublicStruct' is inaccessible due to 'internal' protection level
!! let internalNestedInsidePublic = PublicStruct.InternalEnumInsidePublicStruct.a
!! ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -701,7 +701,7 @@ internal class B: A {
-> public class A {
fileprivate func someMethod() {}
}
---
-> internal class B: A {
override internal func someMethod() {}
}
Expand Down Expand Up @@ -734,7 +734,7 @@ internal class B: A {
-> public class A {
fileprivate func someMethod() {}
}
---
-> internal class B: A {
override internal func someMethod() {
super.someMethod()
Expand Down Expand Up @@ -1162,7 +1162,7 @@ on any type that adopts the protocol.
var publicProperty = 0
func publicMethod() {}
}
---
-> public class PublicClassConformingToInternalProtocol: InternalProtocol {
var internalProperty = 0
func internalMethod() {}
Expand Down Expand Up @@ -1190,7 +1190,7 @@ on any type that adopts the protocol.
!$ error: cannot find type 'FilePrivateProtocol' in scope
!! public class PublicClassConformingToFilePrivateProtocol: FilePrivateProtocol {
!! ^~~~~~~~~~~~~~~~~~~
---
// these will fail, because PrivateProtocol isn't visible outside of its file
-> public class PublicClassConformingToPrivateProtocol: PrivateProtocol {
var privateProperty = 0
Expand Down Expand Up @@ -1440,7 +1440,7 @@ extension SomeStruct: SomeProtocol {
-> struct SomeStruct {
private var privateVariable = 12
}
---
-> extension SomeStruct: SomeProtocol {
func doSomething() {
print(privateVariable)
Expand Down Expand Up @@ -1474,19 +1474,19 @@ but a public type alias can't alias an internal, file-private, or private type.
-> public struct PublicStruct {}
-> internal struct InternalStruct {}
-> private struct PrivateStruct {}
---
-> public typealias PublicAliasOfPublicType = PublicStruct
-> internal typealias InternalAliasOfPublicType = PublicStruct
-> private typealias PrivateAliasOfPublicType = PublicStruct
---
-> public typealias PublicAliasOfInternalType = InternalStruct // not allowed
-> internal typealias InternalAliasOfInternalType = InternalStruct
-> private typealias PrivateAliasOfInternalType = InternalStruct
---
-> public typealias PublicAliasOfPrivateType = PrivateStruct // not allowed
-> internal typealias InternalAliasOfPrivateType = PrivateStruct // not allowed
-> private typealias PrivateAliasOfPrivateType = PrivateStruct
---
!$ error: type alias cannot be declared public because its underlying type uses an internal type
!! public typealias PublicAliasOfInternalType = InternalStruct // not allowed
!! ^ ~~~~~~~~~~~~~~
Expand Down
10 changes: 5 additions & 5 deletions TSPL.docc/LanguageGuide/AdvancedOperators.md
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ extension Vector2D {
-> struct Vector2D {
var x = 0.0, y = 0.0
}
---
-> extension Vector2D {
static func + (left: Vector2D, right: Vector2D) -> Vector2D {
return Vector2D(x: left.x + right.x, y: left.y + right.y)
Expand Down Expand Up @@ -1028,7 +1028,7 @@ let afterDoubling = +++toBeDoubled
return vector
}
}
---
-> var toBeDoubled = Vector2D(x: 1.0, y: 4.0)
-> let afterDoubling = +++toBeDoubled
/> toBeDoubled now has values of (\(toBeDoubled.x), \(toBeDoubled.y))
Expand Down Expand Up @@ -1349,7 +1349,7 @@ print(personalGreeting.draw())
-> func caps(@DrawingBuilder content: () -> Drawable) -> Drawable {
return AllCaps(content: content())
}
---
-> func makeGreeting(for name: String? = nil) -> Drawable {
let greeting = draw {
Stars(length: 3)
Expand All @@ -1369,7 +1369,7 @@ print(personalGreeting.draw())
-> let genericGreeting = makeGreeting()
-> print(genericGreeting.draw())
<- ***Hello WORLD!**
---
-> let personalGreeting = makeGreeting(for: "Ravi Patel")
-> print(personalGreeting.draw())
<- ***Hello RAVI PATEL!**
Expand Down Expand Up @@ -1539,7 +1539,7 @@ see <doc:Attributes#resultBuilder>.
// static func * (scale: Double, vector: Self) -> Self
static func *** (scale: Double, vector: Vector2D) -> Vector2D
}
---
-> extension Double {
static func *** (scale: Double, vector: Vector2D) -> Vector2D {
return Vector2D(x: scale * vector.x, y: scale * vector.y)
Expand Down
Loading

0 comments on commit 17b204b

Please sign in to comment.