From c16d885940745a72a9458187de6532efd3d607ff Mon Sep 17 00:00:00 2001
From: Daya Adianto <dayaadianto@cs.ui.ac.id>
Date: Fri, 3 Dec 2021 11:10:06 +0700
Subject: [PATCH] Add plugin for exporting site into HTML & PDF

---
 .gitlab-ci.yml           | 21 ++++++++++++++---
 Pipfile                  |  1 +
 Pipfile.lock             | 51 +++++++++++++++++++++++-----------------
 docs/overrides/main.html | 12 ++++++++++
 mkdocs.yml               |  2 ++
 5 files changed, 62 insertions(+), 25 deletions(-)
 create mode 100644 docs/overrides/main.html

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2718f5f..d82b208 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,17 @@
 ---
-variables:
-  PIPENV_VERSION: 2021.5.29
-  PIPENV_VENV_IN_PROJECT: 'True'
+include:
+  - template: Security/Dependency-Scanning.gitlab-ci.yml
+  - template: DAST.gitlab-ci.yml
 
 stages:
   - build
+  - test
   - deploy
+  - dast
+
+variables:
+  PIPENV_VERSION: 2021.5.29
+  PIPENV_VENV_IN_PROJECT: 'True'
 
 # Use merge request pipeline
 workflow:
@@ -53,3 +59,12 @@ deploy:
   environment:
     name: production
     url: https://pmpl.cs.ui.ac.id
+
+dast:
+  rules:
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+  variables:
+    DAST_WEBSITE: 'https://pmpl.cs.ui.ac.id'
+    DAST_FULL_SCAN_ENABLED: 'true'
+    GIT_STRATEGY: 'none'
+  dependencies: []
diff --git a/Pipfile b/Pipfile
index 7f9073d..45ae424 100644
--- a/Pipfile
+++ b/Pipfile
@@ -7,6 +7,7 @@ name = "pypi"
 mkdocs = "~=1.2.3"
 mkdocs-material = "~=7.3.6"
 mkdocs-git-revision-date-localized-plugin = "~=0.10.2"
+mkdocs-print-site-plugin = "~=2.1"
 
 [dev-packages]
 
diff --git a/Pipfile.lock b/Pipfile.lock
index 894f2f0..778725b 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "eb241c9baf0e485ff9d3998f6c63add07915fc484b2205252e93222c8edc2422"
+            "sha256": "55e886b31815f880c164bb4265cb420b23cea1c56ecbb46f124d53be5309c314"
         },
         "pipfile-spec": 6,
         "requires": {
@@ -68,7 +68,7 @@
                 "sha256:53ccfd5c134223e497627b9815d5030edf77d2ed573922f7a0b8f8bb81a1c100",
                 "sha256:75bdec14c397f528724c1bfd9709d660b33a4d2e77387a3358f20b848bb5e5fb"
             ],
