aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-06-29 16:51:54 -0700
committerJeff Brown <jeffbrown@android.com>2011-06-30 12:56:39 -0700
commita049ddecd56271b06d32448c83ddfa5914e29766 (patch)
tree2de2a0cfbb596f3c5423052c3c104fc5123df426
parent8ea9d7a6ca3eadd182f2475014ad28994064f36b (diff)
downloadsource.android.com-a049ddecd56271b06d32448c83ddfa5914e29766.tar.gz
Inherit tech sidebar topic headings.
Modified the build script and sidebar template so that the sidebar can be constructed from two parts. sidebar.md provides the first part and sidebar2.md provides the second level part. Now the tech topics don't need to duplicate the main topic list in their own sidebars. Also added Mac installation instructions to the README. Change-Id: Iea6a169e00159deb9b2e78cfd5291d2ad6f17147
-rw-r--r--README8
-rwxr-xr-xscripts/build.py23
-rw-r--r--src/tech/bluetooth/sidebar.md7
-rw-r--r--src/tech/bluetooth/sidebar2.md1
-rw-r--r--src/tech/dalvik/sidebar.md10
-rw-r--r--src/tech/dalvik/sidebar2.md4
-rw-r--r--src/tech/encryption/sidebar.md9
-rw-r--r--src/tech/encryption/sidebar2.md3
-rw-r--r--src/tech/nfc/sidebar.md7
-rw-r--r--src/tech/nfc/sidebar2.md1
-rw-r--r--src/tech/sidebar.md4
-rw-r--r--templates/sidebar1
12 files changed, 37 insertions, 41 deletions
diff --git a/README b/README
index 3af3a077..cb443f04 100644
--- a/README
+++ b/README
@@ -37,9 +37,11 @@ For (Goo|U)buntu:
% sudo apt-get install python-markdown
For Mac:
-Eh, haven't tried this yet, not sure. But it should be enough to just install
-Python Markdown by hook or crook and make sure it's in your PATH.
-http://www.freewisdom.org/projects/python-markdown/
+$ sudo easy_install ElementTree
+$ sudo easy_install Markdown
+
+More information here:
+http://www.freewisdom.org/projects/python-markdown/Installation
### Contents Included in Box ###
diff --git a/scripts/build.py b/scripts/build.py
index d57762d1..8188f511 100755
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -44,6 +44,7 @@ if os.path.exists(HTML_DIR):
os.mkdir(HTML_DIR)
category = 'home'
+parents = {}
for curdir, subdirs, files in os.walk(SRC_DIR):
print 'Processing %s...' % (curdir,),
outdir = [x for x in curdir.split(os.path.sep) if x]
@@ -51,20 +52,36 @@ for curdir, subdirs, files in os.walk(SRC_DIR):
if len(outdir) == 2:
category = outdir[-1]
outdir = os.path.join(*outdir)
-
+
for subdir in subdirs:
os.mkdir(os.path.join(outdir, subdir))
+ parentdir = os.path.dirname(curdir)
+ if parentdir in parents:
+ parent = parents[parentdir]
+ else:
+ parent = ('', '')
+
if 'sidebar.md' in files:
sidebar = markdown(os.path.join(curdir, 'sidebar.md'))
del files[files.index('sidebar.md')]
else:
- sidebar = ''
+ sidebar = parent[0]
+
+ if 'sidebar2.md' in files:
+ sidebar2 = markdown(os.path.join(curdir, 'sidebar2.md'))
+ del files[files.index('sidebar2.md')]
+ else:
+ sidebar2 = parent[1]
+
+ parents[curdir] = (sidebar, sidebar2)
+
for f in files:
print ' .',
if f.endswith('.md'):
main = markdown(os.path.join(curdir, f))
- final = template.safe_substitute(main=main, sidebar=sidebar, category=category, title=get_title(os.path.join(curdir, f)))
+ final = template.safe_substitute(main=main, sidebar=sidebar, sidebar2=sidebar2, \
+ category=category, title=get_title(os.path.join(curdir, f)))
html = file(os.path.join(outdir, f.replace('.md', '.html')), 'w')
html.write(final)
diff --git a/src/tech/bluetooth/sidebar.md b/src/tech/bluetooth/sidebar.md
deleted file mode 100644
index e57e2b07..00000000
--- a/src/tech/bluetooth/sidebar.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# Topics #
-- [Dalvik](/tech/dalvik/index.html)
-- [Bluetooth](/tech/bluetooth/index.html)
-- [NFC](/tech/nfc/index.html)
-- [Encryption](/tech/encryption/index.html)
-
-# Bluetooth Topics #
diff --git a/src/tech/bluetooth/sidebar2.md b/src/tech/bluetooth/sidebar2.md
new file mode 100644
index 00000000..2075d112
--- /dev/null
+++ b/src/tech/bluetooth/sidebar2.md
@@ -0,0 +1 @@
+# Bluetooth Topics #
diff --git a/src/tech/dalvik/sidebar.md b/src/tech/dalvik/sidebar.md
deleted file mode 100644
index 2aef4f3c..00000000
--- a/src/tech/dalvik/sidebar.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# Topics #
-- [Dalvik](/tech/dalvik/index.html)
-- [Bluetooth](/tech/bluetooth/index.html)
-- [NFC](/tech/nfc/index.html)
-- [Encryption](/tech/encryption/index.html)
-
-# Dalvik Topics #
-- [Bytecode Format](dalvik-bytecode.html)
-- [.Dex Format](dex-format.html)
-- [Instruction Formats](instruction-formats.html)
diff --git a/src/tech/dalvik/sidebar2.md b/src/tech/dalvik/sidebar2.md
new file mode 100644
index 00000000..fa825b31
--- /dev/null
+++ b/src/tech/dalvik/sidebar2.md
@@ -0,0 +1,4 @@
+# Dalvik Topics #
+- [Bytecode Format](dalvik-bytecode.html)
+- [.Dex Format](dex-format.html)
+- [Instruction Formats](instruction-formats.html)
diff --git a/src/tech/encryption/sidebar.md b/src/tech/encryption/sidebar.md
deleted file mode 100644
index e1f9ad75..00000000
--- a/src/tech/encryption/sidebar.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Topics #
-- [Dalvik](/tech/dalvik/index.html)
-- [Bluetooth](/tech/bluetooth/index.html)
-- [NFC](/tech/nfc/index.html)
-- [Encryption](/tech/encryption/index.html)
-
-# Encryption Topics #
-- [Android Encryption Implementation](/tech/encryption/android_crypto_implementation.html)
-
diff --git a/src/tech/encryption/sidebar2.md b/src/tech/encryption/sidebar2.md
new file mode 100644
index 00000000..f2014144
--- /dev/null
+++ b/src/tech/encryption/sidebar2.md
@@ -0,0 +1,3 @@
+# Encryption Topics #
+- [Android Encryption Implementation](/tech/encryption/android_crypto_implementation.html)
+
diff --git a/src/tech/nfc/sidebar.md b/src/tech/nfc/sidebar.md
deleted file mode 100644
index aa51014b..00000000
--- a/src/tech/nfc/sidebar.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# Topics #
-- [Dalvik](/tech/dalvik/index.html)
-- [Bluetooth](/tech/bluetooth/index.html)
-- [NFC](/tech/nfc/index.html)
-- [Encryption](/tech/encryption/index.html)
-
-# NFC Topics #
diff --git a/src/tech/nfc/sidebar2.md b/src/tech/nfc/sidebar2.md
new file mode 100644
index 00000000..8579d808
--- /dev/null
+++ b/src/tech/nfc/sidebar2.md
@@ -0,0 +1 @@
+# NFC Topics #
diff --git a/src/tech/sidebar.md b/src/tech/sidebar.md
index 11c01b36..d1d6dbb9 100644
--- a/src/tech/sidebar.md
+++ b/src/tech/sidebar.md
@@ -1,5 +1,5 @@
# Topics #
-- [Dalvik](/tech/dalvik/index.html)
- [Bluetooth](/tech/bluetooth/index.html)
-- [NFC](/tech/nfc/index.html)
+- [Dalvik](/tech/dalvik/index.html)
- [Encryption](/tech/encryption/index.html)
+- [NFC](/tech/nfc/index.html)
diff --git a/templates/sidebar b/templates/sidebar
index a8c7b554..6b7dbe7e 100644
--- a/templates/sidebar
+++ b/templates/sidebar
@@ -1,4 +1,5 @@
<div id=sidebar>
$sidebar
+ $sidebar2
</div>