Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Swift Markup language for writing watermarks, remove 'note' from watermark text and Makefile #3687

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Data.List (nub)
import System.FilePath.Posix (takeExtension, takeBaseName)
import Text.PrettyPrint.HughesPJ (Doc)
import Utils.Drasil (capitalize)
import Metadata.Drasil.DrasilMetaCall (drasilMeta, DrasilMeta(..), watermark)
import Metadata.Drasil.DrasilMetaCall (watermark)

-- | Holds all the needed information to run a program.
data CodeHarness = Ch {
Expand Down Expand Up @@ -50,7 +50,7 @@ instance RuleTransformer CodeHarness where
buildTarget = makeS "build"

openingComments :: ProgData -> Annotation
openingComments m = [watermark ++ version drasilMeta,"Project Name: " ++ progName m, progPurpAdd m]
openingComments m = [watermark,"Project Name: " ++ progName m, progPurpAdd m]

-- | Helper that renders project purpose into a string if there is one.
progPurpAdd :: ProgData -> String
Expand Down
7 changes: 4 additions & 3 deletions code/drasil-gool/lib/GOOL/Drasil/LanguageRenderer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import Prelude hiding (break,print,last,sqrt,abs,log,exp,sin,cos,tan,asin,acos,
import Text.PrettyPrint.HughesPJ (Doc, text, empty, render, (<>), (<+>), ($+$),
space, brackets, parens, isEmpty, rbrace, lbrace, vcat, semi, equals, colon,
comma)
import Metadata.Drasil.DrasilMetaCall(drasilMeta, DrasilMeta(..), watermark)
import Metadata.Drasil.DrasilMetaCall(watermark)

----------------------------------------
-- Syntax common to several renderers --
Expand Down Expand Up @@ -416,7 +416,7 @@ moduleDox desc as date m = (doxFile ++ m) :
[doxAuthor ++ stringList as | not (null as)] ++
[doxDate ++ date | not (null date)] ++
[doxBrief ++ desc | not (null desc)] ++
[doxCommand ++ watermark ++ version drasilMeta]
[doxNote ++ watermark]

commentedMod :: FileData -> Doc -> FileData
commentedMod m cmt = updateFileMod (updateMod (commentedItem cmt) (fileMod m)) m
Expand Down Expand Up @@ -458,11 +458,12 @@ intValue i = i >>= intValue' . getType . valueType
where intValue' Integer = i
intValue' _ = error "Value passed to intValue must be Integer"

doxCommand, doxBrief, doxParam, doxReturn, doxFile, doxAuthor, doxDate :: String
doxCommand, doxBrief, doxParam, doxReturn, doxFile, doxAuthor, doxDate, doxNote :: String
doxCommand = "\\"
doxBrief = doxCommand ++ "brief "
doxParam = doxCommand ++ "param "
doxReturn = doxCommand ++ "return "
doxFile = doxCommand ++ "file "
doxAuthor = doxCommand ++ "author "
doxDate = doxCommand ++ "date "
doxNote = doxCommand ++ "note "
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ import Data.Maybe (fromMaybe)
import Text.PrettyPrint.HughesPJ (Doc, text, (<>), (<+>), parens, empty, equals,
vcat, lbrace, rbrace, braces, brackets, colon, space, doubleQuotes)
import qualified Text.PrettyPrint.HughesPJ as D (float)
import Metadata.Drasil.DrasilMetaCall (drasilMeta, DrasilMeta(..), watermark)
import Metadata.Drasil.DrasilMetaCall (watermark)

swiftExt :: String
swiftExt = "swift"
Expand Down Expand Up @@ -1159,19 +1159,25 @@ swiftClassDoc desc = [desc | not (null desc)]

swiftModDoc :: ModuleDocRenderer
swiftModDoc desc as date m = m : [desc | not (null desc)] ++
[swiftDocCommandInit ++ swiftAuthorDoc ++ swiftDocCommandSep ++ stringList as
| not (null as)]
++ [swiftDocCommandInit ++ swiftDateDoc ++ swiftDocCommandSep ++ date
| not (null date)] ++ [swiftDocCommandInit ++ watermark ++ version drasilMeta]
[swiftDocField swiftAuthorDoc (stringList as) | not (null as)]
++ [swiftDocField swiftDateDoc date | not (null date)]
++ [swiftDocField swiftNoteDoc watermark]

swiftDocCommandInit, swiftDocCommandSep, swiftParamDoc, swiftRetDoc,
swiftAuthorDoc, swiftDateDoc :: String
swiftAuthorDoc, swiftDateDoc, swiftNoteDoc :: String
swiftDocCommandInit = "- "
swiftDocCommandSep = ": "
swiftParamDoc = "Parameter"
swiftRetDoc = "Returns"
swiftAuthorDoc = "Authors"
swiftDateDoc = "Date"
swiftNoteDoc = "Note"

-- | Create an arbitrary Swift-DocC Markup field for documentation. Takes two
-- strings, one for the field type ('ty'), and another for the field information
-- ('info').
swiftDocField :: String -> String -> String
swiftDocField ty info = swiftDocCommandInit ++ ty ++ swiftDocCommandSep ++ info

typeDfltVal :: (RenderSym r) => CodeType -> SValue r
typeDfltVal Boolean = litFalse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ drasilMeta :: DrasilMeta
drasilMeta = $drasilMetaCfg

watermark :: String
watermark = "note Generated by Drasil "
watermark = "Generated by Drasil " ++ version drasilMeta
2 changes: 1 addition & 1 deletion code/stable/dblpend/src/cpp/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/dblpend/src/csharp/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/dblpend/src/java/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/dblpend/src/python/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/cpp/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/csharp/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/java/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/python/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/swift/Calculations.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/swift/DerivedValues.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/swift/InputConstraints.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/swift/InputFormat.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/swift/InputParameters.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/swift/Interpolation.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/swift/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/swift/OutputFormat.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/swift/ReadTable.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/glassbr/src/swift/main.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/pdcontroller/src/cpp/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/pdcontroller/src/csharp/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/pdcontroller/src/java/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/stable/pdcontroller/src/python/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading