Merge pull request #1400 from Exiv2/fix_1393_iptc_tags_web_0.27
fix_1393_iptc_tags_web_0.27
This commit is contained in:
commit
4017f79c83
8
doc/templates/Makefile
vendored
8
doc/templates/Makefile
vendored
@ -36,7 +36,7 @@
|
||||
#
|
||||
# Description:
|
||||
# Simple Makefile to create html documentation from templates. Requires
|
||||
# some special tools (awk, python, xsltproc) but really only needs to
|
||||
# some special tools (python3, xsltproc) but really only needs to
|
||||
# be used to update the documentation after changing Exiv2 tags in the
|
||||
# source code.
|
||||
#
|
||||
@ -168,7 +168,7 @@ tags: $(TABLES) Iptc $(SCHEMA)
|
||||
|
||||
$(TABLES):
|
||||
@echo Generating $@ table...
|
||||
@$(TAGLIST) $@ | sed -e"s/</\</g" -e"s/>/\>/g" | awk -f tags.awk > $@.xml
|
||||
@$(TAGLIST) $@ | sed -e"s/</\</g" -e"s/>/\>/g" | python3 tags.py > $@.xml
|
||||
@xsltproc tags.xsl $@.xml > $@.tmp
|
||||
@sed "s/report1/$@/" $@.tmp > __$@__
|
||||
@touch $@
|
||||
@ -177,7 +177,7 @@ $(TABLES):
|
||||
Iptc:
|
||||
@echo Generating $@ table...
|
||||
@$(TAGLIST) $@ | sed -e"s/</\</g" -e"s/>/\>/g" -e"s/<2F>/\±/g" \
|
||||
| awk -f iptc.awk > $@.xml
|
||||
| python3 iptc.py > $@.xml
|
||||
@xsltproc iptc.xsl $@.xml > $@.tmp
|
||||
@sed "s/report1/$@/g" $@.tmp > __$@__
|
||||
@touch $@
|
||||
@ -185,7 +185,7 @@ Iptc:
|
||||
|
||||
$(SCHEMA):
|
||||
@echo Generating $@ table...
|
||||
@echo $@ | sed "s/xmp_//" | xargs $(TAGLIST) | sed -e"s/</\</g" -e"s/>/\>/g" | awk -f xmp.awk > $@.xml
|
||||
@echo $@ | sed "s/xmp_//" | xargs $(TAGLIST) | sed -e"s/</\</g" -e"s/>/\>/g" | python3 xmp.py > $@.xml
|
||||
@xsltproc xmp.xsl $@.xml > $@.tmp
|
||||
@sed "s/report1/$@/" $@.tmp > __$@__
|
||||
@touch $@
|
||||
|
||||
47
doc/templates/iptc.awk
vendored
47
doc/templates/iptc.awk
vendored
@ -1,47 +0,0 @@
|
||||
################################################################################
|
||||
# File : iptc.awk
|
||||
# Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
|
||||
# History : 07-Feb-04, ahu: created
|
||||
#
|
||||
# Description:
|
||||
# Awk script to convert a taglist to XML format used in the documentation.
|
||||
# $ taglist [SectionName] | awk -f iptc.awk > iptc.xml
|
||||
################################################################################
|
||||
|
||||
BEGIN {
|
||||
FS = ", "
|
||||
print "<?xml version = '1.0'?>";
|
||||
print "<?xml-stylesheet type=\"text/xsl\" href=\"iptc.xsl\"?>";
|
||||
|
||||
print "<TAGLIST>"
|
||||
print "<HEADER>"
|
||||
print "<title>Iptc datasets defined in Exiv2</title>"
|
||||
print "<text>"
|
||||
print "<p>Datasets are defined according to the specification of the Iptc "
|
||||
print "<a href=\"http://www.iptc.org/IIM/\">Information Interchange Model (IIM)</a>.</p>"
|
||||
print "<p>Click on a column header to sort the table.</p>"
|
||||
print "</text>"
|
||||
print "</HEADER>"
|
||||
print "<ROWSET>"
|
||||
}
|
||||
|
||||
{
|
||||
print " <ROW num=\"" ++row "\">";
|
||||
print " <tagname>" $1 "</tagname>"
|
||||
print " <tagdec>" $2 "</tagdec>"
|
||||
print " <taghex>" $3 "</taghex>"
|
||||
print " <recname>" $4 "</recname>"
|
||||
print " <mandatory>" $5 "</mandatory>"
|
||||
print " <repeatable>" $6 "</repeatable>"
|
||||
print " <minbytes>" $7 "</minbytes>"
|
||||
print " <maxbytes>" $8 "</maxbytes>"
|
||||
print " <key>" $9 "</key>"
|
||||
print " <type>" $10 "</type>"
|
||||
print " <tagdesc>" $11 "</tagdesc>"
|
||||
print " </ROW>";
|
||||
}
|
||||
|
||||
END {
|
||||
print "</ROWSET>"
|
||||
print "</TAGLIST>"
|
||||
}
|
||||
39
doc/templates/iptc.py
vendored
Executable file
39
doc/templates/iptc.py
vendored
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import csv
|
||||
|
||||
print("""<?xml version = '1.0'?>
|
||||
<?xml-stylesheet type=\"text/xsl\" href=\"tags.xsl\"?>
|
||||
<TAGLIST>
|
||||
<HEADER>
|
||||
<title>Iptc datasets defined in Exiv2</title>
|
||||
<text>
|
||||
<p>Datasets are defined according to the specification of the Iptc
|
||||
<a href=\"http://www.iptc.org/IIM/\">Information Interchange Model (IIM)</a>.</p>
|
||||
<p>Click on a column header to sort the table.</p>
|
||||
</text>
|
||||
</HEADER>
|
||||
<ROWSET>""")
|
||||
|
||||
row=0
|
||||
data = sys.stdin.readlines()
|
||||
for line in csv.reader(data,quotechar='"',skipinitialspace=True):
|
||||
row=row+1
|
||||
print(" <ROW num=\"%d\">" % row)
|
||||
print(" <tagname>" + line[ 0] + "</tagname>")
|
||||
print(" <tagdec>" + line[ 1] + "</tagdec>")
|
||||
print(" <taghex>" + line[ 2] + "</taghex>")
|
||||
print(" <recname>" + line[ 3] + "</recname>")
|
||||
print(" <mandatory>" + line[ 4] + "</mandatory>")
|
||||
print(" <repeatable>" + line[ 5] + "</repeatable>")
|
||||
print(" <minbytes>" + line[ 6] + "</minbytes>")
|
||||
print(" <maxbytes>" + line[ 7] + "</maxbytes>")
|
||||
print(" <key>" + line[ 8] + "</key>")
|
||||
print(" <type>" + line[ 9] + "</type>")
|
||||
print(" <tagdesc>" + line[10] + "</tagdesc>")
|
||||
print(" </ROW>")
|
||||
|
||||
print("</ROWSET>")
|
||||
print("</TAGLIST>")
|
||||
|
||||
43
doc/templates/tags.awk
vendored
43
doc/templates/tags.awk
vendored
@ -1,43 +0,0 @@
|
||||
################################################################################
|
||||
# File : tags.awk
|
||||
# Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
|
||||
# History : 07-Feb-04, ahu: created
|
||||
#
|
||||
# Description:
|
||||
# Awk script to convert a taglist to XML format used in the documentation.
|
||||
# $ taglist [itemName] | awk -f tags.awk > tags.xml
|
||||
################################################################################
|
||||
|
||||
BEGIN {
|
||||
FS = ", " # ,\t
|
||||
print "<?xml version = '1.0'?>";
|
||||
print "<?xml-stylesheet type=\"text/xsl\" href=\"tags.xsl\"?>";
|
||||
|
||||
print "<TAGLIST>"
|
||||
print "<HEADER>"
|
||||
print "<title>XYZ MakerNote Tags defined in Exiv2</title>"
|
||||
print "<text>"
|
||||
print "<p>Tags found in the MakerNote of images taken with XYZ cameras. These tags "
|
||||
print "are defined by Exiv2 in accordance with <a href=\"makernote.html#RX\">[X]</a>.</p>"
|
||||
print "<p>Click on a column header to sort the table.</p>"
|
||||
print "</text>"
|
||||
print "</HEADER>"
|
||||
print "<ROWSET>"
|
||||
}
|
||||
|
||||
{
|
||||
print " <ROW num=\"" ++row "\">";
|
||||
print " <tagname>" $1 "</tagname>"
|
||||
print " <tagdec>" $2 "</tagdec>"
|
||||
print " <taghex>" $3 "</taghex>"
|
||||
print " <ifd>" $4 "</ifd>"
|
||||
print " <key>" $5 "</key>"
|
||||
print " <type>" $6 "</type>"
|
||||
print " <tagdesc>" $7 "</tagdesc>"
|
||||
print " </ROW>";
|
||||
}
|
||||
|
||||
END {
|
||||
print "</ROWSET>"
|
||||
print "</TAGLIST>"
|
||||
}
|
||||
35
doc/templates/tags.py
vendored
Executable file
35
doc/templates/tags.py
vendored
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import csv
|
||||
|
||||
print("""<?xml version = '1.0'?>
|
||||
<?xml-stylesheet type=\"text/xsl\" href=\"tags.xsl\"?>
|
||||
<TAGLIST>
|
||||
<HEADER>
|
||||
<title>XYZ MakerNote Tags defined in Exiv2</title>
|
||||
<text>
|
||||
<p>Tags found in the MakerNote of images taken with XYZ cameras. These tags
|
||||
are defined by Exiv2 in accordance with <a href=\"makernote.html#RX\">[X]</a>.</p>
|
||||
<p>Click on a column header to sort the table.</p>
|
||||
</text>
|
||||
</HEADER>
|
||||
<ROWSET>""")
|
||||
|
||||
row=0
|
||||
data = sys.stdin.readlines()
|
||||
for line in csv.reader(data,quotechar='"',skipinitialspace=True):
|
||||
row=row+1
|
||||
print(" <ROW num=\"%d\">" % row)
|
||||
print(" <tagname>" + line[0] + "</tagname>")
|
||||
print(" <tagdec>" + line[1] + "</tagdec>")
|
||||
print(" <taghex>" + line[2] + "</taghex>")
|
||||
print(" <ifd>" + line[3] + "</ifd>")
|
||||
print(" <key>" + line[4] + "</key>")
|
||||
print(" <type>" + line[5] + "</type>")
|
||||
print(" <tagdesc>" + line[6] + "</tagdesc>")
|
||||
print(" </ROW>")
|
||||
|
||||
print("</ROWSET>")
|
||||
print("</TAGLIST>")
|
||||
|
||||
42
doc/templates/xmp.awk
vendored
42
doc/templates/xmp.awk
vendored
@ -1,42 +0,0 @@
|
||||
################################################################################
|
||||
# File : xmp.awk
|
||||
# Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
|
||||
# History : 23-Nov-07, ahu: created
|
||||
#
|
||||
# Description:
|
||||
# Awk script to convert an XMP property list to XML format used in the
|
||||
# documentation.
|
||||
# $ taglist [xmpList] | awk -f xmp.awk > [xmpList].xml
|
||||
################################################################################
|
||||
|
||||
BEGIN {
|
||||
FS = ", " # ,\t
|
||||
print "<?xml version = '1.0'?>";
|
||||
print "<?xml-stylesheet type=\"text/xsl\" href=\"xmp.xsl\"?>";
|
||||
|
||||
print "<TAGLIST>"
|
||||
print "<HEADER>"
|
||||
print "<title>XMP tags defined in Exiv2</title>"
|
||||
print "<text>"
|
||||
print "<p>Some description</p>"
|
||||
print "<p>Click on a column header to sort the table.</p>"
|
||||
print "</text>"
|
||||
print "</HEADER>"
|
||||
print "<ROWSET>"
|
||||
}
|
||||
|
||||
{
|
||||
print " <ROW num=\"" ++row "\">";
|
||||
print " <tagname>" $1 "</tagname>"
|
||||
print " <title>" $2 "</title>"
|
||||
print " <xmpvaltype>" $3 "</xmpvaltype>"
|
||||
print " <type>" $4 "</type>"
|
||||
print " <category>" $5 "</category>"
|
||||
print " <tagdesc>" $6 "</tagdesc>"
|
||||
print " </ROW>";
|
||||
}
|
||||
|
||||
END {
|
||||
print "</ROWSET>"
|
||||
print "</TAGLIST>"
|
||||
}
|
||||
34
doc/templates/xmp.py
vendored
Executable file
34
doc/templates/xmp.py
vendored
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import csv
|
||||
|
||||
print("""<?xml version = '1.0'?>
|
||||
<?xml-stylesheet type=\"text/xsl\" href=\"tags.xsl\"?>
|
||||
<TAGLIST>
|
||||
<HEADER>
|
||||
<title>XMP tags defined in Exiv2</title>
|
||||
<text>
|
||||
<p>Some description</p>
|
||||
<p>Click on a column header to sort the table.</p>
|
||||
</text>
|
||||
</HEADER>
|
||||
<ROWSET>""")
|
||||
|
||||
row=0
|
||||
data = sys.stdin.readlines()
|
||||
print(data)
|
||||
for line in csv.reader(data,quotechar='"',skipinitialspace=True):
|
||||
row=row+1
|
||||
print(" <ROW num=\"%d\">" % row)
|
||||
print(" <tagname>" + line[0] + "</tagname>")
|
||||
print(" <title>" + line[1] + "</title>")
|
||||
print(" <xmpvaltype>" + line[2] + "</xmpvaltype>")
|
||||
print(" <type>" + line[3] + "</type>")
|
||||
print(" <category>" + line[4] + "</category>")
|
||||
print(" <tagdesc>" + line[5] + "</tagdesc>")
|
||||
print(" </ROW>")
|
||||
|
||||
print("</ROWSET>")
|
||||
print("</TAGLIST>")
|
||||
|
||||
@ -722,8 +722,16 @@ namespace Exiv2 {
|
||||
<< iptcKey.key() << ", "
|
||||
<< TypeInfo::typeName(
|
||||
IptcDataSets::dataSetType(dataSet.number_,
|
||||
dataSet.recordId_)) << ", "
|
||||
<< dataSet.desc_;
|
||||
dataSet.recordId_)) << ", ";
|
||||
// CSV encoded I am \"dead\" beat" => "I am ""dead"" beat"
|
||||
char Q = '"';
|
||||
os << Q;
|
||||
for ( size_t i = 0 ; i < ::strlen(dataSet.desc_) ; i++ ) {
|
||||
char c = dataSet.desc_[i];
|
||||
if ( c == Q ) os << Q;
|
||||
os << c;
|
||||
}
|
||||
os << Q;
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -2837,16 +2837,27 @@ namespace Exiv2 {
|
||||
prefix_ = prefix;
|
||||
} // XmpKey::Impl::decomposeKey
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
std::ostream& operator<<(std::ostream& os, const XmpPropertyInfo& property)
|
||||
{
|
||||
return os << property.name_ << ",\t"
|
||||
<< property.title_ << ",\t"
|
||||
<< property.xmpValueType_ << ",\t"
|
||||
<< TypeInfo::typeName(property.typeId_) << ",\t"
|
||||
<< ( property.xmpCategory_ == xmpExternal ? "External" : "Internal" ) << ",\t"
|
||||
<< property.desc_ << "\n";
|
||||
os << property.name_ << ","
|
||||
<< property.title_ << ","
|
||||
<< property.xmpValueType_ << ","
|
||||
<< TypeInfo::typeName(property.typeId_) << ","
|
||||
<< ( property.xmpCategory_ == xmpExternal ? "External" : "Internal" ) << ",";
|
||||
// CSV encoded I am \"dead\" beat" => "I am ""dead"" beat"
|
||||
char Q = '"';
|
||||
os << Q;
|
||||
for ( size_t i = 0 ; i < ::strlen(property.desc_) ; i++ ) {
|
||||
char c = property.desc_[i];
|
||||
if ( c == Q ) os << Q;
|
||||
os << c;
|
||||
}
|
||||
os << Q << std::endl;
|
||||
return os;
|
||||
}
|
||||
//! @endcond
|
||||
|
||||
|
||||
23
src/tags.cpp
23
src/tags.cpp
@ -441,15 +441,22 @@ namespace Exiv2 {
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
ExifKey exifKey(ti);
|
||||
os << exifKey.tagName() << ",\t"
|
||||
<< std::dec << exifKey.tag() << ",\t"
|
||||
os << exifKey.tagName() << ","
|
||||
<< std::dec << exifKey.tag() << ","
|
||||
<< "0x" << std::setw(4) << std::setfill('0')
|
||||
<< std::right << std::hex << exifKey.tag() << ",\t"
|
||||
<< exifKey.groupName() << ",\t"
|
||||
<< exifKey.key() << ",\t"
|
||||
<< TypeInfo::typeName(exifKey.defaultTypeId()) << ",\t"
|
||||
<< exifKey.tagDesc();
|
||||
|
||||
<< std::right << std::hex << exifKey.tag() << ","
|
||||
<< exifKey.groupName() << ","
|
||||
<< exifKey.key() << ","
|
||||
<< TypeInfo::typeName(exifKey.defaultTypeId()) << ",";
|
||||
// CSV encoded I am \"dead\" beat" => "I am ""dead"" beat"
|
||||
char Q = '"';
|
||||
os << Q;
|
||||
for ( size_t i = 0 ; i < exifKey.tagDesc().size() ; i++ ) {
|
||||
char c = exifKey.tagDesc()[i];
|
||||
if ( c == Q ) os << Q;
|
||||
os << c;
|
||||
}
|
||||
os << Q;
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user