mirror of
https://github.com/moparisthebest/rswiki-book
synced 2024-11-21 16:45:01 -05:00
Create MediaWiki page 'Home'
This commit is contained in:
commit
b928dbe13a
2
Categories.mediawiki
Normal file
2
Categories.mediawiki
Normal file
@ -0,0 +1,2 @@
|
||||
<!-- DO NOT EDIT THIS FILE, CODE AUTOMATICALLY GENERATED BY category.sh -->
|
||||
The following categories contain pages or media.
|
8
Home.mediawiki
Normal file
8
Home.mediawiki
Normal file
@ -0,0 +1,8 @@
|
||||
'''MediaWiki has been successfully installed.'''
|
||||
|
||||
Consult the [http://meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software.
|
||||
|
||||
== Getting started ==
|
||||
* [http://www.mediawiki.org/wiki/Manual:Configuration_settings Configuration settings list]
|
||||
* [http://www.mediawiki.org/wiki/Manual:FAQ MediaWiki FAQ]
|
||||
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki release mailing list]
|
52
category.sh
Executable file
52
category.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
function prepareFile(){
|
||||
path="$1"
|
||||
tmp_path="$(basename "$path").tmp"
|
||||
(
|
||||
grep 'CODE AUTOMATICALLY GENERATED BY category.sh -->' "$path" &>/dev/null
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
sed -n '/CODE AUTOMATICALLY GENERATED BY category.sh -->/q;p' "$path"
|
||||
else
|
||||
cat "$path" && echo
|
||||
fi
|
||||
echo -e '<!-- DO NOT EDIT BELOW THIS LINE, OR CHANGE THIS COMMENT, CODE AUTOMATICALLY GENERATED BY category.sh -->'
|
||||
) > "$tmp_path"
|
||||
echo "$tmp_path"
|
||||
}
|
||||
|
||||
function finishFile(){
|
||||
path="$1"
|
||||
tmp_path="$(basename "$path").tmp"
|
||||
mv "$tmp_path" "$path"
|
||||
}
|
||||
|
||||
files_lines_categories="$(grep '^\[\[Category [^]./\]*\]\]$' *)"
|
||||
#echo "files_lines_categories: $files_lines_categories"
|
||||
|
||||
echo '<!-- DO NOT EDIT THIS FILE, CODE AUTOMATICALLY GENERATED BY category.sh -->' > Categories.mediawiki
|
||||
echo 'The following categories contain pages or media.' >> Categories.mediawiki
|
||||
|
||||
echo "$files_lines_categories" | grep -o 'Category [^]]*' | sort | uniq | while read category
|
||||
do
|
||||
#echo "category: $category"
|
||||
|
||||
category_file="$(echo "$category" | sed 's/ /-/g').mediawiki"
|
||||
echo "category_file: $category_file"
|
||||
|
||||
result="$(prepareFile "$category_file")"
|
||||
echo "== '''Pages in category \"$(echo $category | sed 's/Category //')\"''' ==" >> "$result"
|
||||
files="$(echo "$files_lines_categories" | grep ":\[\[${category}\]\]$" | sort)"
|
||||
num_pages="$(echo "$files" | wc -l)"
|
||||
|
||||
echo -e "* [[$category]] ($num_pages members)" >> Categories.mediawiki
|
||||
|
||||
echo "The following $num_pages pages are in this category." >> "$result"
|
||||
echo "$files" | while read file
|
||||
do
|
||||
echo "* [[$(echo $file | sed -e "s/\.mediawiki:\[\[${category}\]\]$//" -e 's/-/ /g')]]"
|
||||
done >> "$result"
|
||||
finishFile "$category_file"
|
||||
done
|
Loading…
Reference in New Issue
Block a user