Def D OC An extensible, dynamic document creation system By Rahul Jain

Slides:



Advertisements
Similar presentations
HTML Basics Customizing your site using the basics of HTML.
Advertisements

CS 63 LISP Philip Greenspun's Tenth* Rule of Programming:
Chapter 3 – Web Design Tables & Page Layout
Introduction to HTML & CSS
C Language.
Chapter 2 HTML Basics Key Concepts
INTRODUCTION TO HYPERTEXT MARKUP LANGUAGE 1. Outline  Introduction  Markup Languages  Editing HTML  Common Tags  Headers  Text Styling  Linking.
Today’s Goals What is HTML?
Generics "It is easy to study the rules of overloading and of templates without noticing that together they are one of the keys to elegant and efficient.
Object-Oriented Programming In Lisp. Lisp vs. Scheme 1.Lisp has much more built-in functions and special forms, the Scheme language definition takes 45.
Tutorial 6 Working with Web Forms
Using Classes Lisp also supports the Object-Oriented paradigm. The process of defining classes in Lisp is similar to how you you define structures. The.
Introduction to HTML 2006 CIS101. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
CM143 - Web Week 2 Basic HTML. Links and Image Tags.
Introduction to HTML 2006 INT197B. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Compiler Summary Mooly Sagiv html://
Introduction to HTML 2004 CIS101. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Alok Mehta - Programming in Lisp - Data Abstraction and Mapping Programming in Lisp Common Lisp Object System (CLOS)
Guide To UNIX Using Linux Third Edition
Create a Web Site with Frames
CIS101 Introduction to Computing Week 06. Agenda Your questions Excel Exam during second hour Our status after the snow day Introduction to the Internet.
Allegro CL Certification Program Lisp Programming Series Level I Session Top Ten Things to Know.
Creating a Simple Page: HTML Overview
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
Functional Programming
Creating a Basic Web Page
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
Amber Annett David Bell October 13 th, What will happen What is this business about personal web pages? Designated location of your own web page.
HTML history, Tags, Element. HTML: HyperText Markup Language Hello World Welcome to the world!
CP2022 Multimedia Internet Communication1 HTML and Hypertext The workings of the web Lecture 7.
Chapter 2 HTML Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
INTRODUCTION. What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is not a programming language,
1. Definition and General Structure 2. Small Example 1 3. Simplified Structure 4. Short Additional Examples 5. Full Example 2 6. Common Error The for loop.
JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
HTML: Hyptertext Markup Language Doman’s Sections.
1 HTML Frames
The Loop Macro Many of the CL “functions” are actually macros (let, progn, if, etc) The most complicated macro in CL is probably the Loop macro –The Loop.
Lecture 1-2CS251: Intro to AI/Lisp II “And now for something completely different…”
Introduction to LISP. Lisp Extensible: It lets you define new operators yourself Lisp programs are expressed as lisp data structures –You can write programs.
Review of objects  overview overview. Class of objects  Attributes/ methods.
SDPL 2002Notes 4: Intro to Style Sheets1 4. Introduction to Style Sheets n Discussed recently: –Programmatic manipulation of documents n Now a more human-oriented.
Intelligence Musical and Otherwise.  Huh? Huh? Webster’s definition  Intelligence:  The ability to reason.
Milos Hauskrecht (PDF) Hieu D. Vu (PPT) LISP PROGARMMING LANGUAGE.
Website design and structure. A Website is a collection of webpages that are linked together. Webpages contain text, graphics, sound and video clips.
Arrays. The array data structure Array is a collection of elements, that have the same data type Integers (int) Floating point numbers (float, double)
Basic Introduction to Lisp
XP Review 1 New Perspectives on JavaScript, Comprehensive1 Introducing HTML and XHTML Creating Web Pages with HTML.
SDPL 2004Notes 4: Intro to Style Sheets1 4. Introduction to Style Sheets n Discussed recently: –Programmatic manipulation of documents n Now a more human.
Drop-down box. Objectives Learn the HTML syntax of a drop-down list javascript properties of a list/menu: length options selectedIndex The location sub-object.
Session: 4. © Aptech Ltd. 2Creating Hyperlinks and Anchors / Session 4  Describe hyperlinks  Explain absolute and relative paths  Explain how to hyperlink.
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
HTML Overview.  Students will learn: How HTML tagging works How browsers display tagged documents How an HTML document is structured.
Tutorial #1 Using HTML to Create Web Pages. HTML, XHTML, and CSS HTML – HyperText Markup Language The tags the browser uses to define the content of the.
HTML And the Internet. HTML and the Internet ► HTML: HyperText Markup Language  Language in which all pages on the web are written  Not Really a Programming.
HTML – The COMPUTING UNLOCKED GUIDE
CSS: Cascading Style Sheets
Uppingham Community College
Allegro CL Certification Program
CLOS CSC 358/
AN INTRODUCTORY LESSON TO MAKING A SIMPLE WEB PAGE By: RC Emily Solis
TITLE TITLE TITLE TITLE
Web DB Programming: PHP
HTML – The COMPUTING UNLOCKED GUIDE
Basics of Web Design Chapter 2 HTML Basics Key Concepts
Basics of Web Design Chapter 2 HTML Basics Key Concepts
Web Programming and Design
Presentation transcript:

Def D OC An extensible, dynamic document creation system By Rahul Jain

TeX The Positives Excellent breaking algorithm Layerable macros Simple data model Nested sequences of hboxes and vboxes Lots of existing libraries

