[Cryptech-Commits] [user/sra/pelican] 53/68: Try mapping source: and browser: links

git at cryptech.is git at cryptech.is
Mon Jul 19 22:25:32 UTC 2021


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch pelican
in repository user/sra/pelican.

commit 86202308b68db7a6cf299c5fe3cdee4dc1850330
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Mon Feb 15 23:55:13 2021 +0000

    Try mapping source: and browser: links
    
    This turns out to be less useful than expected, because somehow for
    every single link in the wiki, the source repository is not quite in
    the obvios plae with cgit.  Might be a cgit configuration issue, but
    this gets wonky enough that it's probably simpler just to expand the
    JSON file we already have for the filter rules so that it includes
    other magic stuff like a URL map for this kind of link.
---
 pelican/content/AlphaSchematics.md             |  2 +-
 pelican/content/BuildingFromSource.md          |  2 +-
 pelican/content/CoretestHashesC5G.md           | 12 ++++++------
 pelican/content/CoretestHashesNovena.md        | 12 ++++++------
 pelican/content/Joachim%20Str%C3%B6mbergson.md |  4 ++--
 pelican/content/ReleaseNotes.md                |  2 +-
 trac2md.py                                     | 13 ++++++++++---
 7 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/pelican/content/AlphaSchematics.md b/pelican/content/AlphaSchematics.md
index ae59fdc..09b176d 100644
--- a/pelican/content/AlphaSchematics.md
+++ b/pelican/content/AlphaSchematics.md
@@ -4,7 +4,7 @@ Date: 2016-12-15 22:39
 
 The Alpha schematics are almost finished!
 
