@@ -59,24 +59,76 @@ function main (ids) {
5959 div . className = 'shelfmark center small'
6060 }
6161 div . id = id
62- let text = shelfmark . txt
6362 if ( objct . short && length == 1 ) {
64- text = shelfmark . txt [ 0 ]
65- let textSplit = text . split ( ' ' )
66- let countSpaces = textSplit . length
63+ let text = shelfmark . txt [ 0 ]
64+ let indxSlash = text . indexOf ( '/' )
65+ let indxColon = text . indexOf ( ':' )
66+ shelfmark . txt = [ ]
67+ shelfmark . txt [ 0 ] = text
6768 let i = 0
68- let j = 0
69- text = [ ]
70- while ( countSpaces >= 2 ) {
71- text [ j ] = textSplit [ i ] + ' ' + textSplit [ i + 1 ]
72- countSpaces -= 2
73- i += 2
74- j ++
69+ if ( indxSlash !== - 1 ) {
70+ shelfmark . txt [ 0 ] = text . substring ( 0 , indxSlash + 1 )
71+ shelfmark . txt [ 1 ] = text . substring ( indxSlash + 1 )
72+ i = 1
7573 }
76- if ( countSpaces == 1 ) {
77- text [ j ] = textSplit [ i ]
74+ if ( indxColon !== - 1 ) {
75+ if ( i === 0 ) {
76+ shelfmark . txt [ 0 ] = text . substring ( 0 , indxColon + 1 )
77+ shelfmark . txt [ 1 ] = text . substring ( indxColon + 1 )
78+ i = 1
79+ } else {
80+ let i = 0
81+ let txt = [ ]
82+ let length = shelfmark . txt . length
83+ shelfmark . txt . forEach ( element => {
84+ let indx = element . indexOf ( ':' )
85+ if ( indx !== - 1 ) {
86+ let j = 0
87+ while ( j < i ) {
88+ txt [ j ] = shelfmark . txt [ j ]
89+ j ++
90+ }
91+ let k = i
92+ txt [ k ] = element . substring ( 0 , indx )
93+ k ++
94+ txt [ k ] = element . substring ( indx )
95+ k ++
96+ while ( k <= length ) {
97+ txt [ k ] = shelfmark . txt [ k - 1 ]
98+ k ++
99+ }
100+ shelfmark . txt = txt
101+ }
102+ i ++
103+ } )
104+ }
78105 }
106+ i = 0
107+ let txt = [ ]
108+ let length = shelfmark . txt . length
109+ shelfmark . txt . forEach ( element => {
110+ let elementParts = element . split ( ' ' )
111+ if ( elementParts . length >= 3 ) {
112+ let j = 0
113+ while ( j < i ) {
114+ txt [ j ] = shelfmark . txt [ j ]
115+ j ++
116+ }
117+ let k = i
118+ txt [ k ] = elementParts [ 0 ] + ' ' + elementParts [ 1 ]
119+ k ++
120+ txt [ k ] = element . substring ( txt [ k - 1 ] . length )
121+ k ++
122+ while ( k <= length ) {
123+ txt [ k ] = shelfmark . txt [ k - 1 ]
124+ k ++
125+ }
126+ shelfmark . txt = txt
127+ }
128+ i ++
129+ } )
79130 }
131+ let text = shelfmark . txt
80132 let lineCount = shelfmark . txt . length
81133 text . forEach ( element => {
82134 if ( ( lineCount === 1 ) && ( text . length === 1 ) ) {
0 commit comments