| 1 | package TeX::Encode::BibTeX; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | our $VERSION = '2.010'; # VERSION | |||||||||
| 4 | |||||||||||
| 5 | 6 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | #use AutoLoader qw(AUTOLOAD); | ||||||||||
| 9 | |||||||||||
| 10 | 6 | ▶ | use TeX::Encode; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 6 | our @ISA = qw(Encode::Encoding); | |||||||||
| 13 | |||||||||||
| 14 | 6 | __PACKAGE__->Define(qw(BibTeX bibtex)); | |||||||||
| 15 | |||||||||||
| 16 | # encode($self, $string [,$check]) | ||||||||||
| 17 | sub encode | ||||||||||
| 18 | 0 | ▶ | { | ||||||||
|
Subroutine
encode: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||
| 19 | 0 | my( undef, $string, $check ) = @_; | |||||||||
| 20 | |||||||||||
| 21 | 0 | my $tex = ""; | |||||||||
| 22 | |||||||||||
| 23 | 0 | pos($string) = 0; | |||||||||
| 24 | |||||||||||
| 25 | 0 | for($string) | |||||||||
| 26 | { | ||||||||||
| 27 | 0 | while(1) { | |||||||||
| 28 | 0 | ▶ | last if pos($_) == length($_); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | /\G($TeX::Encode::charmap::BIBTEX_RESERVED_RE)/gc and ($tex .= $TeX::Encode::charmap::BIBTEX_RESERVED{$1}, next); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | |||||||||||
| 32 | # BibTeX requires extra braces around any LaTeX mark-up | ||||||||||
| 33 | # (we assume anything we substitute with will be BibTeX-safe) | ||||||||||
| 34 | 0 | ▶ | /\G($TeX::Encode::charmap::CHAR_MAP_RE)/gc and ($tex .= '{'.$TeX::Encode::charmap::CHAR_MAP{$1}.'}', next); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | |||||||||||
| 36 | # basic unreserved characters | ||||||||||
| 37 | 0 | ▶ | /\G([\sa-zA-Z0-9\.,:;'"\(\)=\-\/\[\]\*\+!]+)/gc and ($tex .= $1, next); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 0 | ▶ | /\G([\x00-\x7e])/gc and ($tex .= $1, next); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | /\G(.)/gc and ($tex .= '?', next); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | |||||||||||
| 42 | 0 | Carp::confess "Shouldn't happen"; | |||||||||
| 43 | } | ||||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 0 | return $tex; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | # encode_url($self, $string [,$check]) | ||||||||||
| 50 | sub encode_url | ||||||||||
| 51 | 0 | ▶ | { | ||||||||
|
Subroutine
encode_url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 52 | 0 | my( undef, $str, $check ) = @_; | |||||||||
| 53 | |||||||||||
| 54 | # replace braces/slash (URL???) and underscore with their URI escape points | ||||||||||
| 55 | 0 | $str =~ s/([\{\}\\_])/sprintf("%%%02x",ord($1))/seg; | |||||||||
| 56 | 0 | $str =~ s/(%)/$TeX::Encode::charmap::BIBTEX_RESERVED{$1}/sg; | |||||||||
| 57 | |||||||||||
| 58 | 0 | return $str; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | # decode($octets [,$check]) | ||||||||||
| 62 | sub decode | ||||||||||
| 63 | 0 | ▶ | { | ||||||||
|
Subroutine
decode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 64 | 0 | return &TeX::Encode::decode; | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 0 | ▶ | sub perlio_ok { 0 } | ||||||||
|
Subroutine
perlio_ok: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 68 | |||||||||||
| 69 | # Autoload methods go after =cut, and are processed by the autosplit program. | ||||||||||
| 70 | |||||||||||
| 71 | 6 | 1; | |||||||||
| 72 | __END__ | ||||||||||