|
40 | 40 | return $str;
|
41 | 41 | }
|
42 | 42 |
|
| 43 | +my $properNames = <<'EON'; |
| 44 | + .NET Core |
| 45 | + AI Inference |
| 46 | + AWS Lambda |
| 47 | + Azure |
| 48 | + Cassandra |
| 49 | + Cloud Run |
| 50 | + Common Language Runtime |
| 51 | + Compute Engine |
| 52 | + Connect RPC |
| 53 | + Cosmos |
| 54 | + Elasticsearch |
| 55 | + Go |
| 56 | + Google |
| 57 | + Google Cloud |
| 58 | + Kafka |
| 59 | + Kestrel |
| 60 | + Kubernetes |
| 61 | + Microsoft |
| 62 | + Node.js |
| 63 | + Pub/Sub |
| 64 | + Redis |
| 65 | +EON |
| 66 | + |
| 67 | +my @properNames = |
| 68 | + grep { /\S/ } # drop blank lines |
| 69 | + map { s/^\s+|\s+$//gr } # trim whitespace |
| 70 | + split(/\n/, $properNames); |
| 71 | + |
43 | 72 | sub toSentenceCase($) {
|
44 | 73 | my ($str) = @_;
|
45 | 74 |
|
|
50 | 79 | $str =~ s/^([a-z][a-z0-9]*)\b/\u$1/;
|
51 | 80 |
|
52 | 81 | # Handle exceptions
|
53 |
| - $str =~ s/(.NET) (core)/$1 \u$2/; |
54 |
| - $str =~ s/(AI) (inference)/$1 \u$2/; |
55 |
| - $str =~ s|google cloud|Google Cloud|i; |
56 |
| - $str =~ s|pub/sub|Pub/Sub|; |
| 82 | + for my $name (@properNames) { |
| 83 | + $str =~ s/\b\Q$name\E\b/$name/gi; |
| 84 | + } |
| 85 | + $str =~ s/Function(.)as.a.Service/Function$1as$1a$1Service/i; |
57 | 86 |
|
58 | 87 | return $str;
|
59 | 88 | }
|
|
70 | 99 | if ($title =~ /^OpenTelemetry (Protocol )?(.*)/) {
|
71 | 100 | $linkTitle = $2;
|
72 | 101 | } elsif ($title =~ /^(.*?) Semantic Conventions?$/i) {
|
73 |
| - $linkTitle = toTitleCase($1); |
| 102 | + $linkTitle = $1; # toTitleCase($1); |
74 | 103 | } elsif ($title =~ /^.*? for (.*)$/i) {
|
75 |
| - $linkTitle = toTitleCase($1); |
| 104 | + $linkTitle = $1; # toTitleCase($1); |
76 | 105 | }
|
77 | 106 | if ($linkTitle =~ /^Function.as.a.Service$/i) {
|
78 | 107 | $linkTitle = 'FaaS';
|
|
87 | 116 | } elsif ($linkTitle =~ /^(Exceptions|Feature Flags) .. (.*)$/i) {
|
88 | 117 | $linkTitle = $2;
|
89 | 118 | }
|
90 |
| - if ($linkTitle =~ /^(.*) Attributes$/i && $title ne 'General Attributes') { |
91 |
| - $linkTitle = $1; |
92 |
| - } |
93 | 119 |
|
94 |
| - $linkTitle = 'Events' if $linkTitle =~ /Mobile Events/; |
| 120 | + $linkTitle = 'Events' if $linkTitle =~ /Mobile Events/i; |
95 | 121 | $linkTitle = 'Connect' if $title =~ /Connect RPC$/i;
|
96 | 122 | $linkTitle = 'HTTP' if $linkTitle =~ /^HTTP Client and Server/i;
|
97 | 123 | $linkTitle = 'SQL' if $title =~ /SQL Databases$/i;
|
98 | 124 | $linkTitle = 'System use cases' if $title =~ /System .*?General Use Cases/i;
|
99 | 125 | $linkTitle = $1 if $title =~ /Gen(?:erative) ?AI (\w+)$/i && $title !~ /Systems$/i;
|
100 | 126 | $linkTitle = $1 if $title =~ /(OpenAI) \w+$/i;
|
101 | 127 |
|
102 |
| - # Missing an `s` in "Semantic Convention"? |
103 |
| - if ($title =~ /^Semantic Convention\b/i and $title !~ /Groups$/i) { |
104 |
| - $title =~ s/Semantic Convention\b/$&s/ig; |
| 128 | + # Missing an `s` in "Semantic convention"? |
| 129 | + if ($title =~ /^Semantic convention\b/i and $title !~ /Groups$/i) { |
| 130 | + $title =~ s/Semantic convention\b/$&s/ig; |
105 | 131 | printf STDOUT "> $title -> $linkTitle - added 's' to 'Conventions'\n";
|
106 | 132 | }
|
107 |
| - $linkTitle =~ s/^(Database|Messaging) Client //; |
| 133 | + $linkTitle =~ s/^(Database|Messaging) Client //i; |
108 | 134 | if ($ARGV =~ /docs\/azure/) {
|
109 | 135 | $linkTitle =~ s/ Resource Logs?//i;
|
110 | 136 | $linkTitle =~ s/Azure //i;
|
|
117 | 143 | unless $ARGV =~ /gen-ai-metrics/;
|
118 | 144 | $linkTitle =~ s/ (components|guide|queries|supplementary information|systems|platform)$//i;
|
119 | 145 | $linkTitle =~ s/ \(command line interface\)//i;
|
120 |
| - $linkTitle =~ s/ resources$//i; |
| 146 | + $linkTitle =~ s/ (attributes|resources)$//i; |
121 | 147 | $linkTitle =~ s/(Process) and process runtime$/$1/i;
|
122 | 148 |
|
123 | 149 | $linkTitle = '.NET' if $linkTitle =~ /.net common language runtime/i;
|
|
129 | 155 |
|
130 | 156 | $frontMatter .= $frontMatterFromFile if $frontMatterFromFile;
|
131 | 157 |
|
132 |
| - if ($linkTitle && $linkTitle ne $title) { |
133 |
| - $linkTitle = toSentenceCase($linkTitle); # unless $linkTitle =~ /^gRPC/; |
134 |
| - if ($frontMatter !~ /linkTitle: /) { |
| 158 | + $linkTitle = toSentenceCase($linkTitle); |
| 159 | + if ($linkTitle) { |
| 160 | + if ($frontMatter !~ /linkTitle: / && $linkTitle ne $title) { |
135 | 161 | $frontMatter .= "linkTitle: $linkTitle\n";
|
136 | 162 | } elsif ($frontMatter !~ /^auto_gen:/m) {
|
137 | 163 | $frontMatter =~ s/^(linkTitle: ).*$/$1$linkTitle/m;
|
138 | 164 | }
|
139 | 165 | }
|
140 | 166 |
|
141 |
| - if ($ARGV =~ /docs\/(.*?)(README|_index).md$/) { |
142 |
| - $frontMatter .= "path_base_for_github_subdir:\n"; |
143 |
| - $frontMatter .= " from: tmp/semconv/docs/$1_index.md\n"; |
144 |
| - $frontMatter .= " to: $1README.md\n"; |
145 |
| - } |
| 167 | + # if ($ARGV =~ /docs\/(.*?)(README|_index).md$/) { |
| 168 | + # $frontMatter .= "path_base_for_github_subdir:\n"; |
| 169 | + # $frontMatter .= " from: tmp/semconv/docs/$1_index.md\n"; |
| 170 | + # $frontMatter .= " to: $1README.md\n"; |
| 171 | + # } |
146 | 172 |
|
147 | 173 | return $frontMatter;
|
148 | 174 | }
|
|
157 | 183 | }
|
158 | 184 |
|
159 | 185 | print $beforeTitle if $beforeTitle;
|
160 |
| - $title = toTitleCase($title); |
| 186 | + $title = toSentenceCase($title); |
161 | 187 | print "# $title\n"
|
162 | 188 | }
|
163 | 189 |
|
|
0 commit comments