1
0
Fork 0

Remove black list in tm2html_CD (#38)

## What?
Change tm, tmu format to html for CD

## How to test?
On Linux:
```
/usr/bin/MoganResearch -headless -b CD/tm2html_CD.scm  -x "(tm2html_CD)" -q
```

On Windows:
```
build\packages\app.mogan\data\bin\MoganResearch.exe -headless -b path\to\CD\tm2html_CD.scm -x "(tm2html_CD)" -q
```
This commit is contained in:
ATQlove 2024-08-01 17:35:13 +08:00 committed by GitHub
parent 4c47f5c278
commit a0d864cc6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 40 deletions

View File

@ -1,12 +1,9 @@
name: CI/CD for Converting tm format to html name: CD for Converting tm format to html
on: on:
push: push:
branches: branches:
- main - main
pull_request:
branches:
- main
jobs: jobs:
build: build:
@ -22,12 +19,12 @@ jobs:
- name: download release from mogan research repository - name: download release from mogan research repository
run: | 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 DEBIAN_FRONTEND=noninteractive apt install -y /tmp/mogan-research.deb
- name: convert document to html format - name: convert document to html format
run: | 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 # Deploy to local repo
- name: Deploy - name: Deploy
@ -35,5 +32,5 @@ jobs:
env: env:
REPO: self REPO: self
BRANCH: gh-pages BRANCH: gh-pages
FOLDER: CICD/html/planet FOLDER: CD/html/planet
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,8 +1,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; MODULE : tm2html_CICD.scm ;; MODULE : tm2html_CD.scm
;; DESCRIPTION : Convert tm format to html for CICD ;; DESCRIPTION : Convert tm format to html for CD
;; COPYRIGHT : (C) 2024 ATQlove ;; COPYRIGHT : (C) 2024 ATQlove
;; ;;
;; This software falls under the GNU general public license version 3 or later. ;; 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) (define (list-files dir)
(let* ((filtered-files (url->list (let* ((filtered-files (url->list
(url-expand (url-expand
@ -21,21 +18,12 @@
(url-append (url-descendants dir) (url-append (url-descendants dir)
(url-or (url-wildcard "*.tm") (url-or (url-wildcard "*.tm")
(url-wildcard "*.tmu"))) (url-wildcard "*.tmu")))
"fr")))) "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)))
; (display "Filtered files:\n") ; (display "Filtered files:\n")
; (for-each (lambda (file) (display (string-append (url->string file) "\n"))) filtered-files) ; (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)) (let* ((relative-path (url-delta base-dir file))
(output-file-url (url-append output-dir relative-path)) (output-file-url (url-append output-dir relative-path))
(output-file-url (url-unglue output-file-url 3)) ; Remove ".tm" or ".tmu" extension (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))) (output-dir-url (url-head html-file-url)))
; ; Debugging information; expect information are just some example ; ; 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 "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/CICD/try/2/24_10_tmhtml_test.tmu ; (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 "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 (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/CICD/html/2/24_10_tmhtml_test ; (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/CICD/html/2/24_10_tmhtml_test.html ; (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/CICD/html/2 ; (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)) (make-directory (url->string output-dir-url))
(display (string-append "Exporting " (url->string file) " to " (url->string html-file-url) "\n")) (display (string-append "Exporting " (url->string file) " to " (url->string html-file-url) "\n"))
@ -62,15 +50,11 @@
(define (export-directory dir output-dir) (define (export-directory dir output-dir)
(let* ((files (list-files dir))) (let* ((files (list-files dir)))
(for-each (lambda (file) (for-each (lambda (file)
(export-file-to-html file dir output-dir)) (export-file-to-html dir file output-dir))
files))) files)))
(tm-define (tm2html_CICD) (define (tm2html_CD)
; (url-exists? "/__w/planet/planet/jingkaimori") (let* ((current-dir (url->string (url-pwd)))
; (url-exists? "/__w/planet/planet/CICD") (output-dir (string-append current-dir "/CD/html")))
; (define filtered-files (list-files "F:/mogan/planet")) (export-directory current-dir output-dir)
; (display filtered-files) (display "Conversion from tm/tmu to html end\n")))
(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"))