B IB 2x for processing B IB T EX-bibliographies Alexander Feder - - PowerPoint PPT Presentation

b ib 2x
SMART_READER_LITE
LIVE PREVIEW

B IB 2x for processing B IB T EX-bibliographies Alexander Feder - - PowerPoint PPT Presentation

Motivation Solution Bib2x Templates B IB 2x for processing B IB T EX-bibliographies Alexander Feder i@xandi.eu 28. 4. 2006 Feder B IB 2 X Motivation Solution Bib2x Templates Problems Ever growing collection of bibliographic references


slide-1
SLIDE 1

Motivation Solution Bib2x Templates

BIB2x

for processing BIBT EX-bibliographies Alexander Feder i@xandi.eu

  • 28. 4. 2006

Feder BIB2X

slide-2
SLIDE 2

Motivation Solution Bib2x Templates

Problems

Ever growing collection of bibliographic references

which quickly becomes a mess

Properly organizing BIBT EX-libraries

tedious and time-consuming when done by hand always out-of-date error-prone

Using the bibliographies outside of L

AT

EX

Conversion to

  • ther bibliography formats

XML, Plaintext etc. for use in 3rd-party applications

Transformation to (e.g.) HTML for presentation on the web

Pretty Printing

Feder BIB2X

slide-3
SLIDE 3

Motivation Solution Bib2x Templates

Additional features demanded

Mechanism to

Filter Sort

Integrability

Shell Cron-Jobs

Platform-Independence Applicable on large databases

Feder BIB2X

slide-4
SLIDE 4

Motivation Solution Bib2x Templates

BIB2x

BIB2x

Developed in C

++

using LEX and YACC for parsing using ODB for internal representation

Feder BIB2X

slide-5
SLIDE 5

Motivation Solution Bib2x Templates

BIB2x

What does BIB2x do? Reads BIBT EX-libraries from stdin or a specified file Outputs

built-in formats: html, plaintext, odb-dump arbitrary formats using templates

proof of concept: html, rtf, BIBT EX

allows to filter and sort by any regular BIBT EX-field... ...and any self-defined field

Feder BIB2X

slide-6
SLIDE 6

Motivation Solution Bib2x Templates

BIB2x

What is meant with „self-defined” field?