TeX The Negatives Syntax requires a lot of confusing escaping and unescaping Simple data model Info is lost quickly All data is stored in fixed-sized arrays … size is fixed at compile time!

CLOS to the Rescue! CONTENTS slot for tree structure Other slots indicate properties of document elements Mixins allow orthogonalizing concerns such as: –Wrapping –Flowing –Floating –Layout direction

Examples (defclass logical-structure-element (vertical-element vertical-container flowing-container-mixin) ()) (defclass paragraph (logical-structure-element wrapping-container-mixin) () (:documentation "A standard paragraph of text."))

More CLOS! (defclass html-output (output-destination pretty-printable-mixin) ()) (defclass plain-text-output (output-destination fixed-width-layout) ((page-width :initform (make-length 72 'em)))) (defclass pdf-output (output-destination fixed-layout) ())

Layout Engine (defgeneric prepare (input output) (:documentation "Breaks up the input into the basic elements to be laid out …")) (defgeneric convert (input output) (:documentation "Converts the input into the format specified by the output.")) Multiple Dispatch!

HTML Ouptut (defmacro define-html-conversion (type (element &optional (html-class 'html-output)) &body body) `(defmethod convert ((,element,type) (.output.,html-class)) (flet ((convert (&optional (element (contents,element))) (convert element.output.)) (convert-to-text (element) (let ((*suppress-html-tags* t)) (convert

HTML Output (define-html-conversion paragraph (input) (with-html-block (:P) (convert))) (define-html-conversion itemized-list (input) (with-html-block (:UL) (dolist (element (contents input)) (with-html-block (:LI) (convert element))))) (define-html-conversion link (input) (with-html-inline (:A :href (url input)) (convert))) (define-html-conversion discretionary-hyphen (input) (write-html-entity "shy"))

Project Website (defclass project-website (document) ((title :accessor name :initarg name :initform (error "Name is required.")) (subtitle :initarg short-description))) (defclass documentation (section) ((title :allocation :class :initform "Documentation"))) (defclass code (section) ((title :allocation :class :initform "Code"))) (defclass communication (section) ((title :allocation :class :initform "Communication"))) (defclass dependencies (section) ((title :allocation :class :initform "Dependencies")))

Project Website (defmethod convert ((input dependencies) (output t)) (convert (make-instance 'itemized-list (contents input)) output)) (defgeneric section-before-p (o1 o2)) (let ((order '(documentation code dependencies communication))) (loop for (prior. following-list) on order nconc (loop for following in following-list collect `(defmethod section-before-p ((o1,prior) (o2,following)) t) collect `(defmethod section-before-p ((o2,following) (o1,prior)) nil))))) (defmethod prepare :before ((input project-website) output) (setf (contents input) (sort (contents input) 'section-before-p)))

The DefDoc Website (defpackage :defdoc.website (:use :common-lisp :defdoc :defdoc.elements :defdoc.layout :defdoc.frontends.basic :defdoc.contrib.project-website)) (in-package :defdoc.website) Starts off looking a lot like lisp code!

The DefDoc Website (defabbreviation DefDoc (doc italic () "Def") (doc small-caps () "Doc")) (defabbreviation LaTeX "LaTeX") Abstraction is a beautiful thing!

The DefDoc Website (defun gen-src-link (target) (concatenate 'string "/cgi-bin/viewcvs.cgi/DefDoc/src" target "?cvsroot=defdoc" (unless (eql (aref target (1- (length target))) #\/) "&rev=HEAD&content-type=text/vnd.viewcvs-markup"))) (defun gen-mailing-list-link (target) (concatenate 'string "/mailman/listinfo/defdoc-" target)) Defun, huh.

The DefDoc Website (defdoc index (project-website name (doc DefDoc) short-description "…" author "Rahul Jain") Note the class name and initargs

The DefDoc Website (documentation () (paragraph () "I have written up a document that is an overview“ "of the goals and rationale behind "(DefDoc)". " "It is available as " (link (url "overview.tex") (LaTeX))", " (link (url "overview.pdf") "PDF")", and " (link (url "overview.ps") "Postscript")".")) Note the usage of the abbreviations

The DefDoc Website (code () (paragraph () "The code is very incomplete, but what there is is " (link (url (gen-src-link "/")) "publically available")". " "There are definitions for various types of " (link (url (gen-src-link "/elements/")) "document elements")". " "There are also definitions for the abstract types of " (link (url (gen-src-link "/layout/")) "layout engines") " as well as the " (link (url (gen-src-link "/layout/html-engine.lisp")) " HTML layout engine")". " "Finally, there is a " (link (url (gen-src-link "/frontends/basic/")) "basic frontend")", " "essentially a few simple macros for creating "(DefDoc)" documents. " "A more fully-featured frontend is planned, which will be " "sensitive to the current context and allow texual content " "to be entered unquoted.") ; Ugh, that last sentence says it all… (paragraph () "This site is actually a "(DefDoc)" " (link (url (gen-src-link "/../website/website.lisp")) "document")"."))

The DefDoc Website (dependencies () (link (url " ") "Specified types")) (communication () (paragraph () "There are 3 mailing lists for "(DefDoc)", " (link (url (gen-mailing-list-link "announce")) "defdoc-announce")", " (link (url (gen-mailing-list-link "devel")) "defdoc-devel")", and " (link (url (gen-mailing-list-link "cvs")) "defdoc-cvs")".")))