-PDF and Eagle files available for download here in the [hardware](source:/hardware/eagle/alpha/rev02) repository.
+PDF and Eagle files available for download here in the [hardware](https://git.cryptech.is/hardware/eagle/alpha/rev02) repository.
 
 `https://wiki.cryptech.is/browser/hardware/eagle/alpha/rev02`
 
diff --git a/pelican/content/BuildingFromSource.md b/pelican/content/BuildingFromSource.md
index e17fc16..55a4460 100644
--- a/pelican/content/BuildingFromSource.md
+++ b/pelican/content/BuildingFromSource.md
@@ -39,7 +39,7 @@ goo necessary to make the whole thing work.  Do `git help submodule`
 for an introduction to git's submodule mechanism.
 
 With this model, one just checks out a copy of
-[the superrepository](source:/releng/alpha),
+[the superrepository](https://git.cryptech.is/releng/alpha),
 runs `make` in its top directory, and eventually
 the complete package pops out the other side.
 
diff --git a/pelican/content/CoretestHashesC5G.md b/pelican/content/CoretestHashesC5G.md
index 57c0310..381fba8 100644
--- a/pelican/content/CoretestHashesC5G.md
+++ b/pelican/content/CoretestHashesC5G.md
@@ -40,24 +40,24 @@ SHA-1 and SHA-256 hash functions from a host computer via a serial
 interface connected to a FPGA device. The subsystem consists of:
 
 
-- [sha1](browser:/core/sha1): A HW implementation of the SHA-1 hash function.
+- [sha1](https://git.cryptech.is/core/sha1): A HW implementation of the SHA-1 hash function.
 
 
 
-- [sha56](browser:/core/sha256): A HW implementation of the SHA-256 hash function.
+- [sha56](https://git.cryptech.is/core/sha256): A HW implementation of the SHA-256 hash function.
 
 
 
-- [coretest](browser:/core/coretest): A command parser that accepts read/write commands from a
+- [coretest](https://git.cryptech.is/core/coretest): A command parser that accepts read/write commands from a
 
   host, executes the commands and sends the response.
 
 
-- [uart](browser:/core/usrt): A simple serial interface that connects coretest to the host.
+- [uart](https://git.cryptech.is/core/usrt): A simple serial interface that connects coretest to the host.
 
 
 
-- [coretest_hashes](browser:/core/coretest_hashes): A top level wrapper that connects all the cores as
+- [coretest_hashes](https://git.cryptech.is/core/coretest_hashes): A top level wrapper that connects all the cores as
 
   well as connecting the rxd and txd ports on the uart to external pins as well as clk and reset. This core repo also contains the Python command line program hash_tester we will be using to talk to coretester and perform tests of the sha1 and sha256 cores.
 
@@ -417,7 +417,7 @@ hash_tester.py
 This is a Python2.x program that uses Pyserial [5] to open up a serial
 port and talk to coretest via the uart. The command and response format
 used is a very simple byte oriented format. For more info, see the
-README.md in [the top of coretest](browser:/core/coretest).
+README.md in [the top of coretest](https://git.cryptech.is/core/coretest).
 
 The program hash_tester.py needs to know which serial interface to
 use. This is defined in the main() function (yes, VERY ugly). You will
diff --git a/pelican/content/CoretestHashesNovena.md b/pelican/content/CoretestHashesNovena.md
index 43e9838..f761f4c 100644
--- a/pelican/content/CoretestHashesNovena.md
+++ b/pelican/content/CoretestHashesNovena.md
@@ -41,31 +41,31 @@ of the SHA-1 and SHA-2 hash functions from the host computer via an
 I2C serial bus. The subsystem consists of:
 
 
-- [sha1](browser:/core/sha1): A HW implementation of the SHA-1 hash function.
+- [sha1](https://git.cryptech.is/core/sha1): A HW implementation of the SHA-1 hash function.
 
 
 
-- [sha256](browser:/core/sha256): A HW implementation of the SHA-256 hash
+- [sha256](https://git.cryptech.is/core/sha256): A HW implementation of the SHA-256 hash
 
   function.
 
 
-- [sha512](browser:/core/sha512): A HW implementation of the SHA-512 hash
+- [sha512](https://git.cryptech.is/core/sha512): A HW implementation of the SHA-512 hash
 
   function.
 
 
-- [coretest](browser:/core/coretest): A command parser that accepts read/write
+- [coretest](https://git.cryptech.is/core/coretest): A command parser that accepts read/write
 
   commands from a host, executes the commands and sends the response.
 
 
-- [i2c](browser:/core/i2c): A serial interface that connects coretest to the
+- [i2c](https://git.cryptech.is/core/i2c): A serial interface that connects coretest to the
 
   host.
 
 
-- [novena](browser:/core/novena): A top-level wrapper that connects all
+- [novena](https://git.cryptech.is/core/novena): A top-level wrapper that connects all
 
  the cores, and connects i2c to external pins as well as clk and
  reset. This repo also contains userland software that talks to
diff --git a/pelican/content/Joachim%20Str%C3%B6mbergson.md b/pelican/content/Joachim%20Str%C3%B6mbergson.md
index eed092e..c5e5f14 100644
--- a/pelican/content/Joachim%20Str%C3%B6mbergson.md
+++ b/pelican/content/Joachim%20Str%C3%B6mbergson.md
@@ -21,8 +21,8 @@ Date: 2016-12-15 22:54
 ## Work Notes
 ### Presentations from meeting 2014-03-10 (updated and extended):
 
-* [Cryptech HW status 2014-03-10](browser:/doc/presentations/Cryptech_HW_status_2014-03-10.pdf)
-* [Cryptech TRNG Ideas 2014-03-17](browser:/doc/presentations/Cryptech_TRNG_Ideas_2014-03-17.pdf)
+* [Cryptech HW status 2014-03-10](https://git.cryptech.is/doc/presentations/Cryptech_HW_status_2014-03-10.pdf)
+* [Cryptech TRNG Ideas 2014-03-17](https://git.cryptech.is/doc/presentations/Cryptech_TRNG_Ideas_2014-03-17.pdf)
 
 
 ### Open EDA Tools
diff --git a/pelican/content/ReleaseNotes.md b/pelican/content/ReleaseNotes.md
index 8282557..a95050a 100644
--- a/pelican/content/ReleaseNotes.md
+++ b/pelican/content/ReleaseNotes.md
@@ -22,7 +22,7 @@ Modified: 2017-05-13 19:18
 * Python client implementations of libhal RPC mechanism and PKCS #11 now installed as `cryptech.libhal` and `cryptech.py11`, respectively.
 * Python PKCS #11 client hacked to play nicely with `pkcs11-spy` debugging tool.
 * RTOS replaced by simple non-preemptive (voluntary yield) tasking system, eliminating a huge morass of potential race conditions, debugging nightmares, priority inversions, and similar horrors.  Lack of preemption means that console acess may have to wait for something else to yield the ARM CPU, but it's more than worth it to get rid of all the stability problems the RTOS was causing.
-* [Sample code for using the HSM as an OpenSSL engine](source:/user/sra/openssl-engine) is available.  This only works with RSA for the moment, due to apparent limitations of the engine implementation.
+* [Sample code for using the HSM as an OpenSSL engine](https://git.cryptech.is/user/sra/openssl-engine) is available.  This only works with RSA for the moment, due to apparent limitations of the engine implementation.
 
 
 Getting started with 3.0:
diff --git a/trac2md.py b/trac2md.py
index ab8a558..cf8ecdf 100755
--- a/trac2md.py
+++ b/trac2md.py
@@ -20,7 +20,7 @@ traclink_pattern = re.compile(r"(?<!\[)\[([^][]+)\]")
 
 image_pattern = re.compile(r"\[\[Image\((.*)\)\]\]")
 
-wikilink_pattern = re.compile(r"\[\[(wiki:|attachment:)?([^]|[]+)(?:[|]([^][]+))?\]\]")
+wikilink_pattern = re.compile(r"\[\[(wiki:|attachment:|source:|browser:)?([^]|[]+)(?:[|]([^][]+))?\]\]")
 
 strikethrough_pattern = re.compile(r"~~([^~]+)~~")
 bangquote_pattern = re.compile(r"!((?:\w|[#])+)")
@@ -62,7 +62,12 @@ def convert_traclink_to_creolelink(line):
     return line
 
 
-def convert_wikilinks(line, slug):
+# Probably most of the non-wiki scheme tests should become a table in an
+# extended JSON config file which maps
+#
+#   { "source:fee/fie/foe/fum": "https://git.cryptech.is/blarg/blee/blue" }
+
+def convert_wikilinks(line, slug, giturl):
     for m in wikilink_pattern.finditer(line):
         scheme, link, text = [p.strip() if p else p for p in  m.groups()]
         if text is None:
@@ -75,6 +80,8 @@ def convert_wikilinks(line, slug):
             mdlink = "<{}>".format(link)
         elif scheme == "attachment:":
             mdlink = "[{}]({{attach}}{}/{})".format(text, slug, link)
+        elif scheme in ("source:", "browser:"):
+            mdlink = "[{}]({}/{})".format(text, giturl.rstrip("/"), link.lstrip("/"))
         elif scheme == "wiki:" or (scheme is None and camelcase_pattern.match(link)):
             mdlink = "[{}]({{filename}}{}.md)".format(text, link)
         else:
@@ -190,7 +197,7 @@ def WikiToMD(content, slug):
             line = delete_pattern.sub("", line)
 
             # Convert wiki links
-            line = convert_wikilinks(line, slug)
+            line = convert_wikilinks(line, slug, "https://git.cryptech.is/")
 
             # Convert striked through text
             line = strikethrough_pattern.sub(r"<s>\1</s>", line)



More information about the Commits mailing list