Convert WriteFreely quotes to Instagram / PixelFed posts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 regels
1.1 KiB

  1. /*
  2. * Copyright © 2021 A Bunch Tell LLC.
  3. *
  4. * This file is part of text-pic.
  5. *
  6. * text-pic is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License, included
  8. * in the LICENSE file in this source code package.
  9. */
  10. package textpic
  11. var fonts = map[string]string{
  12. "norm": "Lora",
  13. "serif": "Lora",
  14. "sans": "OpenSans",
  15. "mono": "Hack",
  16. "wrap": "Hack",
  17. }
  18. type ContentOptions struct {
  19. // Author information
  20. Instance string
  21. Username string
  22. // Write.as-only option
  23. IsSubdomain bool // UNIMPLEMENTED
  24. // Content
  25. UserFont string
  26. Content string
  27. }
  28. func NewContentOptions(instance, username string, isSubdomain bool, font, content string) *ContentOptions {
  29. opt := &ContentOptions{
  30. Instance: instance,
  31. Username: username,
  32. IsSubdomain: isSubdomain,
  33. UserFont: font,
  34. Content: content,
  35. }
  36. if opt.Instance == "" {
  37. opt.Instance = "write.as"
  38. }
  39. if opt.Content == "" {
  40. opt.Content = "Hello, world!"
  41. }
  42. return opt
  43. }
  44. func IsValidFont(f string) bool {
  45. _, valid := fonts[f]
  46. return valid
  47. }