The Better Markup Language

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in in the section entitled “Appendix B, GNU Free Documentation License”.

Abstract

Anybody who's ever put together a large website or done a lot of server-side programming will know how hard and annoying it is to keep a consistent look through a site, and how painful it is to go back and change something globally later, once their site is up. In addition, looking at HTML code is ugly and HTML editors don't always do what you want them to.

BML was designed to address a lot of these problems. BML is a server-side markup language that lets you define your own BML blocks and use them as templates within your BML pages. Your templates don't even have to be static. Because BML pages are converted to HTML on the server when users request them, this also enables you to embed live code within your BML pages, just like a CGI script.

A lot is possible using BML. Whether you want to make a full blown database driven website, enable a little dynamic content on your site, or just make things on your site easier to maintain, BML can really help out.

The official website for BML is located at http://danga.com/bml/[o].

BML can be checked out from its SVN repository using: svn co http://code.livejournal.org/svn/bml


Table of Contents

Preface
1. A Brief Tutorial
1. Introducing BML
1.1. Blocks
1.2. BML Files
2. Block Parameters
2.1. The DATA Block Parameter
2.2. Block Flags and Passing Multiple Parameters
2.3. Parameterized Output: Positional Parameters
3. Static Blocks
3.1. Fully-Static Blocks
3.2. Semi-static Blocks
4. A Full Example
2. BML Block Types
3. Core BML blocks
I. API Documentation
BML::self_link — Takes the URI of the current page, and adds the current form data to the URL, then adds any additional data to the URL.
BML::set_status — Takes a number to indicate a status (e.g. 404, 403, 410, 500, etc.) and sets that to be returned to the client when the request finishes.

List of Examples

1.1. BML lookup file
1.2. BML file
1.3. Output
1.4. Lookup file with DATA blocks
1.5. BML file using parameterized blocks
1.6. Parameterized Output: Named Parameters
1.7. Alternate Heading Block
1.8. Block Definitions with Flags
1.9. BML file
1.10. Example output
1.11. Block Definitions with Positional Parameters
1.12. BML file using the “listlist” and “linkitem” blocks
1.13. Example output
1.14. Look file with {S} block
1.15. BML file that calls the static block
1.16. Example output
1.17. Look file with {R} block
1.18. BML file
1.19. Example output