Skip to content

Commit

Permalink
Add a target for syncing updated help pages to www.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinh committed Jul 8, 2012
1 parent e19dec6 commit ead0575
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ $(DERIVEDDIR)/help.stamp: $(HELP_FILES)
hiutil -vg -s en -Caf $(HELP_EN)/Vico.helpindex $(HELP_EN)
touch $(DERIVEDDIR)/help.stamp

HELP_SRC = help
HELP_SRC = $(CURDIR)/help
WWW_HELP_DST = $(CURDIR)/help/www
WWW_HELP_EN = $(WWW_HELP_DST)/en
wwwhelp:
Expand All @@ -803,6 +803,9 @@ wwwhelp:
cp -rf $(HELP_SRC)/shared $(WWW_HELP_DST)
cd $(WWW_HELP_EN) && $(HELP_SRC)/md2html.www $(HELP_SRC)/*.md

syncwwwhelp: wwwhelp
rsync -avr $(WWW_HELP_DST)/ www.vicoapp.com:/var/www/vicoapp.com/help/

synchelp: help
rsync -avr $(HELP_RESDIR)/ www.vicoapp.com:/var/www/vicoapp.com/help

Expand Down
8 changes: 5 additions & 3 deletions help/md2html
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/bin/sh

MARKDOWN_PL=${MARKDOWN:-$HOME/bin/Markdown.pl}
MARKDOWN="perl $MARKDOWN_PL --html4tags"

head()
{
file=$1
title=$2

cat <<EOF
cat <<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"https://www.w3.org/TR/html4/loose.dtd">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../shared/help.css" type="text/css" media="screen">
Expand All @@ -31,7 +33,7 @@ while test -n "$1"; do
title=$(sed -n '/^# /{s///;p;q;}' "$1")
echo "converting $file with title '$title'" >&2
(head "$file" "$title"
perl $HOME/bin/Markdown.pl --html4tags "$file"
$MARKDOWN "$file"
tail)
shift
done
Expand Down
20 changes: 11 additions & 9 deletions help/md2html.www
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
#!/bin/sh

MARKDOWN_PL=${MARKDOWN:-$HOME/bin/Markdown.pl}
MARKDOWN="perl $MARKDOWN_PL --html4tags"

head()
{
file=$1
title=$2

cat <<EOF
cat <<EOF
<!--#set var="title" value="$title" -->
<!--#include file="/book/shared/head.shtml" -->
<!--#include virtual="/inc/head.shtml" -->
EOF
}

tail()
{
cat <<EOF
<!--#include file="/book/shared/tail.shtml" -->
<!--#include virtual="/inc/tail.shtml" -->
EOF
}

echo "# Index" > index.md
echo "# Help Index" > index.md
echo "" >> index.md

while test -n "$1"; do
file=$1
title=$(sed -n '/^# /{s///;p;q;}' "$1")
echo "converting $file with title '$title'" >&2
html="$(basename "${file%.*}.html")"
html="$(basename "${file%.*}.shtml")"
(head "$file" "$title"
perl $HOME/bin/Markdown.pl --html4tags "$file"
sed 's/(\([^:.]*\)\.html)/(\1.shtml)/g' "$file" | $MARKDOWN
tail) > $html
echo " * [$title]($html)" >> index.md
shift
done

(head index.md Index
perl $HOME/bin/Markdown.pl --html4tags index.md
tail) > index.html

$MARKDOWN index.md
tail) > index.shtml
1 change: 0 additions & 1 deletion help/move_lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ to that line number. For example, <kbd>10G</kbd> jumps to line number
to the first line if no count is given.

* [Movement](movement.html)

0 comments on commit ead0575

Please sign in to comment.