Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr-ressources
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Learning Lab
mooc-rr-ressources
Commits
d96f0eae
You need to sign in or sign up before continuing.
Commit
d96f0eae
authored
Mar 22, 2019
by
Arnaud Legrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Have a single script to handle both org and md conversion
parent
42a2a7dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
25 deletions
+35
-25
.gitlab-ci.yml
.gitlab-ci.yml
+6
-10
pandoc_fixer.pl
bin/pandoc_fixer.pl
+29
-15
No files found.
.gitlab-ci.yml
View file @
d96f0eae
...
...
@@ -3,19 +3,15 @@ pages:
stage
:
deploy
script
:
-
pandoc --version
-
pandoc --help
#
- 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 gfm -t html -o ${file%.*}.html $file && echo "Exported ${file%.*}.html" && echo "<li><a href='https://learninglab.gitlabpages.inria.fr/mooc-rr/mooc-rr-ressources/${file%.*}.html'>${file%.*}.html</a></li>" >> index.html || echo "ERROR $file"
;
bin/pandoc_fixer.pl ${file} > ${file}.new;
mv ${file
}.new ${file%.*}.html;
-
for file in $(find -name "*.md")
$(find -name "*.org")
; do
bin/pandoc_fixer.pl ${file}
;
mkdir -p public/`dirname ${file}`
mv ${file
%.*}.html public/`dirname ${file}`
done
# The next part is broken because pandoc is way too old on this image :(
# - for file in $(find -name "*.org"); do
# pandoc -s -f org -t html -o ${file%.*}.html $file && echo "Exported ${file%.*}.html" || echo "ERROR $file";
# done
-
shopt -s extglob
-
mv !(public) public
#
- mv !(public) public
artifacts
:
paths
:
-
public
...
...
bin/pandoc_fixer.pl
View file @
d96f0eae
#!/usr/bin/perl -w
use
strict
;
if
(
$#ARGV
!=
0
)
{
die
"Usage: pandox_fixer.pl input.md"
;
}
my
(
$usage
)
=
"Usage: pandox_fixer.pl input.md"
;
(
$#ARGV
==
0
)
or
die
$usage
;
my
(
$input
)
=
shift
(
@ARGV
);
if
(
!
(
$input
=~
/.md$/
))
{
die
"Usage: pandox_fixer.pl input.md"
;
}
my
(
$line
);
########### Git date #################
my
(
$gitdate
)
=
`git log $input | grep Date | head -n 1`
;
chomp
(
$gitdate
);
$gitdate
=~
s/Date: *//g
;
$gitdate
=~
s/\s*\+.*$//g
;
$input
=~
s/.md/.html/
;
########### Input file ###############
my
(
$type
)
=
""
;
my
(
$output
)
=
$input
;
if
(
$input
=~
/.md$/
)
{
$type
=
"gfm"
;
$output
=~
s/.md$/.html/
;
}
elsif
(
$input
=~
/.org$/
)
{
$type
=
"org"
;
$output
=~
s/.org$/.html/
;
}
else
{
die
"Usage: pandox_fixer.pl input.md"
;
}
my
(
$output_temp
)
=
$output
.
"tmp"
;
open
INPUT
,
$input
or
die
;
########### URL Fixing ###############
my
(
$input_path
)
=
$input
;
$input_path
=~
s
|
/[^/
]
*
$|
|
g
;
# print $input."\n\n";
my
(
$url_path
)
=
"https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/raw/master/"
.
$input_path
;
my
(
$gitlab_origin
)
=
"https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/"
;
while
(
defined
(
$line
=<
INPUT
>
))
{
########### Pandoc #################
print
"Exporting $input\n"
;
my
(
$pandoc_output
)
=
`LANG=C ; pandoc -s -f $type -t html -o $output_temp $input`
;
open
INPUT
,
$output_temp
or
die
;
open
OUTPUT
,
"> "
.
$output
or
die
;
while
(
defined
(
my
$line
=<
INPUT
>
))
{
# $line =~ s|https://gitlab.inria.fr/learninglab/|https://learninglab.gitlabpages.inria.fr/|g; ## Not such a good idea!
if
(
$input
=~
/_fr.html/
)
{
$line
=~
s
|<
body
>|<
body
>
Les
<
a
href
=
'$gitlab_origin/$input'
>
sources
de
ce
document
sont
disponibles
sur
gitlab
</
a
>.|
g
;
...
...
@@ -48,6 +62,6 @@ while(defined($line=<INPUT>)) {
# $line = "\t".$line;
# }
if
(
$line
=~
/<p>AUTHOR:/
)
{
next
;
}
print
$line
;
print
OUTPUT
$line
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment