Commit ebe058c 1 parent 66c81dd commit ebe058c Copy full SHA for ebe058c
File tree 3 files changed +79
-15
lines changed
3 files changed +79
-15
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
5
5
## [ Unreleased]
6
6
7
7
- [ Issue #184 ] - fix bug with tagged literals in ` ns ` metadata ([ PR-185] )
8
+ - [ Issue #183 ] - fix bug with quoted values other than maps, lists etc. in ` ns ` metadata ([ PR-186] )
8
9
9
10
## [ 0.21.0] - 2025-02-26
10
11
@@ -240,6 +241,7 @@ All notable changes to this project will be documented in this file.
240
241
[ Issue #166 ] :https://github.com/oakmac/standard-clojure-style-js/issues/166
241
242
[ Issue #178 ] :https://github.com/oakmac/standard-clojure-style-js/issues/178
242
243
[ Issue #181 ] :https://github.com/oakmac/standard-clojure-style-js/issues/181
244
+ [ Issue #183 ] :https://github.com/oakmac/standard-clojure-style-js/issues/183
243
245
[ Issue #184 ] :https://github.com/oakmac/standard-clojure-style-js/issues/184
244
246
245
247
[ commit #db857ff4 ] :https://github.com/oakmac/standard-clojure-style-js/commit/db857ff413f0a8625c0cd0c975684244d875705e
@@ -289,3 +291,4 @@ All notable changes to this project will be documented in this file.
289
291
[ PR-179 ] :https://github.com/oakmac/standard-clojure-style-js/pull/179
290
292
[ PR-182 ] :https://github.com/oakmac/standard-clojure-style-js/pull/182
291
293
[ PR-185 ] :https://github.com/oakmac/standard-clojure-style-js/pull/185
294
+ [ PR-186 ] :https://github.com/oakmac/standard-clojure-style-js/pull/186
Original file line number Diff line number Diff line change 818
818
return n && n . name === '.close' && ( n . text === ')' || n . text === ']' || n . text === '}' )
819
819
}
820
820
821
- function isWrap ( n ) {
822
- return n && n . name === 'wrap'
823
- }
824
-
825
821
function isTokenNode ( n ) {
826
822
return n . name === 'token'
827
823
}
1849
1845
metadataValueNodeId = - 1
1850
1846
1851
1847
// skip any forward nodes that we have just collected as text
1852
- let unwrappedNode
1853
- if ( isWrap ( node ) ) {
1854
- const wrapBody = arrayLast ( node . children )
1855
- unwrappedNode = arrayLast ( wrapBody . children )
1856
- } else {
1857
- unwrappedNode = node
1858
- }
1859
-
1860
- if ( isArray ( unwrappedNode . children ) ) {
1861
- const lastChildNode = arrayLast ( unwrappedNode . children )
1862
- skipNodesUntilWeReachThisId = lastChildNode . id
1848
+ let skipCandidate = node
1849
+ while ( skipCandidate ) {
1850
+ if ( isArray ( skipCandidate . children ) ) {
1851
+ skipCandidate = arrayLast ( skipCandidate . children )
1852
+ skipNodesUntilWeReachThisId = skipCandidate . id
1853
+ } else {
1854
+ skipCandidate = null
1855
+ }
1863
1856
}
1864
1857
}
1865
1858
Original file line number Diff line number Diff line change 3109
3109
]
3110
3110
}
3111
3111
--Expected
3112
+
3113
+ # GitHub Issue #183 - handle all types of quoted ns metadata hash map values
3114
+
3115
+ > https://github.com/oakmac/standard-clojure-style-js/issues/183
3116
+
3117
+ --Input
3118
+ (ns my.namespace
3119
+ {:token 'token
3120
+ :string '"string"
3121
+ :parens '(parens)
3122
+ :brackets '[brackets]
3123
+ :braces '{:braces true}
3124
+ :wrap ''wrap
3125
+ :deep-wrap ''''''wrap
3126
+ :meta '^:meta [1 2 3]
3127
+ :tagged ' #tag [1 2 3]}
3128
+ (:require [clojure.string :as str]))
3129
+ --Input
3130
+
3131
+ --Expected
3132
+ {
3133
+ "nsSymbol": "my.namespace",
3134
+ "nsMetadata": [
3135
+ {
3136
+ "key": ":token",
3137
+ "value": "'token"
3138
+ },
3139
+ {
3140
+ "key": ":string",
3141
+ "value": "'\"string\""
3142
+ },
3143
+ {
3144
+ "key": ":parens",
3145
+ "value": "'(parens)"
3146
+ },
3147
+ {
3148
+ "key": ":brackets",
3149
+ "value": "'[brackets]"
3150
+ },
3151
+ {
3152
+ "key": ":braces",
3153
+ "value": "'{:braces true}"
3154
+ },
3155
+ {
3156
+ "key": ":wrap",
3157
+ "value": "''wrap"
3158
+ },
3159
+ {
3160
+ "key": ":deep-wrap",
3161
+ "value": "''''''wrap"
3162
+ },
3163
+ {
3164
+ "key": ":meta",
3165
+ "value": "'^:meta [1 2 3]"
3166
+ },
3167
+ {
3168
+ "key": ":tagged",
3169
+ "value": "' #tag [1 2 3]"
3170
+ }
3171
+ ],
3172
+ "requires": [
3173
+ {
3174
+ "symbol": "clojure.string",
3175
+ "as": "str"
3176
+ }
3177
+ ]
3178
+ }
3179
+ --Expected
You can’t perform that action at this time.
0 commit comments