Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cours_prog
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
yassin.elhakoun
cours_prog
Commits
7c8bb1c4
Verified
Commit
7c8bb1c4
authored
3 years ago
by
orestis.malaspin
Browse files
Options
Downloads
Patches
Plain Diff
refactor gen_index
parent
dbe93ccf
No related branches found
Branches containing commit
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
+30
-18
30 additions, 18 deletions
slides/gen_index.sh
with
30 additions
and
18 deletions
slides/gen_index.sh
+
30
−
18
View file @
7c8bb1c4
#!/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,26 +29,17 @@ 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
[*]
}
"
)
)
...
...
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