fortran-lang / fprettify

auto-formatter for modern fortran source code
https://pypi.python.org/pypi/fprettify
Other
370 stars 76 forks source link

Indent FORD comments #119

Open tueda opened 2 years ago

tueda commented 2 years ago

It seems that fprettify 0.3.7 does not indent FORD comments starting with !!.

module foods
implicit none
#:for i in [1, 2, 3]
#:for j in [1, 2, 3]
subroutine feed_pets_${i}$${j}$ (cats, dogs, food, angry)
!! Feeds your cats and dogs, if enough food is available. If not enough
!! food is available, some of your pets will get angry.

! Arguments
integer, intent(in)  :: cats
!! The number of cats to keep track of.
integer, intent(in)  :: dogs
!! The number of dogs to keep track of.
real, intent(inout)  :: food
!! The ammount of pet food (in kilograms) which you have on hand.
integer, intent(out) :: angry
!! The number of pets angry because they weren't fed.

!...
return
end subroutine feed_pets_${i}$${j}$
#:endfor
#:endfor
end module foods

is fprettified as

module foods
   implicit none
   #:for i in [1, 2, 3]
      #:for j in [1, 2, 3]
         subroutine feed_pets_${i}$${j}$ (cats, dogs, food, angry)
!! Feeds your cats and dogs, if enough food is available. If not enough
!! food is available, some of your pets will get angry.

! Arguments
            integer, intent(in)  :: cats
!! The number of cats to keep track of.
            integer, intent(in)  :: dogs
!! The number of dogs to keep track of.
            real, intent(inout)  :: food
!! The ammount of pet food (in kilograms) which you have on hand.
            integer, intent(out) :: angry
!! The number of pets angry because they weren't fed.

!...
            return
         end subroutine feed_pets_${i}$${j}$
      #:endfor
   #:endfor
end module foods

rather than what I expected:

module foods
   implicit none
   #:for i in [1, 2, 3]
      #:for j in [1, 2, 3]
         subroutine feed_pets_${i}$${j}$ (cats, dogs, food, angry)
            !! Feeds your cats and dogs, if enough food is available. If not enough
            !! food is available, some of your pets will get angry.

            ! Arguments
            integer, intent(in)  :: cats
               !! The number of cats to keep track of.
            integer, intent(in)  :: dogs
               !! The number of dogs to keep track of.
            real, intent(inout)  :: food
               !! The ammount of pet food (in kilograms) which you have on hand.
            integer, intent(out) :: angry
               !! The number of pets angry because they weren't fed.

            !...
            return
         end subroutine feed_pets_${i}$${j}$
      #:endfor
   #:endfor
end module foods

Moreover, it would be nice if other comments (e.g., !>) could be nicely indented.