Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10433127
fonts.go
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
fonts.go
View Options
package
config
import
(
"fmt"
)
// postFont represents a valid post appearance value in the API.
type
postFont
string
// Valid appearance types for posts.
const
(
PostFontNormal
postFont
=
"norm"
PostFontSans
=
"sans"
PostFontMono
=
"mono"
PostFontWrap
=
"wrap"
PostFontCode
=
"code"
)
var
postFontMap
=
map
[
string
]
postFont
{
"norm"
:
PostFontNormal
,
"normal"
:
PostFontNormal
,
"serif"
:
PostFontNormal
,
"sans"
:
PostFontSans
,
"sansserif"
:
PostFontSans
,
"mono"
:
PostFontMono
,
"monospace"
:
PostFontMono
,
"wrap"
:
PostFontWrap
,
"code"
:
PostFontCode
,
}
func
GetFont
(
code
bool
,
font
string
)
string
{
if
code
{
if
font
!=
""
&&
font
!=
DefaultFont
{
fmt
.
Printf
(
"A non-default font '%s' and --code flag given. 'code' type takes precedence.\n"
,
font
)
}
return
"code"
}
// Validate font value
if
f
,
ok
:=
postFontMap
[
font
];
ok
{
return
string
(
f
)
}
fmt
.
Printf
(
"Font '%s' invalid. Using default '%s'\n"
,
font
,
DefaultFont
)
return
string
(
DefaultFont
)
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 20, 1:19 AM (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3135660
Attached To
rWCLI writeas-cli
Event Timeline
Log In to Comment