国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 網(wǎng)絡(luò)通信 > 正文

在HTML中使用DC元數(shù)據(jù)

2019-11-04 10:50:09
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

本備忘錄狀態(tài)
本備忘錄為Internet社區(qū)提供一些信息,但沒(méi)有規(guī)定任何Internet標(biāo)準(zhǔn)。本備忘錄的發(fā)布不受限制
版權(quán)信息
Copyright (C) The Internet Society (1999)。版權(quán)所有。
目錄
1. 摘要 1
2. Html、Dublin核心元數(shù)據(jù)及其他原數(shù)據(jù) 1
3.META標(biāo)簽 2
4、LINK標(biāo)簽 2
5、編碼建議 3
6、DC元數(shù)據(jù)的實(shí)際應(yīng)用 4
7、DC元素編碼 4
8、安全性問(wèn)題 10
9、附錄——處理用META標(biāo)簽編碼的元數(shù)據(jù)的Perl腳本程序 10
10. 作者地址 15
11、參考資料 15
12、版權(quán)聲明 17

1. 摘要
Dublin核心元數(shù)據(jù) [DC1]是描述信息資源的小的元數(shù)據(jù)元素集合,本文討論如何在HTML文檔[HTML4.0]中通過(guò)META和LINK標(biāo)簽表示這些元素。嵌入HTML的元數(shù)據(jù)用于描述文檔本身的信息。本文通過(guò)一些例子說(shuō)明了如何用現(xiàn)有的軟件來(lái)檢索、顯示和處理這些元數(shù)據(jù),軟件包括附錄中列出的[SWISH-E]、[freeWAIS-sf2.0]、[GLIMPSE]、 [HARVEST]、 [ISEARCH]以及Perl[PERL]腳本語(yǔ)言等。
2. HTML、Dublin核心元數(shù)據(jù)及其他原數(shù)據(jù)
[DCHOME]發(fā)起的Dublin核心元數(shù)據(jù)推出了一組少量的資源描述類(lèi)別DC1,或者叫元數(shù)據(jù)元素(從字面上看就是關(guān)于數(shù)據(jù)的數(shù)據(jù))。一般而言,元數(shù)據(jù)元素相對(duì)它們所描述的資源要小得多,而且假如資源格式支持可以把元數(shù)據(jù)嵌入到資源中。支持嵌入元數(shù)據(jù)的有兩類(lèi)資源:超文本標(biāo)記語(yǔ)言(HTML)與擴(kuò)展標(biāo)記語(yǔ)言(xml)。HTML已經(jīng)得到了廣泛的應(yīng)用,但是一旦標(biāo)準(zhǔn)化,XML與資源描述框架(RDF)一起有望提供對(duì)源數(shù)據(jù)進(jìn)行編碼的更有效的方式。RDF規(guī)范實(shí)際上描述了在HTML文檔中按照一種簡(jiǎn)潔語(yǔ)法應(yīng)用RDF的方法。
本文講述了如何在HTML4.0中對(duì)元數(shù)據(jù)進(jìn)行編碼,這些元數(shù)據(jù)元素的語(yǔ)義在其他文檔中定義。為了方便說(shuō)明,文中提及了某些元數(shù)據(jù)的語(yǔ)義,但不應(yīng)把這些語(yǔ)義看作是定義性的。
HTML編碼答應(yīng)DC元數(shù)據(jù)元素與其它元素混合使用(前提是那些元素的用法支持混合使用)。DC元素使用前綴“DC”標(biāo)記,其他元素則使用另外的標(biāo)記,比方說(shuō)AC表示來(lái)自A-Core[AC]的元素。
3.META標(biāo)簽
HTML中的META標(biāo)簽用于已經(jīng)命名的元數(shù)據(jù)元素進(jìn)行編碼,每個(gè)元素描述了文檔或者其他信息資源的一個(gè)方面。比方說(shuō) ,這個(gè)元素說(shuō)明創(chuàng)作者是Homer Simpson,其中Creator是DC元素集中定義的一個(gè)元素。更一般的形式為:
content = "ELEMENT_VALUE">
大寫(xiě)部分表示在應(yīng)用時(shí)要換成真正的標(biāo)記符,在上面的例子中,ELEMENT_NAME是Creator, ELEMENT_VALUE是Simpson, Homer而PREFIX則是DC。
在META標(biāo)簽中,DC元素名的第一個(gè)字母要大寫(xiě),但對(duì)元素值的大小寫(xiě)沒(méi)有要求,也沒(méi)有限制同時(shí)出現(xiàn)的META元素的個(gè)數(shù)與順序。同一個(gè)DC元素可以出現(xiàn)多次,每個(gè)DC元素都是可選的。下面的例子是對(duì)一本書(shū)的說(shuō)明,它有兩位作者、兩個(gè)標(biāo)題:
content = "The Communist Manifesto">
content = "Marx, K.">

content = "Engels, F.">
content = "Capital">
使用META編碼的所有DC元素都帶有“DC”前綴,與后面的元素名之間用點(diǎn)號(hào)(“.”)隔開(kāi)。每個(gè)非DC元素的編碼都應(yīng)該有相應(yīng)的前綴以便于跟蹤其來(lái)源和定義,前綴與元素定義之間的聯(lián)系通過(guò)LINK元素來(lái)完成,參閱下一節(jié)的說(shuō)明。非DC元素,比如來(lái)自AC的Email可以與DC元素混合使用:
content = "Da Costa, José">
content = "dacostaj@peoplesmail.org">
content = "Jesse "The Body" Ventura--A Biography">
這個(gè)例子還說(shuō)明了非凡字符的編碼,第一個(gè)元素作者名中使用HTML字符實(shí)體引用表示一個(gè)音標(biāo)符號(hào)——帶有重音號(hào)的字母E。類(lèi)似的,最后一行中有兩個(gè)雙引號(hào)使用的是數(shù)字字符引用,以便于元素內(nèi)容分隔符區(qū)別開(kāi)。
4、LINK標(biāo)簽
HTML的LINK可以把元素名前綴與元素的參考定義關(guān)聯(lián)在一起。假如沒(méi)有LINK標(biāo)簽與相應(yīng)的定義文檔關(guān)聯(lián),只有META標(biāo)簽描述的資源是不完整的。前面的例子再加上以下兩個(gè)元素就可以認(rèn)為是完整的了:
>
>
一般來(lái)說(shuō)這種聯(lián)系通常采用如下的形式:

其中的PREFIX要代換為實(shí)際使用的前綴,LOCATION_OF_DEFINITION則是定義文檔的URL或URN。嵌入在HTML文檔HEAD部分的LINK和META序列,描述的是該HTML文檔自身的信息。下面是帶有描述信息的一個(gè)完整的HTML文檔。



>
content = "A Dirge">
content = "Shelley, Percy Bysshe">
content = "poem">
content = "1820">
content = "text/html">
content = "en">


Rough wind, that moanest loud
Grief too sad for song;
Wild wind, when sullen cloud
Knells all the night long;
Sad storm, whose tears are vain,
Bare woods, whose branches strain,
Deep caves and dreary main, -
Wail, for the world's wrong!


5、編碼建議
與這里推薦的元數(shù)據(jù)編碼方式相比,在原理上和實(shí)際應(yīng)用中HTML對(duì)元數(shù)據(jù)編碼的要求更加寬松,不過(guò)稍加限制更有助于元數(shù)據(jù)解碼和處理軟件的開(kāi)發(fā)。在目前的發(fā)展階段,一些簡(jiǎn)單的原型和試驗(yàn)促進(jìn)了實(shí)用標(biāo)準(zhǔn)的開(kāi)發(fā)。
因此最好按照本文以下所舉例子的標(biāo)記方法在HTML中書(shū)寫(xiě)元數(shù)據(jù):前綴及元素名用大寫(xiě)、屬性值用雙引號(hào)括起來(lái),一行中最多只有一個(gè)META元素。當(dāng)然實(shí)際編寫(xiě)元數(shù)據(jù)代碼的伸縮性很大,不過(guò)選擇并始終堅(jiān)持這種風(fēng)格似乎更有助于元數(shù)據(jù)的處理與編輯。下面的三個(gè)標(biāo)簽都符合上面的建議,內(nèi)容也相同但是書(shū)寫(xiě)風(fēng)格不一致:
CONTENT="text/html; 12 Kbytes">
Content = "text/html; 12 Kbytes"
Name = "DC.Format"
>

按照上述建議編碼有助于使元數(shù)據(jù)被一些廣泛使用的免費(fèi)軟件包所接受、檢索和處理,比如[SWISH-E]、[freeWAIS-sf2.0]、[GLIMPSE]、[HARVEST]和[ISEARCH]。這些約定還可以與附錄中的腳本,以及[DCHOME]網(wǎng)站上的大部分[DCPROJECTS]應(yīng)用程序協(xié)同工作。支持LINK標(biāo)簽和修飾符約定(下一節(jié))的軟件現(xiàn)在還不多。
元數(shù)據(jù)元素的順序一般是不固定的。檢索并顯示元數(shù)據(jù)的軟件的開(kāi)發(fā)者應(yīng)該盡量保持同名的META標(biāo)簽元素的相對(duì)順序(比方說(shuō)多個(gè)文檔作者),但是假如通過(guò)不明系統(tǒng)傳輸,元數(shù)據(jù)的提供者與檢索程序并不能保證元數(shù)據(jù)的先后順序保持不變。
6、DC元數(shù)據(jù)的實(shí)際應(yīng)用
在實(shí)際用與資源描述時(shí),為了表達(dá)含義上的細(xì)微差別,經(jīng)常需要對(duì)DCC元素作一些修飾。雖然這些修飾符的應(yīng)用原則和具體語(yǔ)義超出了本文的范圍,為了方便日常應(yīng)用,后面通過(guò)一些例子介紹修飾語(yǔ)法。對(duì)下述在META標(biāo)簽中應(yīng)用元數(shù)據(jù)描述符的三種語(yǔ)法(可能發(fā)生變化)不再作進(jìn)一步的說(shuō)明。



據(jù)此,某部西班牙語(yǔ)的遺作可以寫(xiě)為:
scheme = "rfc1766"
content = "es">
lang = "es"
content = "La Mesa Verde y la Silla Roja">
lang = "en"
content = "The Green Table and the Red Chair">
content = "1935">
content = "1939">
需要注重,本文例中所使用的修飾符語(yǔ)法和標(biāo)簽后綴(跟在元素名和點(diǎn)號(hào)后)僅僅反映了修飾符HTML編碼的趨勢(shì),這種語(yǔ)法格式和后綴既非標(biāo)準(zhǔn)也不建議這么做。
7、DC元素編碼
這一節(jié)針對(duì)不同的DC元素舉出了相應(yīng)的應(yīng)用實(shí)例:
Title (給出的資源名)
-----

content = "Polycyclic aromatic hydrocarbon contamination">

content = "Crime and Punishment">

content = "Methods of Information in Medicine, Vol 32, No 4">

content = "Still life #4 with flowers">

lang = "de"
content = "Das Wohltemperierte Klavier, Teil I">

Creator (常見(jiàn)內(nèi)容的實(shí)體)
-------

content = "Gogh, Vincent van">
content = "van Gogh, Vincent">

content = "Mao Tse Tung">
content = "Mao, Tse Tung">

content = "Plato">
lang = "fr"
content = "Platon">

content = "Sturges, Preston">
content = "Hecht, Ben">
content = "Chaplin, Charles">

Subject (主題或要害字)
-------

content = "heart attack">
scheme = "MESH"
content = "Myocardial Infarction; Pericardial Effusion">

content = "vietnam war">
scheme = "LCSH"
content = "Vietnamese Conflict, 1961-1975">

content = "Friendshscheme = "ddc"
content = "158.25">

Description (說(shuō)明、小結(jié)與摘要)
-----------

lang = "en"
content = "The Author gives some Account of Himself and Family
-- His First Inducements to Travel -- He is
Shipwrecked, and Swims for his Life -- Gets safe on
Shore in the Country of Lilliput -- Is made a
Prisoner, and carried up the Country">

content = "A tutorial and reference manual for
java.">

content = "Seated family of five, coconut trees to the left,
sailboats moored off sandy beach to the right,
with volcano in the background.">

Publisher (出版商、發(fā)布方)
---------

content = "O'Reilly">

content = "Digital Equipment Corporation">

content = "University of California Press">

content = "State of Florida (USA)">

Contributor (其他貢獻(xiàn)者)
-----------

content = "Curie, Marie">

content = "Adams, Ansel">
content = "Sendak, Maurice">
content = "Starr, Kenneth">

Date (該資源生命期中的某個(gè)時(shí)點(diǎn); 推薦[WTN8601])
----

content = "1972">

content = "1998-05-14">
scheme = "WTN8601"
content = "1998-05-14">

content = "1998-05-14">
content = "1998-05-21">
content = "1998-05-28">

content = "triassic">
content = "1957">

scheme = "WTN8601"
content = "1998-12-02T16:59">

scheme = "ISO8601"
content = "98-W49-3T1659">

scheme = "ANSI.X3.X30-1985"
content = "19980514">

Type (性質(zhì)、流派、類(lèi)別; 建議用[DCT1])
----

content = "poem">

scheme = "DCT1"
content = "software">
content = "software program source code">

content = "interactive video game">

scheme = "DCT1"
content = "dataset">

content = "web home page">
content = "web bibliography">

content = "painting">
content = "image; woodblock">
scheme = "AAT"
content = "clipeus (portrait)">
lang = "en-US"
content = "image; advertizement">

scheme = "DCT1"
content = "event">
content = "event; periodic">

Format (物理或邏輯格式以及可選的資源大小)
------

content = "text/xml">
scheme = "IMT"
content = "text/xml">

scheme = "IMT"
content = "image/jpeg">
content = "A text file with mono-spaced tables and diagrams.">

content = "video/mpeg; 14 minutes">

content = "unix tar archive, gzip compressed; 1.5 Mbytes">

content = "watercolor; 23 cm x 31 cm">

Identifier (資源標(biāo)識(shí)符)
----------

content = "http://foo.bar.org/zaf/">

content = "urn:ietf:rfc:1766">

scheme = "ISBN"
content = "1-56592-149-6">

scheme = "LCCN"
content = "67-26020">

scheme = "DOI"
content = "10.12345/33-824688ab">

Source (來(lái)源)
------

content = "Shakespeare's Romeo and Juliet">

content = "http://a.b.org/manon/">

Language (內(nèi)容所使用的語(yǔ)言;建議使用[RFC1766])
--------

content = "en">
scheme = "rfc1766"
content = "en">
scheme = "ISO639-2"
content = "eng">

scheme = "rfc1766"
content = "en-US">

content = "zh">
content = "ja">
content = "es">
content = "de">

content = "german">
lang = "fr"
content = "allemand">

Relation (相關(guān)資源)
--------

content = "http://foo.bar.org/abc/proceedings/1998/">

content = "http://foo.bar.org/cd145.sgml">

content = "http://foo.bar.org/draft9.4.4.2">

content = "urn:isbn:1-56592-149-6">

content = "Shakespeare's Romeo and Juliet">

content = "LWP::UserAgent; HTML::Parse; URI::URL;
Net::DNS; Tk::Pixmap; Tk::Bitmap; Tk::Photo">

Coverage (內(nèi)容所涉及的范圍)
--------

content = "US civil war era; 1861-1865">

content = "Columbus, Ohio, USA; Lat: 39 57 N Long: 082 59 W">

scheme = "TGN"
content = "Columbus (C,V)">

content = "Commonwealth of Australia">

Rights (版權(quán)治理聲明)
------

lang = "en"
content = "Copyright Acme 1999 - All rights reserved.">

content = "http://foo.bar.org/cgi-bin/terms">
8、安全性問(wèn)題
本文所討論的在HTML中應(yīng)用DC元數(shù)據(jù)的語(yǔ)法規(guī)則不會(huì)給計(jì)算機(jī)和網(wǎng)絡(luò)帶來(lái)直接的危險(xiǎn)。這些規(guī)則可能被用于編制不準(zhǔn)確甚至有意誤導(dǎo)(造成“垃圾檢索信息”)的元數(shù)據(jù)信息,這反映了對(duì)HTML META標(biāo)簽的濫用,而且也不僅限于對(duì)DC元數(shù)據(jù)的編碼。即使傳統(tǒng)的元數(shù)據(jù)編碼方案(比如[MARC])也不能免于錯(cuò)誤,雖然錯(cuò)誤通常發(fā)生在數(shù)據(jù)量遠(yuǎn)遠(yuǎn)超出普通網(wǎng)站水平的情況下。
對(duì)使用META標(biāo)簽進(jìn)行編碼的元數(shù)據(jù)進(jìn)行處理的系統(tǒng),應(yīng)該作為設(shè)計(jì)與實(shí)現(xiàn)的一部分考慮與元數(shù)據(jù)的正確性和有效性有關(guān)的問(wèn)題,使用這些系統(tǒng)的用戶也要考慮系統(tǒng)設(shè)計(jì)和實(shí)現(xiàn)中的要求。不同的應(yīng)用程序可能采用不同的方法,比方說(shuō)增加元數(shù)據(jù)來(lái)源的聲明、對(duì)元數(shù)據(jù)是用數(shù)字簽名以及元數(shù)據(jù)創(chuàng)建過(guò)程中某些方面的自動(dòng)化,但是這些都超出了本文以及META標(biāo)簽語(yǔ)法的范疇。
9、附錄——處理用META標(biāo)簽編碼的元數(shù)據(jù)的Perl腳本程序
這一節(jié)包括兩個(gè)程序,適用于4和5版本的PERL腳本語(yǔ)言解釋器。這兩個(gè)程序可以自由地用于本單位的需要、研究目的或者風(fēng)險(xiǎn)資本的召喚。根據(jù)這些程序,程序員可以很輕易把它們改造成其它的應(yīng)用。
腳本一:源數(shù)據(jù)格式轉(zhuǎn)換
這是一個(gè)簡(jiǎn)單的Perl腳本程序,能夠正確識(shí)別本文所有例子中的元數(shù)據(jù)編碼。這個(gè)例子說(shuō)明如何用普通的腳本開(kāi)發(fā)把元數(shù)據(jù)從一種格式轉(zhuǎn)到另一種格式的實(shí)用程序,只要稍作改變就可以支持多種輸出格式。

#!/depot/bin/perl
#
# This simple perl script extracts metadata embedded in an HTML file
# and outputs it in an alternate format. Issues warning about missing
# element name or value.
#
# Handles mixed case tags and attribute values, one per line or spanning
# several lines. Also handles a quoted string spanning multiple lines.
# No error checking. Does not tolerate more than one "
print "@(urc;/n";
while (<>) {
next if (! / ($meta) = /( if (! //i) {
while (<>) {
$meta .= $_;
last if (/>/);
}
}
$name = $meta =~ /name/s*=/s*"([^"]*)"/i
? $1 : "MISSING ELEMENT NAME";
$content = $meta =~ /content/s*=/s*"([^"]*)"/i
? $1 : "MISSING ELEMENT VALUE";
($scheme) = $meta =~ /scheme/s*=/s*"([^"]*)"/i;
($lang) = $meta =~ /lang/s*=/s*"([^"]*)"/i;

if ($lang $scheme) {
$mod = " ($lang";
if (! $scheme)

{ $mod .= ")"; }
elsif (! $lang)
{ $mod .= "$scheme)" }
else
{ $mod .= ", $scheme)"; }
}
else
{ $mod = ""; }

print " @$name$mod; $content/n";
}
print "@)urc;/n";
# ---- end of Perl script ----
假如該程序用于第四節(jié)中的元數(shù)據(jù)例子,則輸出結(jié)果如下:
@(urc;
@DC.Title; A Dirge
@DC.Creator; Shelley, Percy Bysshe
@DC.Type; poem
@DC.Date; 1820
@DC.Format; text/html
@DC.Language; en
@)urc;
腳本二——元數(shù)據(jù)創(chuàng)建自動(dòng)化
假如沒(méi)有一些自動(dòng)化的幫助——預(yù)先設(shè)定缺省值、語(yǔ)法檢查、數(shù)據(jù)范圍驗(yàn)證以及拼寫(xiě)檢查等——?jiǎng)?chuàng)建和維護(hù)高質(zhì)量的元數(shù)據(jù)可能非常困難。假如有某個(gè)腳本程序能夠僅僅通過(guò)文檔標(biāo)題來(lái)加入相應(yīng)的元數(shù)據(jù)內(nèi)容,就可以極大減輕用戶的工作量。下面的程序就可完成這項(xiàng)工作。HTML作者可以把整個(gè)內(nèi)嵌資源描述縮寫(xiě)放在HTML注釋聲明中:

我們的腳本程序把該聲明看作是一種專(zhuān)門(mén)的帶有文檔標(biāo)題的“元數(shù)據(jù)塊聲明”。一般形式為:

該聲明的工作方式非常類(lèi)似于“服務(wù)器端引入”,腳本程序用完整的元數(shù)據(jù)塊代替該聲明并機(jī)或其他的替換。裝上后,該腳本就會(huì)生成與用戶產(chǎn)品Web服務(wù)器程序兼容的HTML文件。
文檔提供者應(yīng)該保有一份單獨(dú)的文檔模板,保存很少改變的預(yù)設(shè)值和元數(shù)據(jù)元素假如用戶的需要非常簡(jiǎn)單,兩份文檔除了標(biāo)題之外都相同,那么這些元素就能自動(dòng)生成。使用該腳本程序,這些元數(shù)據(jù)的值可以向變量那樣在模板或者HTML文檔中引用。變量的引用形式類(lèi)似于“(--mbVARNAME)”,模板中的格式如下:

content = "Simpson, Homer">
content = "(--mBTitle)">
content = "(--mbfilemodtime)">
content = "(--mbbaseURL)/(--mbfilename)">
content = "text/html; (--mbfilesize)">
content = "(--mblanguage)-BUREAUCRATESE">
content = "Springfield Nuclear">
>
>
只要把其中的變量引用代入實(shí)際值,上面的模板就可作為描述文檔的元數(shù)據(jù)塊。 根據(jù)我們的腳本,下述變量要同時(shí)在模板和文檔中替換:
(--mbfilesize) size of the final output file
(--mbtitle) title of the document
(--mblanguage) language of the document
(--mbbaseURL) beginning part of document identifier
(--mbfilename) last part (minus .html) of identifier
(--mbfilemodtime) last modification date of the document
這是一個(gè)應(yīng)用該腳本的HTML文檔:



content = "Memorandum">




From: Acting Shift Supervisor
To: Plant Control Personnel
RE: (--mbtitle)
Date: (--mbfilemodtime)


Pursuant to directive DOH:10.2001/405aec of article B-2022,
subsection 48.2.4.4.1c regarding staff morale and employee
productivity standards, the current allocation of doughnut
acquisition funds shall be increased effective immediately.


由于替換在整個(gè)文檔范圍內(nèi)進(jìn)行,作者只要輸入標(biāo)題一次就可以了(通常標(biāo)題要在首部和HTML文檔體內(nèi)輸入兩次)。運(yùn)行腳本程序后,上面的文件就被轉(zhuǎn)換成:



content = "Simpson, Homer">
content = "Nutritional Allocation Increase">
content = "1999-03-08">
content = "http://moes.bar.com/doh/homer.html">
content = "text/html; 1320 bytes">
content = "en-BUREAUCRATESE">
content = "Springfield Nuclear">
>

>
content = "Memorandum">



From: Acting Shift Supervisor
To: Plant Control Personnel
RE: Nutritional Allocation Increase
Date: 1999-03-08


Pursuant to directive DOH:10.2001/405aec of article B-2022,
subsection 48.2.4.4.1c regarding staff morale and employee
productivity standards, the current allocation of doughnut
acquisition funds shall be increased effective immediately.


下面是完成這一轉(zhuǎn)換過(guò)程的腳本:
#!/depot/bin/perl
#
# This Perl script processes metadata block declarations of the form
# and variable references of the
# form (--mbVARNAME), replacing them with full metadata blocks and
# variable values, respectively. Requires a "template" file.
# Outputs an HTML file.
#
# Invoke this script with a single filename argument, "foo". It creates
# an output file "foo.html" using a temporary working file "foo.work".
# The size of foo.work is measured after variable replacement, and is
# later inserted into the file in such a way that the file's size does
# not change in the process. Has little or no error checking.

$infile = shift;
open(IN, "< $infile")
or die("Could not open input file /"$infile/"");
$workfile = "$infile.work";
unlink($workfile);
open(WORK, "+> $workfile")
or die("Could not open work file /"$workfile/"");

@offsets = (); # records locations for late size replacement
$title = ""; # gets the title during metablock processing
$language = "en"; # pre-set language here (not in the template)
$baseURL = "http://moes.bar.com/doh"; # pre-set base URL here also
$filename = "$infile.html"; # final output filename
$filesize = "(--mbfilesize)"; # replaced late (separate pass)

($year, $month, $day) = (localtime( (stat IN) [9] ))[5, 4, 3];
$filemodtime = sprintf "%s-%02s-%02s", 1900 + $year, 1 + $month, $day;

