Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cours
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
joachim.bach
cours
Commits
f666c782
Verified
Commit
f666c782
authored
3 years ago
by
orestis.malaspin
Browse files
Options
Downloads
Patches
Plain Diff
added gen_index
parent
73e3a9ff
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
slides/gen_index.sh
+33
-21
33 additions, 21 deletions
slides/gen_index.sh
with
33 additions
and
21 deletions
slides/gen_index.sh
+
33
−
21
View file @
f666c782
#!/bin/bash
set
-e
function
get_info
()
{
local
field
=
$(
echo
"
$fullName
"
|
sed
"
$2q
;d"
$1
)
;
IFS
=
$3
;
local
field
=(
$field
)
;
if
[
"
${
field
}
"
!=
$5
]
;
then
return
1
fi
local
field
=
${
field
[1]
}
;
IFS
=
$4
;
local
field
=(
$field
)
;
local
field
=
${
field
[1]
}
;
echo
"
$field
"
}
function
fail
()
{
printf
'%s\n'
"
$1
"
>
&2
## Send message to stderr.
exit
"
${
2
-1
}
"
## Return a code specified by $2, or 1 by default.
}
OIFS
=
$IFS
NUM_LINE
=
2
PREFIX
=
""
...
...
@@ -8,36 +29,27 @@ PREFIX=""
classes
=()
for
i
in
*
.md
;
do
[
-f
"
$i
"
]
||
break
comp
=
$(
echo
"
$fullName
"
|
sed
"
${
NUM_LINE
}
q;d"
$i
)
date
=
$(
echo
"
$fullName
"
|
sed
"3q;d"
$i
)
IFS
=
':'
comp
=(
$comp
)
;
comp
=
${
comp
[1]
}
date
=(
$date
)
;
date
=
${
date
[1]
}
# echo $comp
IFS
=
'"'
comp
=(
$comp
)
comp
=
${
comp
[1]
}
date
=(
$date
)
;
date
=
${
date
[1]
}
# echo $comp | awk '{ print substr( $0, 1, length($0)-1 ) }'
# echo $comp
# date=sed "${NUM_LINE}q;d" $i
date
=
"
$(
get_info
$i
3
":"
'"'
"date"
)
"
if
[
"
$date
"
==
1
]
;
then
fail
"Error date field not found"
fi
comp
=
"
$(
get_info
$i
2
":"
'"'
"title"
)
"
if
[
"
$comp
"
==
1
]
;
then
fail
"Error title field not found"
fi
i
=
"
${
i
%.*
}
"
class
=
"[
${
date
}
${
comp
}
](
${
PREFIX
}${
i
}
.pdf)"
classes+
=(
$class
)
# echo "[${date} ${comp}](${PREFIX}${i}.pdf)" >> index.md
classes+
=(
"
$class
"
)
done
IFS
=
$'
\n
'
classes
=(
$(
sort
<<<
"
${
classes
[*]
}
"
)
)
date
=
$(
date
'+%Y-%m-%d'
)
echo
"---"
>>
index.md
echo
"title: Slides du cours d'
A
lgorithmique"
>>
index.md
echo
"date:
${
date
}
"
>>
index.md
echo
"title:
\"
Slides du cours d'
a
lgorithmique
\"
"
>>
index.md
echo
"date:
\"
${
date
}
\"
"
>>
index.md
echo
"---"
>>
index.md
echo
""
>>
index.md
echo
"# Tous les slides du cours d'
A
lgorithmique"
>>
index.md
echo
"# Tous les slides du cours d'
a
lgorithmique"
>>
index.md
echo
""
>>
index.md
for
i
in
${
classes
[*]
}
;
do
echo
"*
$i
"
>>
index.md
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment