! Copyright (C) 2008 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. USING: accessors html.elements io io.streams.string kernel namespaces semantic-db sequences strings tangle.path ; IN: tangle.html TUPLE: element attributes ; TUPLE: ulist < element items ; : ( items -- element ) H{ } clone swap ulist boa ; TUPLE: link < element href text ; : ( href text -- element ) H{ } clone -rot link boa ; GENERIC: >html ( element -- str ) M: string >html ( str -- str ) ; M: link >html ( link -- str ) [ > =href a> text>> write ] with-string-writer ; M: node >html ( node -- str ) dup node>path [ swap node-content >html ] [ node-content ] if* ; M: ulist >html ( ulist -- str ) [ ] with-string-writer ;