format = map pad numbered
longest = maximum (map (length . snd) numbered )
numbered = map prefix number
- number = zip3 [1..] t (map (\x -> normalize $ x ++ "-" ++ p) t)
+ number = zip3 [1..] t (map (\x -> normalize $ p ++ "-" ++ x) t)
prefix (num, desc, l) = (show num ++ ". " ++ desc ++ " ", l)
pad (lhs, rhs) = lhs ++ replicate (longest - length lhs) ' ' ++ link rhs
-- TODO: consider doing this for markdown format too
CONTENTS *foo-contents*
-1. A heading |a-heading-foo|
-2. An overlength heading when I really should have chose something shorter |an-overlength-heading-when-i-really-should-have-chose-something-shorter-foo|
+1. A heading |foo-a-heading|
+2. An overlength heading when I really should have chose something shorter |foo-an-overlength-heading-when-i-really-should-have-chose-something-shorter|
A HEADING *foo-a-heading*
CONTENTS *ferret-contents*
-1. Intro |intro-ferret|
-2. Installation |installation-ferret|
-3. Options |options-ferret|
-4. Commands |commands-ferret|
-5. Mappings |mappings-ferret|
-6. Custom autocommands |custom-autocommands-ferret|
-7. Overrides |overrides-ferret|
-8. Troubleshooting |troubleshooting-ferret|
-9. FAQ |faq-ferret|
-10. Related |related-ferret|
-11. Website |website-ferret|
-12. License |license-ferret|
-13. Development |development-ferret|
-14. Authors |authors-ferret|
-15. History |history-ferret|
+1. Intro |ferret-intro|
+2. Installation |ferret-installation|
+3. Options |ferret-options|
+4. Commands |ferret-commands|
+5. Mappings |ferret-mappings|
+6. Custom autocommands |ferret-custom-autocommands|
+7. Overrides |ferret-overrides|
+8. Troubleshooting |ferret-troubleshooting|
+9. FAQ |ferret-faq|
+10. Related |ferret-related|
+11. Website |ferret-website|
+12. License |ferret-license|
+13. Development |ferret-development|
+14. Authors |ferret-authors|
+15. History |ferret-history|
INTRO *ferret-intro*
CONTENTS *pinnacle-contents*
-1. Intro |intro-pinnacle|
-2. Installation |installation-pinnacle|
-3. Website |website-pinnacle|
-4. License |license-pinnacle|
-5. Development |development-pinnacle|
-6. Authors |authors-pinnacle|
-7. History |history-pinnacle|
+1. Intro |pinnacle-intro|
+2. Installation |pinnacle-installation|
+3. Website |pinnacle-website|
+4. License |pinnacle-license|
+5. Development |pinnacle-development|
+6. Authors |pinnacle-authors|
+7. History |pinnacle-history|
INTRO *pinnacle-intro*