Skip to content

prettyPrint does not preseve the content of quoted string #90

Description

@bqcuong

Hi there,

I have a similar problem to #57 with the prettyPrint for the quoted string.
It is about prettyPrint automatically move the parts after token && to a new line even in a quoted string.
The example code is described as below.

Is there any quick workarounds for this issue? I'm really looking forward to it.
Thank you very much!

I am using language-docker-10.4.2.

module Main
  ( main
  ) where

import qualified Data.Either as Either
import qualified Data.Text as T
import qualified Data.Text.IO as T.IO
import qualified Data.Text.Lazy as Lazy
import qualified Language.Docker as Docker
import Prelude (IO, ($))

main :: IO ()
main = T.IO.putStr prettyPrinted
  where
    prettyPrinted = Lazy.toStrict $ Docker.prettyPrint parsed
    parsed = Either.fromRight [] $ Docker.parseText source
    source = T.pack "FROM alpine\nRUN grep -F 'cd dir && ./run.sh ' /opt/Makefile"

It should return

FROM alpine
RUN grep -F 'cd dir && ./run.sh ' /opt/Makefile

However, the actual return is as below, which creates different shell execution result.

FROM alpine
RUN grep -F 'cd dir \
 && ./run.sh ' /opt/Makefile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions