Skip to content

Commit

Permalink
bf beautifier with url
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelachaux committed Nov 22, 2024
1 parent ed5d80a commit f584989
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 26 deletions.
Binary file modified Build/4DPop-Macros.zip
Binary file not shown.
Binary file modified Build/Components/4DPop Macros.4dbase/Contents/4DPop Macros.4DZ
Binary file not shown.
4 changes: 2 additions & 2 deletions Build/Components/4DPop Macros.4dbase/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<key>CFBundleName</key>
<string>4DPop Macros</string>
<key>CFBundleVersion</key>
<string>296</string>
<string>297</string>
<key>NSHumanReadableCopyright</key>
<string>©vdl 2009-2024</string>
<key>CFBundleGetInfoString</key>
<string>20R8</string>
<key>CFBundleLongVersionString</key>
<string>20R8 (295)</string>
<string>20R8 (296)</string>
<key>CFBundleShortVersionString</key>
<string>20R8</string>
<key>CFBundleDisplayName</key>
Expand Down
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<key>CFBundleName</key>
<string>4DPop Macros</string>
<key>CFBundleVersion</key>
<string>296</string>
<string>297</string>
<key>NSHumanReadableCopyright</key>
<string>©vdl 2009-2024</string>
<key>CFBundleGetInfoString</key>
<string>20R8</string>
<key>CFBundleLongVersionString</key>
<string>20R8 (295)</string>
<string>20R8 (296)</string>
<key>CFBundleShortVersionString</key>
<string>20R8</string>
<key>CFBundleDisplayName</key>
Expand Down
25 changes: 19 additions & 6 deletions Project/Sources/Classes/beautifier.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,9 @@ Function after() : Text
// === === === === === === === === === === === === === === === === === === === === === === === === === ===
Function formatComment($line : Text) : Text

ARRAY LONGINT:C221($pos; 0x0000)
ARRAY LONGINT:C221($len; 0x0000)

var $start : Integer:=Position:C15(kCommentMark; $line)

If ($start=0)
Expand All @@ -600,19 +603,29 @@ Function formatComment($line : Text) : Text
$line:=Replace string:C233($line; "todo:"; "TODO:")
$line:=Replace string:C233($line; "fixme:"; "FIXME:")

var $code : Text:=Substring:C12($line; 1; $start-1)
var $comment : Text:=Delete string:C232($line; 1; $start-1+Length:C16(kCommentMark))
var $code; $comment : Text

// Caution with urls or addresses such as “https://...", "file:///...”
If (Match regex:C1019("(?mi-s)(.*?\".*?:/+.*?\")(?:\\s*//(.*?))?$"; $line; 1; $pos; $len))

$code:=Substring:C12($line; $pos{1}; $len{1})
$comment:=Substring:C12($line; $pos{2}; $len{2})

Else

$code:=Substring:C12($line; 1; $start-1)
$comment:=Delete string:C232($line; 1; $start-1+Length:C16(kCommentMark))

End if

var $c : Collection:=Split string:C1554($comment; " "; sk ignore empty strings:K86:1+sk trim spaces:K86:2)

If ($c.length=0)

return kCommentMark
return $line

End if

ARRAY LONGINT:C221($pos; 0x0000)
ARRAY LONGINT:C221($len; 0x0000)

Case of

// ______________________________________________________
Expand Down
9 changes: 9 additions & 0 deletions Project/Sources/Methods/BEAUTIFIER_TEST.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ If (True:C214)








//mark:TEXTS CONTAINING “//” AS A URL SHOULD NOT BE AFFECTED
var $path : Text:="file:///test/test" // Comment
var $url : Text:="https://4d.com"

var $v

$v:=""
Expand Down
19 changes: 3 additions & 16 deletions Project/Sources/Methods/Method122.4dm
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
//%attributes = {"invisible":true,"preemptive":"capable"}
//%W-550.4
//%W-550.2
var $xmlStructure : Text
var $structure : Object
//var $svg : cs.svg
//var $xml : cs.xml
var $path; $url : Text

EXPORT STRUCTURE:C1311($xmlStructure)
//$xml:=cs.xml.new($xmlStructure)

//$structure:=$xml.toObject()

//$svg:=cs.svg.new()

//$xml.close()
//%W+550.2
//%W+550.4
$path:="file:///test/test" // Comment
$url:="htpps://4d.com"
Binary file modified Resources/InfoPlist.strings
Binary file not shown.

0 comments on commit f584989

Please sign in to comment.