diff --git a/.github/workflows/cd-convert-debian-bookworm.yml b/.github/workflows/cd-convert-debian-bookworm.yml index df1ad13..b1b953d 100644 --- a/.github/workflows/cd-convert-debian-bookworm.yml +++ b/.github/workflows/cd-convert-debian-bookworm.yml @@ -1,12 +1,9 @@ -name: CI/CD for Converting tm format to html +name: CD for Converting tm format to html on: push: branches: - main - pull_request: - branches: - - main jobs: build: @@ -22,12 +19,12 @@ jobs: - name: download release from mogan research repository run: | - wget https://github.com/XmacsLabs/mogan/releases/download/v1.2.8-rc1/mogan-research-v1.2.8-rc1-debian12.deb -O /tmp/mogan-research.deb + wget https://github.com/XmacsLabs/mogan/releases/download/v1.2.8-rc2/mogan-research-v1.2.8-rc2-debian12.deb -O /tmp/mogan-research.deb DEBIAN_FRONTEND=noninteractive apt install -y /tmp/mogan-research.deb - name: convert document to html format run: | - /usr/bin/MoganResearch -headless -b CICD/tm2html_CICD.scm -x "(tm2html_CICD)" -q + /usr/bin/MoganResearch -headless -b CD/tm2html_CD.scm -x "(tm2html_CD)" -q # Deploy to local repo - name: Deploy @@ -35,5 +32,5 @@ jobs: env: REPO: self BRANCH: gh-pages - FOLDER: CICD/html/planet + FOLDER: CD/html/planet GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/CICD/tm2html_CICD.scm b/CD/tm2html_CD.scm similarity index 55% rename from CICD/tm2html_CICD.scm rename to CD/tm2html_CD.scm index 6ee0995..db0d039 100644 --- a/CICD/tm2html_CICD.scm +++ b/CD/tm2html_CD.scm @@ -1,8 +1,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; -;; MODULE : tm2html_CICD.scm -;; DESCRIPTION : Convert tm format to html for CICD +;; MODULE : tm2html_CD.scm +;; DESCRIPTION : Convert tm format to html for CD ;; COPYRIGHT : (C) 2024 ATQlove ;; ;; This software falls under the GNU general public license version 3 or later. @@ -11,9 +11,6 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(import (srfi srfi-13)) -(import (srfi srfi-1)) - (define (list-files dir) (let* ((filtered-files (url->list (url-expand @@ -21,21 +18,12 @@ (url-append (url-descendants dir) (url-or (url-wildcard "*.tm") (url-wildcard "*.tmu"))) - "fr")))) - (filtered-files-no-conflict (filter (lambda (file) - (let ((file-string (url->string file))) - (and (not (string-contains? file-string "MoganSTEMTutorial")) - (not (string-contains? file-string "LaTeX")) - (not (string-contains? file-string "UIC")) - (not (string-contains? file-string "X202402预备会议")) - (not (string-contains? file-string "SICP")) - (not (string-contains? file-string "LCPU_x_USTCLUG_Salon"))))) - filtered-files))) + "fr"))))) ; (display "Filtered files:\n") ; (for-each (lambda (file) (display (string-append (url->string file) "\n"))) filtered-files) - filtered-files-no-conflict)) + filtered-files)) -(define (export-file-to-html file base-dir output-dir) +(define (export-file-to-html base-dir file output-dir) (let* ((relative-path (url-delta base-dir file)) (output-file-url (url-append output-dir relative-path)) (output-file-url (url-unglue output-file-url 3)) ; Remove ".tm" or ".tmu" extension @@ -43,13 +31,13 @@ (output-dir-url (url-head html-file-url))) ; ; Debugging information; expect information are just some example - ; (display (string-append "Base directory: " (url->string base-dir) "\n")) ; Expect: file:///F:/mogan/planet/CICD/try - ; (display (string-append "File: " (url->string file) "\n")) ; Expect: file:///F:/mogan/planet/CICD/try/2/24_10_tmhtml_test.tmu + ; (display (string-append "Base directory: " (url->string base-dir) "\n")) ; Expect: file:///F:/mogan/planet/CD/try + ; (display (string-append "File: " (url->string file) "\n")) ; Expect: file:///F:/mogan/planet/CD/try/2/24_10_tmhtml_test.tmu ; (display (string-append "Relative path: " (url->string relative-path) "\n")) ; Expect: /2/24_10_tmhtml_test.tmu - ; (display (string-append "Output file URL (before unglue): " (url->string output-file-url) "\n")) ; Expect: file:///F:/mogan/planet/CICD/html/2/24_10_tmhtml_test.tmu - ; (display (string-append "Output file URL (after unglue): " (url->string (url-unglue output-file-url 3)) "\n")) ; Expect: file:///F:/mogan/planet/CICD/html/2/24_10_tmhtml_test - ; (display (string-append "HTML file URL: " (url->string html-file-url) "\n")) ; Expect: file:///F:/mogan/planet/CICD/html/2/24_10_tmhtml_test.html - ; (display (string-append "Output directory URL: " (url->string output-dir-url) "\n")) ; Expect: file:///F:/mogan/planet/CICD/html/2 + ; (display (string-append "Output file URL (before unglue): " (url->string output-file-url) "\n")) ; Expect: file:///F:/mogan/planet/CD/html/2/24_10_tmhtml_test.tmu + ; (display (string-append "Output file URL (after unglue): " (url->string (url-unglue output-file-url 3)) "\n")) ; Expect: file:///F:/mogan/planet/CD/html/2/24_10_tmhtml_test + ; (display (string-append "HTML file URL: " (url->string html-file-url) "\n")) ; Expect: file:///F:/mogan/planet/CD/html/2/24_10_tmhtml_test.html + ; (display (string-append "Output directory URL: " (url->string output-dir-url) "\n")) ; Expect: file:///F:/mogan/planet/CD/html/2 (make-directory (url->string output-dir-url)) (display (string-append "Exporting " (url->string file) " to " (url->string html-file-url) "\n")) @@ -62,15 +50,11 @@ (define (export-directory dir output-dir) (let* ((files (list-files dir))) (for-each (lambda (file) - (export-file-to-html file dir output-dir)) + (export-file-to-html dir file output-dir)) files))) -(tm-define (tm2html_CICD) - ; (url-exists? "/__w/planet/planet/jingkaimori") - ; (url-exists? "/__w/planet/planet/CICD") - ; (define filtered-files (list-files "F:/mogan/planet")) - ; (display filtered-files) - (export-directory "/__w/planet/planet" "/__w/planet/planet/CICD/html") - ; (export-directory "F:/mogan/planet" "F:/mogan/planet/CICD/html") - (display "Conversion from tm/tmu to html end\n")) - \ No newline at end of file +(define (tm2html_CD) + (let* ((current-dir (url->string (url-pwd))) + (output-dir (string-append current-dir "/CD/html"))) + (export-directory current-dir output-dir) + (display "Conversion from tm/tmu to html end\n")))