diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8d62c03acd28b2d6c3c4e813733b66a5d1f986b8..0b14a4da9d66350d49409d5d3994fcd42cd130f4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,12 +6,9 @@ pages: - pandoc --help # - pandoc --list-input-formats # Broken as pandoc dates from 2013 on this image! :( - for file in $(find -name "*.md"); do - pandoc -s -f markdown_github -t html -o ${file%.*}.html $file && echo "Exported ${file%.*}.html" && echo "
  • ${file%.*}.html
  • " >> index.html || echo "ERROR $file"; - sed -i 's|https://gitlab.inria.fr/learninglab/|https://learninglab.gitlabpages.inria.fr/|g' ${file%.*}.html; - sed -i "s||The original version of this document is available on gitlab.|g" ${file%.*}.html; - sed -i "s|\-\-\-

    |
    |g" ${file%.*}.html; - sed -i "s|

    TITLE:\(.*\)TITLE:\1Date\1${file%.*}.html" >> index.html || echo "ERROR $file"; + bin/pandoc_fixer.pl ${file} > ${file}.new; + mv ${file}.new ${file}; done # The next part is broken because pandoc is way too old on this image :( # - for file in $(find -name "*.org"); do diff --git a/bin/pandoc_fixer.pl b/bin/pandoc_fixer.pl new file mode 100755 index 0000000000000000000000000000000000000000..d6eb18718a38632ac6e874b25d6e0a70b9b20c53 --- /dev/null +++ b/bin/pandoc_fixer.pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl -w +use strict; + +if($#ARGV!=0) { + die "Usage: pandox_fixer.pl input.md"; +} +my($input)=shift(@ARGV); +if(!($input =~ /.md$/)) { + die "Usage: pandox_fixer.pl input.md"; +} +my($line); + +my($gitdate)=`git log $input | grep Date | head -n 1`; +chomp($gitdate); +$gitdate =~ s/Date: *//g; +$gitdate =~ s/\s*\+.*$//g; + + +$input =~ s/.md/.html/; + +open INPUT, $input or die; + +while(defined($line=)) { + $line =~ s|https://gitlab.inria.fr/learninglab/|https://learninglab.gitlabpages.inria.fr/|g; ## Not such a good idea! + if($input=~ /_fr.html/) { + $line =~ s||Les sources de ce document sont disponibles sur gitlab.|g; + } else { + $line =~ s||The source of this this document is available on gitlab.|g; + } + $line =~ s|---

    |
    |g; + $line =~ s|Date:.*Date: $gitdateTITLE:\(.*\)TITLE:$1