Skip to content
Snippets Groups Projects
  1. Sep 24, 2020
  2. Sep 23, 2020
  3. Sep 22, 2020
  4. Sep 21, 2020
    • Martyn Welch's avatar
      Don't add anchors to page titles · 932647cf
      Martyn Welch authored
      
      We are currently adding anchor links to all headings. This includes the
      page titles, which is the one heading to which we really don't need a
      link. The page title is also centered and the addition of the anchor
      causes the normally visible part of the title to be nudged to rendered off
      center. This is visually unappealing, so stop adding anchors to the page
      titles.
      
      Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
      932647cf
    • Martyn Welch's avatar
      Add AnchorJS to aid with linking to page fragments · 0b9c716d
      Martyn Welch authored
      
      After trying to manually create a link to a page section for the nth time,
      I finally scratched that itch and added AnchorJS to provide the links for
      us. This greatly simplifies the process for linking to sections of pages,
      especially useful for those not versed in digging around in the page
      source.
      
      Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
      0b9c716d
  5. Sep 20, 2020
  6. Sep 15, 2020
  7. Sep 11, 2020
  8. Sep 10, 2020
  9. Sep 08, 2020
  10. Sep 07, 2020
  11. Sep 03, 2020
    • Martyn Welch's avatar
      Update and classify a batch of design documents · 786fb549
      Martyn Welch authored and Emanuele Aina's avatar Emanuele Aina committed
      
      The design documents imported from designs.apertis.org need to be
      classified and moved into the structure implemented for documents on the
      new website. The content of the documents also need minor edits to ensure
      a good look and feel as well as the addition of notes to explain the
      context of some documents (such as noting that certain concept documents
      have been implemented since they were written and when that occurred).
      
      This commit contains conversion of an initial batch of design documents.
      
      Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
      786fb549
    • Martyn Welch's avatar
      Fix creation dates · a98cb03f
      Martyn Welch authored and Emanuele Aina's avatar Emanuele Aina committed
      
      Got out of step whilst adding creation dates to designs and failed to test
      properly. A stray space is stopping the dates from being parsed. Remove
      the space.
      
      Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
      a98cb03f
  12. Sep 02, 2020
  13. Aug 31, 2020
  14. Aug 27, 2020
  15. Aug 26, 2020
  16. Aug 25, 2020
  17. Aug 18, 2020
  18. Aug 06, 2020
  19. Aug 05, 2020
  20. Aug 03, 2020
  21. Jul 29, 2020
    • Martyn Welch's avatar
      Fix up broken links · c7250de9
      Martyn Welch authored and Emanuele Aina's avatar Emanuele Aina committed
      
      A number of broken links didn't match the patterns used for automated
      replacement. Fix up those that can be manually.
      
      Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
      c7250de9
    • Martyn Welch's avatar
      Remove link to designs.a.o · 9a6388ac
      Martyn Welch authored and Emanuele Aina's avatar Emanuele Aina committed
      
      We now have the designs here, don't point to designs.a.o.
      
      Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
      9a6388ac
    • Martyn Welch's avatar
      Updating old links · ee26b8cf
      Martyn Welch authored and Emanuele Aina's avatar Emanuele Aina committed
      
      After moving the documents from designs.a.o to www.a.o, there were
      quite a few links from the designs.a.o docs pointing to wiki.a.o and
      quite a few links from www.a.o pointing to designs.a.o. Replace these
      links with Hugo ref shortcodes to avoid hammering the redirects.
      
      This was achieved with the following script:
      
      ```
      
      import os
      import re
      import sys
      import toml
      
      from urllib.parse import urlparse
      
      def get_aliases(filename):
          #print("%s: " % filename)
          with open(filename, 'r') as file:
              contents = file.read()
              if not contents[0:3] == "+++":
                  return
      
              if "_index.md" in filename:
                  filename = filename.strip(".")
              else:
                  filename = filename.split("/")[-1]
      
              data = toml.loads(contents.split("+++")[1])
      
              if not "aliases" in data.keys():
                  return
      
              for alias in data["aliases"]:
                  if "/old-wiki/" in alias:
                      wiki_aliases[alias.replace("/old-wiki/", "/")] = filename
      
                  if "/old-designs/" in alias:
                      # We're dropping the per-release links from designs.a.o, so match on shorter path
                      design_aliases[alias.replace("/old-designs/latest/", "/")] = filename
      
      def fix_link(url):
          link = url.group('link')
      
          url = urlparse(link)
      
          if url.netloc == "wiki.apertis.org":
              if url.path in wiki_aliases.keys():
                  url = url._replace(scheme="")
                  url = url._replace(netloc="")
                  url = url._replace(path=wiki_aliases[url.path])
                  link = " {{< ref \"%s\" >}} " % url.geturl()
      
          if url.netloc == "designs.apertis.org":
              # We're dropping the per-release links from designs.a.o, so match on shorter path
              path = "/%s" % url.path.split('/', 2)[-1]
              print(path)
              if path in design_aliases.keys():
                  url = url._replace(scheme="")
                  url = url._replace(netloc="")
                  url = url._replace(path=design_aliases[path])
                  link = " {{< ref \"%s\" >}} " % url.geturl()
      
          return "](%s)" % link
      
      def fix_ref(url):
          link = url.group('link')
      
          url = urlparse(link)
      
          if url.netloc == "wiki.apertis.org":
              if url.path in wiki_aliases.keys():
                  url = url._replace(scheme="")
                  url = url._replace(netloc="")
                  url = url._replace(path=wiki_aliases[url.path])
                  link = " {{< ref \"%s\" >}} " % url.geturl()
      
          if url.netloc == "designs.apertis.org":
              # We're dropping the per-release links from designs.a.o, so match on shorter path
              path = "/%s" % url.path.split('/', 2)[-1]
              print(path)
              if path in design_aliases.keys():
                  url = url._replace(scheme="")
                  url = url._replace(netloc="")
                  url = url._replace(path=design_aliases[path])
                  link = " {{< ref \"%s\" >}} " % url.geturl()
      
          return "]: %s" % link
      
      def correct_links(filename):
          #print("%s: " % filename)
          with open(filename, 'r+') as file:
              contents = file.read()
      
              if not contents[0:3] == "+++":
                  return
      
              fm = contents.split("+++")[1]
              doc = contents.split("+++",2)[2]
      
              # Hotdoc allows empty links like `[](url)`
              pattern = re.compile("\]\((?P<link>.*?)\)")
              doc = pattern.sub(fix_link, doc)
      
              pattern = re.compile("\]: (?P<link>.*)")
              doc = pattern.sub(fix_ref, doc)
      
              file.seek(0)
              file.truncate()
      
              file.write("+++")
              file.write(fm)
              file.write("+++")
              file.write(doc)
      
      wiki_aliases = {}
      design_aliases = {}
      
      for root, dirs, files in os.walk(sys.argv[1]):
          for file in files:
              if ".md" in file:
                  get_aliases("%s/%s" %(root, file))
      
      print("wiki_aliases:")
      print(wiki_aliases)
      print("design_aliases:")
      print(design_aliases)
      
      for root, dirs, files in os.walk(sys.argv[1]):
          for file in files:
              if ".md" in file:
                  correct_links("%s/%s" %(root, file))
      ```
      
      Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
      ee26b8cf
Loading