# Simple exporter for HTML files mse version: 2.0.0 game: magic short name: Spoiler full name: List of cards installer group: magic/Export/Spoiler (list of cards) icon: preview.png create directory: true version: 2014-06-19 depends on: magic.mse-game 2008-05-18 ######################################################################################## option field: type: boolean name: include set file description: Should a link to the MSE set file be included in the spoiler? initial: no option field: type: choice name: grouping description: How should cards be grouped? choice: no grouping choice: group by color initial: group by color option field: type: choice name: images choice: no choice: just the image box, linked choice: just the image box, inline choice: full card image, linked choice: full card image, preview choice: full card image only initial: full card image, preview option field: type: boolean name: mana symbols description: Should mana symbols be used, or should they be written as text? option field: type: boolean name: rarity symbols description: Should rarity be shown using a symbol or as text? #doesn't work yet: #option field: # type: boolean # name: list keywords # description: Should the keywords be listed? #option field: # type: boolean # name: fancy scripts # description: Should fancy scripts be used option field: type: choice name: font style choice: default choice: serif choice: sans-serif option field: type: color name: background color initial: rgb(255,255,255) choice: name: white color: rgb(255,255,255) choice: name: black color: rgb(0,0,0) option field: type: color name: text color initial: rgb(0,0,0) choice: name: white color: rgb(255,255,255) choice: name: black color: rgb(0,0,0) option style: grouping: render style: both choice images: no grouping: { built_in_image("bool_no") } group by color: /magic.mse-game/stats/card_color.png images: render style: both choice images: no: { built_in_image("bool_no") } font style: render style: both choice images: serif: /magic-spoiler.mse-export-template/serif.png sans-serif: /magic-spoiler.mse-export-template/sans-serif.png script: if options.mana_symbols then ( symbol_font := "magic-mana-small" symbol_font_size := 12 ) else ( symbols_to_html := to_html ) write_card := { if contains(options.images, match:"full card image") then card_image_file := write_image_file(card, file:"card{position(of:card,in:set)}.jpg") else if contains(options.images, match:"image box") and card.image != "" then card_image_file := write_image_file(card.image, file:"card{position(of:card,in:set)}.jpg") else card_image_file := "" if options.images == "full card image, preview" then card_image_preview := write_image_file(card, file:"card-preview{position(of:card,in:set)}.jpg", height: 100) else card_image_preview := card_image_file if options.images == "full card image only" then "
  • " else "
  • {if options.images == "full card image, preview" then " { to_html(card.name ) }" else if card_image_file != "" and contains(options.images, match:"linked") then "{ to_html(card.name) }" else "{ to_html(card.name ) }" }{ symbols_to_html(card.casting_cost ) } {if card_image_file != "" and contains(options.images, match:"inline") then "" } { to_html(card.type ) } { code := if card.rarity == "" then "C" else if card.rarity == "basic land" then "L" else to_upper(card.rarity[0]) # L,C,U,R,S if options.rarity_symbols then "{code}" else code } { to_html(card.rule_text ) } { to_html( remove_tag(tag: "", card.flavor_text) ) } { to_html(card.pt ) } { to_html(card.card_number ) }
  • " } kind_of_card := { if contains(card.shape, match:"token") then "" else if contains(card.shape, match:"rulestip") then "" else if contains(card.shape, match:"counter") then "" else if contains(card.shape, match:"emblem") then "" else if contains(card.shape, match:"split") then write_card() else if contains(card.shape, match:"double faced") then write_card() else if card.name_2 != "" then write_card() else if card.loyalty != "" then write_card() else if contains(card.shape, match:"leveler") then write_card() else write_card() } write_cards := { "" } write_group := { cards := filter_list(cards, filter: { # The first character of the color_of_card code must be equal to 'code' substring(color_of_card(card:input), begin:0, end:1) == code } ) count := number_of_items(in:cards) if count > 0 then "

    {title} ({count} {if count == 1 then "card" else "cards"})

    " + write_cards() } copy_file("blank.gif") write_image_file( file: "set-symbol.png", width: 200, symbol_variation(symbol: set.symbol, variation: "rare") ) write_image_file( file: "set-icon.png", width: 16, heght: 16 symbol_variation(symbol: set.symbol, variation: "rare") ) # the html page html := " { to_html(set.title) }

    { to_html(set.title) }

    { to_html(set.description) }
    { if options.include_set_file then "
    Download set in MSE format
    " } { if options.grouping == "group by color" then # Codes as by sort_index write_group(title: "Colorless" code:"A") + write_group(title: "White", code:"B") + write_group(title: "Blue", code:"C") + write_group(title: "Black", code:"D") + write_group(title: "Red", code:"E") + write_group(title: "Green", code:"F") + write_group(title: "Multicolor", code:"G") + write_group(title: "Hybrids", code:"H") + write_group(title: "Multicolor split cards", code:"I") + write_group(title: "Colorless", code:"K") + write_group(title: "Non-basic lands", code:"L") + write_group(title: "Basic lands", code:"") else write_cards(cards: cards) } " write_text_file(html, file:"index.html") # make sure the urls are relative to the right directory replace(html, match:"<[^<>]*(href|src)='", replace:"&{directory}/")