Fossil SCM

Merged in mimetype-list branch.

stephan 2020-01-24 16:45 mimetypes-setting merge
Commit 9ceec69e9b104f44990bbd05831344971851f6cd56d5475c8445772ca607cf36
2 files changed +38 -15 +38 -15
+38 -15
--- src/doc.c
+++ src/doc.c
@@ -476,38 +476,61 @@
476476
** Show the built-in table used to guess embedded document mimetypes
477477
** from file suffixes.
478478
*/
479479
void mimetype_list_page(void){
480480
int i;
481
- char * zCustomList = 0;
481
+ char *zCustomList = 0;
482
+ int nCustomEntries = 0;
482483
mimetype_verify();
483484
style_header("Mimetype List");
484485
@ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename
485
- @ suffixes and the following table to guess at the appropriate mimetype
486
+ @ suffixes and the following tables to guess at the appropriate mimetype
486487
@ for each document.</p>
488
+ @ <h1>Repository-specific mimetypes</h1>
489
+ @ <p>The following extension-to-mimetype mappings are defined via
490
+ @ the <a href="%R/help?cmd=mimetypes">mimetypes setting</a>.</p>
491
+ @ <table class='sortable mimetypetable' border=1 cellpadding=0 \
492
+ @ data-column-types='tt' data-init-sort='0'>
493
+ @ <thead>
494
+ @ <tr><th>Suffix<th>Mimetype
495
+ @ </thead>
496
+ @ <tbody>
497
+ zCustomList = db_get("mimetypes",0);
498
+ if( zCustomList!=0 ){
499
+ Blob list, entry, key, val;
500
+ blob_set(&list, zCustomList);
501
+ while( blob_line(&list, &entry)>0 ){
502
+ const char *zKey;
503
+ if( blob_token(&entry, &key)==0 ) continue;
504
+ if( blob_token(&entry, &val)==0 ) continue;
505
+ zKey = blob_str(&key);
506
+ if( zKey[0]=='.' ) zKey++;
507
+ @ <tr><td>%h(zKey)<td>%h(blob_str(&val))</tr>
508
+ nCustomEntries++;
509
+ }
510
+ fossil_free(zCustomList);
511
+ }
512
+ if( nCustomEntries==0 ){
513
+ @ <tr><td colspan="2"><em>none</em></tr>
514
+ }
515
+ @ </tbody></table>
516
+ @ <h1>Default built-in mimetypes</h1>
517
+ @ <p>Entries starting with an exclamation mark <em><strong>!</strong></em>
518
+ @ are overwritten by repository-specific settings.</p>
487519
@ <table class='sortable mimetypetable' border=1 cellpadding=0 \
488520
@ data-column-types='tt' data-init-sort='1'>
489521
@ <thead>
490522
@ <tr><th>Suffix<th>Mimetype
491523
@ </thead>
492524
@ <tbody>
493525
for(i=0; i<count(aMime); i++){
494
- @ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
526
+ const char *zFlag = mimetype_from_name_custom(aMime[i].zSuffix)==0
527
+ ? "" : "<em><strong>!</strong></em> ";
528
+ @ <tr><td>%s(zFlag)%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
495529
}
496530
@ </tbody></table>
497
- zCustomList = db_get("mimetypes",0);
498
- if(zCustomList!=0){
499
- /* TODO: render this as a table, rather than a TEXTAREA. That
500
- ** requires tokenizing the input, though, duplicating much of the
501
- ** work done in mimetype_from_name_custom().
502
- */
503
- @ <h1>Repo-specific mimetypes</h1>
504
- @ The following extention-to-mimetype mappings are defined via the
505
- @ <a href="%R/help?cmd=mimetypes">mimetypes setting</a>:<br>
506
- @ <textarea rows='10' cols='40' readonly>%h(zCustomList)</textarea>
507
- fossil_free(zCustomList);
508
- }
531
+ style_table_sorter();
509532
style_footer();
510533
}
511534
512535
/*
513536
** Check to see if the file in the pContent blob is "embedded HTML". Return
514537
--- src/doc.c
+++ src/doc.c
@@ -476,38 +476,61 @@
476 ** Show the built-in table used to guess embedded document mimetypes
477 ** from file suffixes.
478 */
479 void mimetype_list_page(void){
480 int i;
481 char * zCustomList = 0;
 
482 mimetype_verify();
483 style_header("Mimetype List");
484 @ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename
485 @ suffixes and the following table to guess at the appropriate mimetype
486 @ for each document.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487 @ <table class='sortable mimetypetable' border=1 cellpadding=0 \
488 @ data-column-types='tt' data-init-sort='1'>
489 @ <thead>
490 @ <tr><th>Suffix<th>Mimetype
491 @ </thead>
492 @ <tbody>
493 for(i=0; i<count(aMime); i++){
494 @ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
 
 
495 }
496 @ </tbody></table>
497 zCustomList = db_get("mimetypes",0);
498 if(zCustomList!=0){
499 /* TODO: render this as a table, rather than a TEXTAREA. That
500 ** requires tokenizing the input, though, duplicating much of the
501 ** work done in mimetype_from_name_custom().
502 */
503 @ <h1>Repo-specific mimetypes</h1>
504 @ The following extention-to-mimetype mappings are defined via the
505 @ <a href="%R/help?cmd=mimetypes">mimetypes setting</a>:<br>
506 @ <textarea rows='10' cols='40' readonly>%h(zCustomList)</textarea>
507 fossil_free(zCustomList);
508 }
509 style_footer();
510 }
511
512 /*
513 ** Check to see if the file in the pContent blob is "embedded HTML". Return
514
--- src/doc.c
+++ src/doc.c
@@ -476,38 +476,61 @@
476 ** Show the built-in table used to guess embedded document mimetypes
477 ** from file suffixes.
478 */
479 void mimetype_list_page(void){
480 int i;
481 char *zCustomList = 0;
482 int nCustomEntries = 0;
483 mimetype_verify();
484 style_header("Mimetype List");
485 @ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename
486 @ suffixes and the following tables to guess at the appropriate mimetype
487 @ for each document.</p>
488 @ <h1>Repository-specific mimetypes</h1>
489 @ <p>The following extension-to-mimetype mappings are defined via
490 @ the <a href="%R/help?cmd=mimetypes">mimetypes setting</a>.</p>
491 @ <table class='sortable mimetypetable' border=1 cellpadding=0 \
492 @ data-column-types='tt' data-init-sort='0'>
493 @ <thead>
494 @ <tr><th>Suffix<th>Mimetype
495 @ </thead>
496 @ <tbody>
497 zCustomList = db_get("mimetypes",0);
498 if( zCustomList!=0 ){
499 Blob list, entry, key, val;
500 blob_set(&list, zCustomList);
501 while( blob_line(&list, &entry)>0 ){
502 const char *zKey;
503 if( blob_token(&entry, &key)==0 ) continue;
504 if( blob_token(&entry, &val)==0 ) continue;
505 zKey = blob_str(&key);
506 if( zKey[0]=='.' ) zKey++;
507 @ <tr><td>%h(zKey)<td>%h(blob_str(&val))</tr>
508 nCustomEntries++;
509 }
510 fossil_free(zCustomList);
511 }
512 if( nCustomEntries==0 ){
513 @ <tr><td colspan="2"><em>none</em></tr>
514 }
515 @ </tbody></table>
516 @ <h1>Default built-in mimetypes</h1>
517 @ <p>Entries starting with an exclamation mark <em><strong>!</strong></em>
518 @ are overwritten by repository-specific settings.</p>
519 @ <table class='sortable mimetypetable' border=1 cellpadding=0 \
520 @ data-column-types='tt' data-init-sort='1'>
521 @ <thead>
522 @ <tr><th>Suffix<th>Mimetype
523 @ </thead>
524 @ <tbody>
525 for(i=0; i<count(aMime); i++){
526 const char *zFlag = mimetype_from_name_custom(aMime[i].zSuffix)==0
527 ? "" : "<em><strong>!</strong></em> ";
528 @ <tr><td>%s(zFlag)%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
529 }
530 @ </tbody></table>
531 style_table_sorter();
 
 
 
 
 
 
 
 
 
 
 
532 style_footer();
533 }
534
535 /*
536 ** Check to see if the file in the pContent blob is "embedded HTML". Return
537
+38 -15
--- src/doc.c
+++ src/doc.c
@@ -476,38 +476,61 @@
476476
** Show the built-in table used to guess embedded document mimetypes
477477
** from file suffixes.
478478
*/
479479
void mimetype_list_page(void){
480480
int i;
481
- char * zCustomList = 0;
481
+ char *zCustomList = 0;
482
+ int nCustomEntries = 0;
482483
mimetype_verify();
483484
style_header("Mimetype List");
484485
@ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename
485
- @ suffixes and the following table to guess at the appropriate mimetype
486
+ @ suffixes and the following tables to guess at the appropriate mimetype
486487
@ for each document.</p>
488
+ @ <h1>Repository-specific mimetypes</h1>
489
+ @ <p>The following extension-to-mimetype mappings are defined via
490
+ @ the <a href="%R/help?cmd=mimetypes">mimetypes setting</a>.</p>
491
+ @ <table class='sortable mimetypetable' border=1 cellpadding=0 \
492
+ @ data-column-types='tt' data-init-sort='0'>
493
+ @ <thead>
494
+ @ <tr><th>Suffix<th>Mimetype
495
+ @ </thead>
496
+ @ <tbody>
497
+ zCustomList = db_get("mimetypes",0);
498
+ if( zCustomList!=0 ){
499
+ Blob list, entry, key, val;
500
+ blob_set(&list, zCustomList);
501
+ while( blob_line(&list, &entry)>0 ){
502
+ const char *zKey;
503
+ if( blob_token(&entry, &key)==0 ) continue;
504
+ if( blob_token(&entry, &val)==0 ) continue;
505
+ zKey = blob_str(&key);
506
+ if( zKey[0]=='.' ) zKey++;
507
+ @ <tr><td>%h(zKey)<td>%h(blob_str(&val))</tr>
508
+ nCustomEntries++;
509
+ }
510
+ fossil_free(zCustomList);
511
+ }
512
+ if( nCustomEntries==0 ){
513
+ @ <tr><td colspan="2"><em>none</em></tr>
514
+ }
515
+ @ </tbody></table>
516
+ @ <h1>Default built-in mimetypes</h1>
517
+ @ <p>Entries starting with an exclamation mark <em><strong>!</strong></em>
518
+ @ are overwritten by repository-specific settings.</p>
487519
@ <table class='sortable mimetypetable' border=1 cellpadding=0 \
488520
@ data-column-types='tt' data-init-sort='1'>
489521
@ <thead>
490522
@ <tr><th>Suffix<th>Mimetype
491523
@ </thead>
492524
@ <tbody>
493525
for(i=0; i<count(aMime); i++){
494
- @ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
526
+ const char *zFlag = mimetype_from_name_custom(aMime[i].zSuffix)==0
527
+ ? "" : "<em><strong>!</strong></em> ";
528
+ @ <tr><td>%s(zFlag)%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
495529
}
496530
@ </tbody></table>
497
- zCustomList = db_get("mimetypes",0);
498
- if(zCustomList!=0){
499
- /* TODO: render this as a table, rather than a TEXTAREA. That
500
- ** requires tokenizing the input, though, duplicating much of the
501
- ** work done in mimetype_from_name_custom().
502
- */
503
- @ <h1>Repo-specific mimetypes</h1>
504
- @ The following extention-to-mimetype mappings are defined via the
505
- @ <a href="%R/help?cmd=mimetypes">mimetypes setting</a>:<br>
506
- @ <textarea rows='10' cols='40' readonly>%h(zCustomList)</textarea>
507
- fossil_free(zCustomList);
508
- }
531
+ style_table_sorter();
509532
style_footer();
510533
}
511534
512535
/*
513536
** Check to see if the file in the pContent blob is "embedded HTML". Return
514537
--- src/doc.c
+++ src/doc.c
@@ -476,38 +476,61 @@
476 ** Show the built-in table used to guess embedded document mimetypes
477 ** from file suffixes.
478 */
479 void mimetype_list_page(void){
480 int i;
481 char * zCustomList = 0;
 
482 mimetype_verify();
483 style_header("Mimetype List");
484 @ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename
485 @ suffixes and the following table to guess at the appropriate mimetype
486 @ for each document.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487 @ <table class='sortable mimetypetable' border=1 cellpadding=0 \
488 @ data-column-types='tt' data-init-sort='1'>
489 @ <thead>
490 @ <tr><th>Suffix<th>Mimetype
491 @ </thead>
492 @ <tbody>
493 for(i=0; i<count(aMime); i++){
494 @ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
 
 
495 }
496 @ </tbody></table>
497 zCustomList = db_get("mimetypes",0);
498 if(zCustomList!=0){
499 /* TODO: render this as a table, rather than a TEXTAREA. That
500 ** requires tokenizing the input, though, duplicating much of the
501 ** work done in mimetype_from_name_custom().
502 */
503 @ <h1>Repo-specific mimetypes</h1>
504 @ The following extention-to-mimetype mappings are defined via the
505 @ <a href="%R/help?cmd=mimetypes">mimetypes setting</a>:<br>
506 @ <textarea rows='10' cols='40' readonly>%h(zCustomList)</textarea>
507 fossil_free(zCustomList);
508 }
509 style_footer();
510 }
511
512 /*
513 ** Check to see if the file in the pContent blob is "embedded HTML". Return
514
--- src/doc.c
+++ src/doc.c
@@ -476,38 +476,61 @@
476 ** Show the built-in table used to guess embedded document mimetypes
477 ** from file suffixes.
478 */
479 void mimetype_list_page(void){
480 int i;
481 char *zCustomList = 0;
482 int nCustomEntries = 0;
483 mimetype_verify();
484 style_header("Mimetype List");
485 @ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename
486 @ suffixes and the following tables to guess at the appropriate mimetype
487 @ for each document.</p>
488 @ <h1>Repository-specific mimetypes</h1>
489 @ <p>The following extension-to-mimetype mappings are defined via
490 @ the <a href="%R/help?cmd=mimetypes">mimetypes setting</a>.</p>
491 @ <table class='sortable mimetypetable' border=1 cellpadding=0 \
492 @ data-column-types='tt' data-init-sort='0'>
493 @ <thead>
494 @ <tr><th>Suffix<th>Mimetype
495 @ </thead>
496 @ <tbody>
497 zCustomList = db_get("mimetypes",0);
498 if( zCustomList!=0 ){
499 Blob list, entry, key, val;
500 blob_set(&list, zCustomList);
501 while( blob_line(&list, &entry)>0 ){
502 const char *zKey;
503 if( blob_token(&entry, &key)==0 ) continue;
504 if( blob_token(&entry, &val)==0 ) continue;
505 zKey = blob_str(&key);
506 if( zKey[0]=='.' ) zKey++;
507 @ <tr><td>%h(zKey)<td>%h(blob_str(&val))</tr>
508 nCustomEntries++;
509 }
510 fossil_free(zCustomList);
511 }
512 if( nCustomEntries==0 ){
513 @ <tr><td colspan="2"><em>none</em></tr>
514 }
515 @ </tbody></table>
516 @ <h1>Default built-in mimetypes</h1>
517 @ <p>Entries starting with an exclamation mark <em><strong>!</strong></em>
518 @ are overwritten by repository-specific settings.</p>
519 @ <table class='sortable mimetypetable' border=1 cellpadding=0 \
520 @ data-column-types='tt' data-init-sort='1'>
521 @ <thead>
522 @ <tr><th>Suffix<th>Mimetype
523 @ </thead>
524 @ <tbody>
525 for(i=0; i<count(aMime); i++){
526 const char *zFlag = mimetype_from_name_custom(aMime[i].zSuffix)==0
527 ? "" : "<em><strong>!</strong></em> ";
528 @ <tr><td>%s(zFlag)%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
529 }
530 @ </tbody></table>
531 style_table_sorter();
 
 
 
 
 
 
 
 
 
 
 
532 style_footer();
533 }
534
535 /*
536 ** Check to see if the file in the pContent blob is "embedded HTML". Return
537

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button