@string { pbl:prock = "Prockhouse" } @article { feder05, author = "Alexander Feder", title = "Experimental usage of the {ODB} for " # "multipurpose manipulation of and " # "access to Bibtex-Bibliographies", journal = "Prawda", pages = "51-82", publisher = pbl:prock, year = 2005, category = "pure nonsense" # "selfmade" }

Feder BIB2X

slide-7
SLIDE 7

Motivation Solution Bib2x Templates

BIB2x

What does BIB2x do? (cont.) Converts special characters into UTF

ö: \”{o} → ö

repertoire of understood L

A

T EX-commands

extensible (but a little bit pedestrian)

Feder BIB2X

slide-8
SLIDE 8

Motivation Solution Bib2x Templates

Templates

Templates are processed onto the entire set of BIBT EX-entries which have been parsed. Templates define The format of the output file Which entries are processed...

Exclusions Inclusions

...and how they are processed

Grouping Sorting

Feder BIB2X

slide-9
SLIDE 9

Motivation Solution Bib2x Templates

Looping, Grouping, Reducing

%%GRP%% ... %%PRG%% Split input-set into multiple sets which are then looped through

  • ne subset after the other.

%%FOR%% ... %%FOR%% Loops through the current set, one bibtex-entry after the other. %%RED%% Reduce the current set using the specified constraints.

Feder BIB2X

slide-10
SLIDE 10

Motivation Solution Bib2x Templates

Looping, Grouping and Reducing (cont.)

@article @book %%GRP%%(inc:@entry) feder05bib morgner04ODB mayer97foo huber99bar dostojevskij66schuld dostojevskij69idiot ellul62prop kierke43entw dostojevskij66schuld (@book) feder05bib (@article) morgner04ODB (@article) dostojevskij69idiot (@book) mayer97foo (@article) ellul62prop (@book) kierke43entw (@book) huber99bar (@article) %%FOR%%(inc:author) %%FOR%%(inc:author) feder05bib %%BIB%%(inc:author,title;) huber99bar mayer97foo morgner04ODB dostojevskij69idiot %%BIB%%(inc:author,title;) dostojevskij66schuld ellul62prop kierke43entw

Feder BIB2X

slide-11
SLIDE 11

Motivation Solution Bib2x Templates

Looping, Grouping and Reducing (cont.)

CMD ∈ { GRP , FOR, RED } %%CMD%% %%CMD%% ( Sort: Condition; Constraint; Constraint; ..; ) Sort ∈ { inc, dec }

Feder BIB2X

slide-12
SLIDE 12

Motivation Solution Bib2x Templates

Looping, Grouping and Reducing (cont.)

Condition name of the tag to be used as key (e.g. author) @entry to specify that sorting should follow the BIBT EX-entry-type.

Feder BIB2X

slide-13
SLIDE 13

Motivation Solution Bib2x Templates

Looping, Grouping and Reducing (cont.)

Condition tag:nr op {”foo”, ”bar”,... } tag the tag to be operated on :nr (optional) specifies which component of the tag is used

0 operation will perform on concatenation of all substrings x each substring is operated on separately k (k ∈ N) operation will perform on kth substring

  • p operator

= tag contains at least one of the specified words. != tag does not contain any of the specified words.

Feder BIB2X

slide-14
SLIDE 14

Motivation Solution Bib2x Templates

Looping, Grouping and Reducing (cont.)

%%FOR%% ( dec: author; author = { ”alexander” }; author!={”bob”,”john”}; ) %%FOR%% ( inc: category:2 ={”selfmade”, ”nonsense”}; title!={”interesting”}; ) Note a set of words enclosed by braces equals logical OR subsequent constraints equal logical AND

Feder BIB2X

slide-15
SLIDE 15

Motivation Solution Bib2x Templates

Group

%%GRP%% GROUP splits the previous set into subsets which then are separately processed according to the body of the GROUP. Commands valid in %%GRP%%’s Body: %%name%% returns the name of the current subset %%FOR%% allows processing the entries inside this subset

  • ne by one.

%%GRP%% to construct arbitrarily nested Groups Note a set of words enclosed by braces equals logical OR subsequent constraints equal logical AND

Feder BIB2X

slide-16
SLIDE 16

Motivation Solution Bib2x Templates

Example Templates

Example Template using %%GRP%% <html><body> %%GRP%%(inc: author)<div style=”...”> Works by <b>%%name%%</b> were published in <ul> %%GRP%%(inc:year) <li style=”color:blue”>%%name%%</li> %%PRG%% </ul></div><br> %%PRG%% </body></html>

Feder BIB2X

slide-17
SLIDE 17

Motivation Solution Bib2x Templates

Example Templates - Result

Execution of BIB2x $ bib2x -f test.bib -t temp.late

<html><body> <div style=”...”> Works by <b>Alexander Feder</b> were published in <ul> <li style=”color:blue”>2004</li> <li style=”color:blue”>2005</li> </ul></div><br> <div style=”...”>

Feder BIB2X

slide-18
SLIDE 18

Motivation Solution Bib2x Templates

For

%%FOR%% FOR iterates through the current set of entries, and processes each entry according to the body of the FOR. Commands valid in %%FOR%%’s Body:

%%$odbid%% returns the ODB-Id of the current entry. %%$bibkey%% returns the BIBT EX-citation key. %%$bibtype%% returns the BIBT EX-entry type %%anytag%% where anytag is any tag like author or year. Returns the concatenated content of the corresponding entry %%BIB%% enables conditioned access to all tags without prior knowledge of their existence.

Feder BIB2X

slide-19
SLIDE 19

Motivation Solution Bib2x Templates

Bib

%%BIB%% %%BIB%% It iterates through all tags and, by default, returns them all. This can be conditioned and filtered. It is used to process tags previously unknown and cope with tags expected but not existing. specify the order in which these tags shall be processed and define under which conditions tags may be skipped or uniquely included. Beware! The syntax of %%BIB%% is different to the syntax of %%FOR%%, but admittedly confusingly similar!

Feder BIB2X

slide-20
SLIDE 20

Motivation Solution Bib2x Templates

Bib

%%BIB%%

%%BIB%%(Sort: Sequence;Constraint;Constraint;...;)

Sequence is a comma-separated list of tags with prefix: ! excludes a tag. No operation will be performed # makes the tag(s) exclusive. defines the order

Feder BIB2X

slide-21
SLIDE 21

Motivation Solution Bib2x Templates

Bib

%%BIB%%-Body

%%BIB%%(Sort: Sequence;Constraint;Constraint;...;) X1=” ... ” . . . Xi=” ... ” %%BIB%% Xi ∈ {G,M,E,N}, 1 ≤ i ≤ 4

M : MISSING – in case a specified tag has not been found. E : EMPTY – in case the specified tag has been found empty. N : NONEMPTY – for specified tags having content. G : GENERAL – for non-specified tags having content.

Feder BIB2X

slide-22
SLIDE 22

Motivation Solution Bib2x Templates

Bib

Commands valid inside the string of the parts return

%%name%%

the name of the current tag.

%%content%%

a concatenation of the tag’s substrings.

%%step:#-#%%

a range of the tag’s content

%%MOD_XX%%

for modifying a returned string or substring. Step %%step:#-#%% ( ”Prefix”; ”Middle”; ”Suffix” ) # is # numeric value or x the letter „x” defining everything until the end

Feder BIB2X

slide-23
SLIDE 23

Motivation Solution Bib2x Templates

Example

Example:

%%BIB%%(inc:#category;) N=”%%name%%: <a href=\”http://host.at/query?key=%%content%%\”>%%content%%</a>” M=”<span style=\color:red\”>Categorization missing!</span>” E=”Not member of any category” %%BIB%%

Feder BIB2X

slide-24
SLIDE 24

Motivation Solution Bib2x Templates

Modifications

%%MOD_XX%% %%MOD_XX%% ( %%CMD%% ) where XX is: LC LOWERCASE – everything is converted to lower-case letters. LF LOWERCASE, FIRSTUPPER – everything is converted to lower-case letters except the very first one. UC UPPERCASE – everything is converted to upper-case letters. UB UPPERCASE BEGIN – every word starts with an upper-case letter.

Feder BIB2X

slide-25
SLIDE 25

Motivation Solution Bib2x Templates

Example

%%MOD_XX%% %%MOD_LC%% (”A very interesting Text about {BiBTeX{”) %%MOD_LF%% (”A very interesting Text about {BiBTeX{”) %%MOD_UC%% (”A very interesting Text about {BiBTeX{”) %%MOD_UB%% (”A very interesting Text about {BiBTeX{”)

Feder BIB2X

slide-26
SLIDE 26

Motivation Solution Bib2x Templates

Example

%%MOD_XX%% Result a very interesting text about BiBTeX A very interesting text about BiBTeX A VERY INTERESTING TEXT ABOUT BiBTeX A Very Interesting Text About BiBTeX

Feder BIB2X

slide-27
SLIDE 27

Motivation Solution Bib2x Templates

Danke

Danke!

Feder BIB2X

slide-28
SLIDE 28

Motivation Solution Bib2x Templates

Looping, Grouping and Reducing (cont.)

str-atom: ,,Alexander Feder'' str-atom: ,,and'' str-atom: ,,Experimental usage...'' str-atom: ,,Prawda'' str-atom: ,,51-70'' link-atom: [0] Object: @String str-atom: ,,pure nonsense'' str-atom: ,selfmade'' date-atom: 2005 key-atom: ,,pbl:prock'' str-atom: ,,Prockhouse'' accent-atom: \''{O} str-atom: ,,dipus'' Object: @Article Object: Title Reason: child Object: Author Reason: child Object: Pages Reason: child Object: Journal Reason: child Object: Year Reason: child Object: Category Reason: child Object: Publisher Reason: child Reason: abbrev

Feder BIB2X