sub putout { # outputs current line with variable replacement
if (! //(--mb/) {
print WORK;
return;
}
if (//(--mbfilesize/)/) # remember where it was
{ push @offsets, tell WORK; } # but don't replace yet
s//(--mbtitle/)/$title/g;
s//(--mblanguage/)/$language/g;
s//(--mbbaseURL/)/$baseURL/g;
s//(--mbfilename/)/$filename/g;
s//(--mbfilemodtime/)/$filemodtime/g;
print WORK;
}

while () { # main loop for input file
if (! /(.*)
&putout;
next;
}
$title=$2;
$_=$1;
&putout;
if($title=~s//s*-->(.*)//) {
$remainder = $1;
}
else {
while () {
$title .= $_;
last if (/(.*)/s*-->(.*)/);
}
$title .= $1;
$remainder = $2;
}
open(TPLATE, "< template")
or die("Could not open template file");
while () # subloop for template file
{ &putout; }
close(TPLATE);
$_ = $remainder;
&putout;

}
close(IN);

# Now replace filesize variables without altering total byte count.
select( (select(WORK), $ = 1) [0] ); # first flush output so we
if (($size = -s WORK) < 100000) # can get final file size
{ $scale = 0; } # and set scale factor or
else { # compute it, keeping width of size field low
for ($scale = 0; $size >= 1000; $scale++)
{ $size /= 1024; }
}
$filesize = sprintf "%7.7s %sbytes",
$size, (" ", "K", "M", "G", "T", "P") [$scale];

foreach $pos (@offsets) { # loop through saved size locations
seek WORK, $pos, 0; # read the line found there
$_ = ;
# $filesize must be exactly as wide as "(--mbfilesize)"
s//(--mbfilesize/)/$filesize/g;
seek WORK, $pos, 0; # rewrite it with replacement
print WORK;
}

close(WORK);
rename($workfile, "$filename")
or die("Could not rename /"$workfile/" to /"$filename/"");
# ---- end of Perl script ----
10. 作者地址
John A. Kunze
Center for Knowledge Management
University of California, San Francisco
530 Parnassus Ave, Box 0840
San Francisco, CA 94143-0840, USA
Fax: +1 415-476-4653
EMail: jak@ckm.ucsf.edu
11、參考資料
[AAT]Art and Architecture Thesaurus, Getty Information Institute.
http://shiva.pub.getty.edu/aat_browser/
[AC]The A-Core: Metadata about Content Metadata, (inprogress)
http://metadata.net/ac/draft-iannella-admin-01.txt
[DC1]Weibel, S., Kunze, J., Lagoze, C. and M. Wolf,"Dublin Core Metadata for Resource Discovery", RFC2413, September 1998.
FTP://ftp.isi.edu/in-notes/rfc2413.txt
[DCHOME]Dublin Core Initiative Home Page.
http://purl.org/DC/
[DCPROJECTS]Projects Using Dublin Core Metadata.
http://purl.org/DC/projects/index.htm
[DCT1]Dublin Core Type List 1, DC Type Working Group, March 1999.
http://www.loc.gov/marc/typelist.html
[freeWAIS-sf2.0] The enhanced freeWAIS distribution, February 1999.
http://ls6-www.cs.uni-dortmund.de/ir/projects/freeWAIS-sf/
[GLIMPSE]Glimpse Home Page.
http://glimpse.cs.arizona.edu/
[HARVEST]Harvest Web Indexing.
http://www.tardis.ed.ac.uk/harvest/
[HTML4.0]Hypertext Markup Language 4.0 Specification, April 1998.
http://www.w3.org/TR/REC-html40/
[ISEARCH]Isearch Resources Page.
http://www.etymon.com/Isearch/
[ISO639-2]Code for the representation of names of languages, 1996.
http://www.indigo.ie/egt/standards/iso639/iso639-2-en.html
[ISO8601]ISO 8601:1988(E), Data elements and interchange formats -- Information interchange - Representation of dates and times, International Organization for standardization, June 1988.
http://www.iso.ch/markete/8601.pdf
[MARC]USMARC Format for Bibliographic Data, US Library of Congress.
http://lcweb.loc.gov/marc/marc.html
[PERL]L. Wall, T. Christiansen, R. Schwartz, Programming Perl, Second Edition, O'Reilly, 1996.
[RDF]Resource Description Framework Model and Syntax Specification, February 1999.
http://www.w3.org/TR/REC-rdf-syntax/
[RFC1766]Alvestrand, H., "Tags for the Identification of Languages", RFC1766, March 1996.
ftp://ftp.isi.edu/in-notes/rfc1766.txt
[SWISH-E]Simple Web Indexing System for Humans - Enhanced.
http://sunsite.Berkeley.EDU/SWISH-E/
[TGN]Thesaurus of Geographic Names, Getty Information Institute.
http://shiva.pub.getty.edu/tgn_browser/
[WTN8601]W3C Technical Note - Profile of ISO 8601 Date and Time Formats.
http://www.w3.org/TR/NOTE-datetime
[XML]Extensible Markup Language (XML).
http://www.w3.org/TR/REC-xml
12、版權(quán)聲明
Copyright (C) The Internet Society (1999). All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise eXPlain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.
The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgement
Funding for the RFCEditor function is currently provided by the Internet Society.




發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 黄龙县| 资讯 | 楚雄市| 太和县| 商南县| 大庆市| 锡林郭勒盟| 沧源| 苍梧县| 景泰县| 德清县| 平昌县| 宁强县| 长丰县| 永安市| 新干县| 包头市| 潞城市| 当涂县| 霍城县| 仪陇县| 黄梅县| 嘉兴市| 娱乐| 鹤山市| 南宫市| 望城县| 永平县| 兴安盟| 天峨县| 高雄县| 榆社县| 吉水县| 珲春市| 商河县| 应用必备| 揭东县| 兴隆县| 濮阳县| 乌什县| 华安县|