-            "markers": "python_version >= '3.6'",
+            "markers": "python_version < '3.10'",
             "version": "==4.8.2"
         },
         "jinja2": {
@@ -81,11 +81,11 @@
         },
         "markdown": {
             "hashes": [
-                "sha256:31b5b491868dcc87d6c24b7e3d19a0d730d59d3e46f4eea6430a321bed387a49",
-                "sha256:96c3ba1261de2f7547b46a00ea8463832c921d3f9d6aba3f255a6f71386db20c"
+                "sha256:76df8ae32294ec39dcf89340382882dfa12975f87f45c3ed1ecdb1e8cefc7006",
+                "sha256:9923332318f843411e9932237530df53162e29dc7a4e2b91e35764583c46c9a3"
             ],
             "markers": "python_version >= '3.6'",
-            "version": "==3.3.4"
+            "version": "==3.3.6"
         },
         "markupsafe": {
             "hashes": [
@@ -180,11 +180,11 @@
         },
         "mkdocs-git-revision-date-localized-plugin": {
             "hashes": [
-                "sha256:16ffc10407d5e84f0e5248496191d065d611095a12a48cb5070167b4808ae06a",
-                "sha256:817dd2c897ede4f801673898d454191b280cf0b21650de82b2144e4774b4cd2a"
+                "sha256:aa5031850412e17613fc9f0e8f822d41b21e3e03a420ea7b768e3268aa2d6a37",
+                "sha256:c4b3b0ea8b42013c4a2ad0f6f0b59828558c034363bb266b93e411b880904082"
             ],
             "index": "pypi",
-            "version": "==0.10.2"
+            "version": "==0.10.3"
         },
         "mkdocs-material": {
             "hashes": [
@@ -202,13 +202,21 @@
             "markers": "python_version >= '3.6'",
             "version": "==1.0.3"
         },
+        "mkdocs-print-site-plugin": {
+            "hashes": [
+                "sha256:6b3c35d9c529dfb0aa5d0b95261c8ac954842a8b05993ce08b48e9006a1285ff",
+                "sha256:ffe52e87534798393840f96c950313f320b6e9effa9e47d21fce913d0f33dbb8"
+            ],
+            "index": "pypi",
+            "version": "==2.1"
+        },
         "packaging": {
             "hashes": [
-                "sha256:096d689d78ca690e4cd8a89568ba06d07ca097e3306a4381635073ca91479966",
-                "sha256:14317396d1e8cdb122989b916fa2c7e9ca8e2be9e8060a6eff75b6b7b4d8a7e0"
+                "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb",
+                "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"
             ],
             "markers": "python_version >= '3.6'",
-            "version": "==21.2"
+            "version": "==21.3"
         },
         "pygments": {
             "hashes": [
@@ -220,19 +228,19 @@
         },
         "pymdown-extensions": {
             "hashes": [
-                "sha256:01e4bec7f4b16beaba0087a74496401cf11afd69e3a11fe95cb593e5c698ef40",
-                "sha256:430cc2fbb30cef2df70edac0b4f62614a6a4d2b06462e32da4ca96098b7c1dfb"
+                "sha256:74247f2c80f1d9e3c7242abe1c16317da36c6f26c7ad4b8a7f457f0ec20f0365",
+                "sha256:b03e66f91f33af4a6e7a0e20c740313522995f69a03d86316b1449766c473d0e"
             ],
             "markers": "python_version >= '3.6'",
-            "version": "==9.0"
+            "version": "==9.1"
         },
         "pyparsing": {
             "hashes": [
-                "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1",
-                "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"
+                "sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4",
+                "sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81"
             ],
-            "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",
-            "version": "==2.4.7"
+            "markers": "python_version >= '3.6'",
+            "version": "==3.0.6"
         },
         "python-dateutil": {
             "hashes": [
@@ -314,12 +322,11 @@
         },
         "typing-extensions": {
             "hashes": [
-                "sha256:49f75d16ff11f1cd258e1b988ccff82a3ca5570217d7ad8c5f48205dd99a677e",
-                "sha256:d8226d10bc02a29bcc81df19a26e56a9647f8b0a6d4a83924139f4a8b01f17b7",
-                "sha256:f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34"
+                "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e",
+                "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"
             ],
             "markers": "python_version < '3.10'",
-            "version": "==3.10.0.2"
+            "version": "==4.0.1"
         },
         "watchdog": {
             "hashes": [
diff --git a/docs/overrides/main.html b/docs/overrides/main.html
new file mode 100644
index 0000000..3fdda1c
--- /dev/null
+++ b/docs/overrides/main.html
@@ -0,0 +1,12 @@
+{% extends "base.html" %}
+
+{% block content %}
+
+{% if page.url_to_print_page %}
+    <a href="{{ page.url_to_print_page }}" title="Print Site" class="md-content__button md-icon">
+        {% include ".icons/material/printer.svg" %}
+    </a>
+{% endif %}
+
+{{ super() }}
+{% endblock content %}
diff --git a/mkdocs.yml b/mkdocs.yml
index 6514798..e4fadf9 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -12,6 +12,7 @@ edit_uri: ""
 
 theme:
   name: material
+  custom_dir: docs/overrides
   features:
     - navigation.tabs
     - navigation.indexes
@@ -38,6 +39,7 @@ plugins:
   - git-revision-date-localized:
       type: iso_datetime
       enable_creation_date: true
+  - print-site
 
 markdown_extensions:
   - abbr
-- 
GitLab