/usr/share/tdiary/contrib/plugin/microsummary.rb is in tdiary-contrib 5.0.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # microsummary.rb
#
# Copyright (c) 2006 elytsllams <smallstyle@gmail.com>
# Distributed under the GPL
#
add_header_proc do
generator_xml = @conf['generator.xml']
if generator_xml != nil and @mode == 'latest' and !@cgi.valid?( 'date' )
%Q|\t<link rel="microsummary" href="#{generator_xml}" type="application/x.microsummary+xml">\n|
end
end
def create_xml file_name
xml = <<-XML
<?xml version="1.0" encoding="UTF-8"?>
<generator xmlns="http://www.mozilla.org/microsummaries/0.1"
name="tDiary Entry Title">
<template>
<transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">
<output method="text"/>
<template match="/">
<value-of select="html/head/title"/>
<choose>
<when test="boolean(descendant::div[attribute::class='body'][1]/div[attribute::class='section'][last()]/h3)">
<text> - </text>
<value-of select="descendant::div[attribute::class='body'][1]/div[attribute::class='section'][last()]/h3"/>
</when>
<when test="boolean(descendant::div[attribute::class='day'][1]/h2)">
<text> - </text>
<value-of select="descendant::div[attribute::class='day'][1]/h2"/>
</when>
</choose>
</template>
</transform>
</template>
<update interval="240"/>
<pages>
<include>^#{@conf.base_url.gsub(/\./, '\\.')}$</include>
</pages>
</generator>
XML
begin
File::open( file_name, 'w' ) do |f|
f.print to_utf8( xml )
end
rescue
end
end
def microsummary_init
@conf['generator.xml'] ||= ""
create_xml( @conf['generator.xml'] ) unless File::exists? @conf['generator.xml']
end
if @mode == 'saveconf'
def saveconf_microsummary
@conf['generator.xml'] = @cgi.params['generator.xml'][0]
end
end
|