Skip to content

Commit

Permalink
fix: support @deprecated with a multiline comment
Browse files Browse the repository at this point in the history
[converter]

Fix #176
  • Loading branch information
MangelMaxime committed Dec 16, 2024
1 parent a3caad2 commit 82766ab
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Glutinum.Converter/Printer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ let private attributeToText (fsharpAttribute: FSharpAttribute) =
| FSharpAttribute.Interface -> "[<Interface>]"
| FSharpAttribute.Obsolete message ->
match message with
| Some message -> $"[<Obsolete(\"%s{message}\")>]"
| Some message ->
if message.Contains("\n") then
$"[<Obsolete(\"\"\"%s{message}\"\"\")>]"
else
$"[<Obsolete(\"%s{message}\")>]"
| None -> "[<Obsolete>]"
| FSharpAttribute.AbstractClass -> "[<AbstractClass>]"
| FSharpAttribute.EmitMacroInvoke methodName -> $"[<Emit(\"$0.{methodName}($1...)\")>]"
Expand Down
12 changes: 12 additions & 0 deletions tests/specs/references/documentation/deprecated/multiLine.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @deprecated use `isInlineTag`
* Schedules the localNotification for immediate presentation.
* details is an object containing:
* alertBody : The message displayed in the notification alert.
* alertAction : The "action" displayed beneath an actionable notification. Defaults to "view";
* soundName : The sound played when the notification is fired (optional). The file should be added in the ios project from Xcode, on your target, so that it is bundled in the final app. For more details see the example app.
* category : The category of this notification, required for actionable notifications (optional).
* userInfo : An optional object containing additional notification data.
* applicationIconBadgeNumber (optional) : The number to display as the app's icon badge. The default value of this property is 0, which means that no badge is displayed.
*/
declare function isInlineTag(tagName: string): boolean;
24 changes: 24 additions & 0 deletions tests/specs/references/documentation/deprecated/multiLine.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module rec Glutinum

open Fable.Core
open Fable.Core.JsInterop
open System

[<AbstractClass>]
[<Erase>]
type Exports =
[<Import("isInlineTag", "REPLACE_ME_WITH_MODULE_NAME"); Obsolete("""use `isInlineTag`
Schedules the localNotification for immediate presentation.
details is an object containing:
alertBody : The message displayed in the notification alert.
alertAction : The "action" displayed beneath an actionable notification. Defaults to "view";
soundName : The sound played when the notification is fired (optional). The file should be added in the ios project from Xcode, on your target, so that it is bundled in the final app. For more details see the example app.
category : The category of this notification, required for actionable notifications (optional).
userInfo : An optional object containing additional notification data.
applicationIconBadgeNumber (optional) : The number to display as the app's icon badge. The default value of this property is 0, which means that no badge is displayed.""")>]
static member isInlineTag (tagName: string) : bool = nativeOnly

(***)
#r "nuget: Fable.Core"
#r "nuget: Glutinum.Types"
(***)

0 comments on commit 82766ab

Please sign in to comment.