Write(formatted) statement for user type

I use a simple user type

type vector
    integer :: size
    real(real64), allocatable :: data(:)
contains    
    procedure :: write_vector
    generic :: write(formatted) => write_vector
end type vector

and a custom formatted write procedure

subroutine write_vector(v, unit, iotype, v_list, iostat, iomsg)
class(vector), intent(in) :: v
integer, intent(in) :: unit
character(*), intent(in) :: iotype
integer, intent(in) :: v_list(:)
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
!** write formatted array v%data
if( iotype(1:2)=='DT' ) then
    !** Use specific formatting
else
    !** Use default formatting
end if

end subroutine

I want to be able to pass a format specifier to the write sub such that

type(vector) :: v
v = vector(3, [1d0,1/2d0,1/3d0])
write (*, '(a,DT(g0.5))') "v=", v

But the above does not work because iotype is only 'DT' and the remaining format spec is stripped, Additionally, v_list is an undefined pointer array always, even if I specify DT(1,2) as the format specifier for example.

In summary, how do I write a user defined type write subroutine that I can pass a format specifier to?

From the Fortran Standard

NOTE 1
For the edit descriptor DT’Link List’(10, 4, 2), iotype is “DTLink List” and v_list is [10, 4, 2].

That did the trick. For example:

write (*,"(a,DT'g0.5')") "v=", v
! v=[8.5000,-.50000,2.9412,-3.8462]

and my implementation of the write function

subroutine write_vector(v, unit, iotype, v_list, iostat, iomsg)
class(vector), intent(in) :: v
integer, intent(in) :: unit
character(*), intent(in) :: iotype
integer, intent(in) :: v_list(:)
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
integer :: i, n
character(LEN=32) :: fmt, item

if( iotype(1:2)=='DT' ) then
    fmt = iotype(3:)     ! specific format
else
    fmt = "g0.4"    ! default format
end if
if (allocated(v%data)) then
    n = size(v%data)
    write (unit, '(a)',iostat=iostat, iomsg=iomsg) '['
    do i = 1, n            
        write (item, "("//trim(fmt)//")", iostat=iostat, iomsg=iomsg)  &
            v%data(i)
        write(unit,*) trim(item)
        if (iostat /= 0) return
        if( i<n ) then
            write (unit, '(a)') ','
        end if
    end do
    write (unit, '(a)', iostat=iostat, iomsg=iomsg) ']'
else
    write (unit, "(l1,/)", iostat=iostat, iomsg=iomsg) .false.
end if
end subroutine 

which I am sure has loads of bugs.