define get-wordpress-article-url ;; Copyright (C) 2023-2024 Denis 'GNUtoo' Carikli ;; ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;; Input: wordpress/articles/2015_07_replicant-source-code-hosting-and-rmll-2015.html ;; Output: https://blog.replicant.us/2015/07/replicant-source-code-hosting-and-rmll-2015/ (use-modules (ice-9 regex)) ;; Input: wordpress/articles/2015_07_replicant-source-code-hosting-and-rmll-2015.html ;; Output: 2015_07_replicant-source-code-hosting-and-rmll-2015.html (define (local-filename name) (list-ref (string-split name #\/) 2)) ;; Output: 2015 (define year (car (string-split (local-filename "$@") #\_))) ;; Output: 07 (define month (cadr (string-split (local-filename "$@") #\_))) ;; Output: replicant-source-code-hosting-and-rmll-2015.html (define html-page (regexp-substitute #f (string-match "[0-9]{4}_[0-9]{2}_" "$@") 'post)) ;; Output: replicant-source-code-hosting-and-rmll-2015 (define page-path (regexp-substitute #f (string-match ".html" html-page) 'pre)) (string-append "https://blog.replicant.us/" year "/" month "/" page-path "/") endef