Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
docs.it4i.cz
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
David Ciz
docs.it4i.cz
Commits
9a0dfe83
Commit
9a0dfe83
authored
8 years ago
by
Lukáš Krupčík
Browse files
Options
Downloads
Patches
Plain Diff
Update html_md.sh
parent
9e6c4e47
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
html_md.sh
+14
-17
14 additions, 17 deletions
html_md.sh
with
14 additions
and
17 deletions
html_md.sh
+
14
−
17
View file @
9a0dfe83
...
...
@@ -84,12 +84,12 @@ if [ "$1" = "-c" ]; then
echo
"
$i
"
;
printf
"
\t\t
filtering html files...
\n
"
;
HEAD
=
$(
cat
"
$i
"
|
grep
-n
-m1
'<h1'
|cut
-f1
-d
: |
tr
--delete
'\n'
)
END
=
$(
cat
"
$i
"
|
grep
-n
-m1
'<!-- <div tal:content='
|cut
-f1
-d
: |
tr
--delete
'\n'
)
LAST
=
$(
cat
"
$i
"
|
wc
-l
|
tr
--delete
'\n
'
)
HEAD
=
$(
grep
-n
-m1
'<h1'
"
$i
"
|cut
-f1
-d
: |
tr
--delete
'\n'
)
END
=
$(
grep
-n
-m1
'<!-- <div tal:content='
"
$i
"
|cut
-f1
-d
: |
tr
--delete
'\n'
)
LAST
=
$(
wc
-l
"
$i
"
|
cut
-f1
-d
'
'
)
DOWN
=
$((
LAST-END+2
))
cat
"
$i
"
|
sed
'1,'
"
$((
HEAD-1
))
"
'd'
|
sed
-n
-e
:a
-e
'1,'
"
$DOWN
"
'!{P;N;D;};N;ba'
>
"
${
i
%.*
}
TMP.html"
sed
'1,'
"
$((
HEAD-1
))
"
'd'
"
$i
"
|
sed
-n
-e
:a
-e
'1,'
"
$DOWN
"
'!{P;N;D;};N;ba'
>
"
${
i
%.*
}
TMP.html"
# converted .html to .md
printf
"
\t\t
.html -> .md
\n
"
...
...
@@ -100,36 +100,33 @@ if [ "$1" = "-c" ]; then
echo
"
${
i
%.*
}
"
>>
./info/files_md.txt
;
# create filter_auto
cat
"
${
i
%.*
}
.md"
|
grep
-o
-P
'(?<={).*(?=})'
|
sort
-u
|
sed
'/{/d'
|
sed
'/\$/d'
>>
filter_auto
;
grep
-o
-P
'(?<={).*(?=})'
"
${
i
%.*
}
.md"
|
sort
-u
|
sed
'/{/d'
|
sed
'/\$/d'
>>
filter_auto
;
sort
-u
filter_auto
-o
filter_auto
;
# exceptions filter_auto
cat
exceptions_filter_auto |
while
read
y
;
(
while
read
y
;
do
# search and delete according with filter_auto
cat
filter_auto |
sed
-e
's/'
"
$y
"
'//g'
>
filter_autoTMP
;
sed
-e
's/'
"
$y
"
'//g'
filter_auto
>
filter_autoTMP
;
cat
filter_autoTMP
>
filter_auto
;
done
done
)
< exceptions_filter_auto
# text filtering of html, css, ...
printf
"
\t\t
automatic filter...
\n
"
cat
filter_auto |
while
read
y
;
(
while
read
y
;
do
# search and delete according with filter_auto
cat
"
${
i
%.*
}
.md"
|
sed
-e
's/{'
"
$y
"
'}//g'
|
sed
-e
's/\\//g'
|
sed
-e
's/^Q//g'
|
sed
-e
's/: //g'
|
sed
-e
's/<\/div>//g'
|
sed
'/^<div/d'
|
awk
-v
RS
=
'\n\n\n\n\n'
1
>
"
${
i
%.*
}
TMP.md"
;
sed
-e
's/{'
"
$y
"
'}//g'
"
${
i
%.*
}
.md"
|
sed
-e
's/\\//g'
|
sed
-e
's/^Q//g'
|
sed
-e
's/: //g'
|
sed
-e
's/<\/div>//g'
|
sed
'/^<div/d'
|
awk
-v
RS
=
'\n\n\n\n\n'
1
>
"
${
i
%.*
}
TMP.md"
;
cat
"
${
i
%.*
}
TMP.md"
>
"
${
i
%.*
}
.md"
;
done
done
)
< filter_auto
printf
"
\t\t
other filter...
\n
"
cat
filter_other |
while
read
a
;
(
while
read
a
;
do
# search and delete according with filter_other
cat
"
${
i
%.*
}
.md"
|
sed
-e
's/'
"
$a
"
'//g'
>
"
${
i
%.*
}
TMP.md"
;
sed
-e
's/'
"
$a
"
'//g'
"
${
i
%.*
}
.md"
>
"
${
i
%.*
}
TMP.md"
;
cat
"
${
i
%.*
}
TMP.md"
>
"
${
i
%.*
}
.md"
;
done
done
)
< filter_other
# delete temporary files
rm
"
${
i
%.*
}
TMP.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