Repository: FHIR/sushi (ts)

Issue:
Maintainer URL not being propagated to IG JSON contact URL
The IG Exporter converts maintainers in the `package.json` to contacts in the ImplementationGuide JSON.  While it successfully converts name and email, it seems to drop url.  This means we can't supply contact URLs, which affects the link to the publisher in the footer of the rendered IG.

Pull request description:
Convert maintainer url to IG contact url
Maintainer URLs (in package.json) were being dropped when generating the contacts in IG JSON.  This has been fixed.

Fixes #234

Patch:
diff --git a/src/fshtypes/Config.ts b/src/fshtypes/Config.ts
index 3488444..8816671 100644
--- a/src/fshtypes/Config.ts
+++ b/src/fshtypes/Config.ts
@@ -20,6 +20,7 @@ export type Config = {
   maintainers?: [
     {
       name: string;
+      url: string;
       email: string;
     }
   ];
diff --git a/src/ig/IGExporter.ts b/src/ig/IGExporter.ts
index 917d960..b6bc6f3 100644
--- a/src/ig/IGExporter.ts
+++ b/src/ig/IGExporter.ts
@@ -75,14 +75,21 @@ export class IGExporter {
         if (m.name) {
           contact.name = m.name;
         }
-        if (m.email) {
+        if (m.url) {
           contact.telecom = [
             {
-              system: 'email',
-              value: m.email
+              system: 'url',
+              value: m.url
             }
           ];
         }
+        if (m.email) {
+          contact.telecom = contact.telecom ?? [];
+          contact.telecom.push({
+            system: 'email',
+            value: m.email
+          });
+        }
         return contact;
       }),
       description: config.description,


Test patch:
diff --git a/test/ig/IGExporter.test.ts b/test/ig/IGExporter.test.ts
index f26f087..8a15aca 100644
--- a/test/ig/IGExporter.test.ts
+++ b/test/ig/IGExporter.test.ts
@@ -114,6 +114,10 @@ describe('IGExporter', () => {
           {
             name: 'Bill Cod',
             telecom: [
+              {
+                system: 'url',
+                value: 'https://capecodfishermen.org/'
+              },
               {
                 system: 'email',
                 value: 'cod@reef.gov'
diff --git a/test/ig/fixtures/simple-ig/package.json b/test/ig/fixtures/simple-ig/package.json
index 05b325e..9196b91 100644
--- a/test/ig/fixtures/simple-ig/package.json
+++ b/test/ig/fixtures/simple-ig/package.json
@@ -15,7 +15,8 @@
   "maintainers": [
     {
       "name": "Bill Cod",
-      "email": "cod@reef.gov"
+      "email": "cod@reef.gov",
+      "url": "https://capecodfishermen.org/"
     }
   ],
   "license": "CC0-1.0"