From 82766ab3737a9c0b24f4999133790c3dbbb1d00d Mon Sep 17 00:00:00 2001 From: Maxime Mangel Date: Mon, 16 Dec 2024 11:10:02 +0100 Subject: [PATCH] fix: support `@deprecated` with a multiline comment [converter] Fix #176 --- src/Glutinum.Converter/Printer.fs | 6 ++++- .../documentation/deprecated/multiLine.d.ts | 12 ++++++++++ .../documentation/deprecated/multiLine.fsx | 24 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tests/specs/references/documentation/deprecated/multiLine.d.ts create mode 100644 tests/specs/references/documentation/deprecated/multiLine.fsx diff --git a/src/Glutinum.Converter/Printer.fs b/src/Glutinum.Converter/Printer.fs index 89b79cc..765d309 100644 --- a/src/Glutinum.Converter/Printer.fs +++ b/src/Glutinum.Converter/Printer.fs @@ -101,7 +101,11 @@ let private attributeToText (fsharpAttribute: FSharpAttribute) = | FSharpAttribute.Interface -> "[]" | FSharpAttribute.Obsolete message -> match message with - | Some message -> $"[]" + | Some message -> + if message.Contains("\n") then + $"[]" + else + $"[]" | None -> "[]" | FSharpAttribute.AbstractClass -> "[]" | FSharpAttribute.EmitMacroInvoke methodName -> $"[]" diff --git a/tests/specs/references/documentation/deprecated/multiLine.d.ts b/tests/specs/references/documentation/deprecated/multiLine.d.ts new file mode 100644 index 0000000..695dbb9 --- /dev/null +++ b/tests/specs/references/documentation/deprecated/multiLine.d.ts @@ -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; diff --git a/tests/specs/references/documentation/deprecated/multiLine.fsx b/tests/specs/references/documentation/deprecated/multiLine.fsx new file mode 100644 index 0000000..b50b8ba --- /dev/null +++ b/tests/specs/references/documentation/deprecated/multiLine.fsx @@ -0,0 +1,24 @@ +module rec Glutinum + +open Fable.Core +open Fable.Core.JsInterop +open System + +[] +[] +type Exports = + [] + static member isInlineTag (tagName: string) : bool = nativeOnly + +(***) +#r "nuget: Fable.Core" +#r "nuget: Glutinum.Types" +(***)