Fossil SCM

Fix a bug in the markdown_to_html() routine in finding the title of the document. *This change requires a search index rebuild*. Begin adding documentation on how the header/footer mechanism works.

drh 2015-02-16 19:27 trunk
Commit e214a576ea0dc1c88f2f6e5c39cf161d4a54e6db
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -82,14 +82,18 @@
8282
}
8383
}
8484
8585
8686
/* HTML block tags */
87
+
88
+/* Size of the prolog: "<div class='markdown'>\n" */
89
+#define PROLOG_SIZE 23
8790
8891
static void html_prolog(struct Blob *ob, void *opaque){
8992
INTER_BLOCK(ob);
9093
BLOB_APPEND_LITTERAL(ob, "<div class=\"markdown\">\n");
94
+ assert( blob_size(ob)==PROLOG_SIZE );
9195
}
9296
9397
static void html_epilog(struct Blob *ob, void *opaque){
9498
INTER_BLOCK(ob);
9599
BLOB_APPEND_LITTERAL(ob, "</div>\n");
@@ -126,13 +130,12 @@
126130
void *opaque
127131
){
128132
struct Blob *title = opaque;
129133
/* The first header at the beginning of a text is considered as
130134
* a title and not output. */
131
- if( blob_size(ob)==0 && blob_size(title)==0 ){
135
+ if( blob_size(ob)<=PROLOG_SIZE && blob_size(title)==0 ){
132136
BLOB_APPEND_BLOB(title, text);
133
- return;
134137
}
135138
INTER_BLOCK(ob);
136139
blob_appendf(ob, "<h%d>", level);
137140
BLOB_APPEND_BLOB(ob, text);
138141
blob_appendf(ob, "</h%d>", level);
139142
140143
ADDED www/customskin.md
141144
ADDED www/th1.md
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -82,14 +82,18 @@
82 }
83 }
84
85
86 /* HTML block tags */
 
 
 
87
88 static void html_prolog(struct Blob *ob, void *opaque){
89 INTER_BLOCK(ob);
90 BLOB_APPEND_LITTERAL(ob, "<div class=\"markdown\">\n");
 
91 }
92
93 static void html_epilog(struct Blob *ob, void *opaque){
94 INTER_BLOCK(ob);
95 BLOB_APPEND_LITTERAL(ob, "</div>\n");
@@ -126,13 +130,12 @@
126 void *opaque
127 ){
128 struct Blob *title = opaque;
129 /* The first header at the beginning of a text is considered as
130 * a title and not output. */
131 if( blob_size(ob)==0 && blob_size(title)==0 ){
132 BLOB_APPEND_BLOB(title, text);
133 return;
134 }
135 INTER_BLOCK(ob);
136 blob_appendf(ob, "<h%d>", level);
137 BLOB_APPEND_BLOB(ob, text);
138 blob_appendf(ob, "</h%d>", level);
139
140 DDED www/customskin.md
141 DDED www/th1.md
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -82,14 +82,18 @@
82 }
83 }
84
85
86 /* HTML block tags */
87
88 /* Size of the prolog: "<div class='markdown'>\n" */
89 #define PROLOG_SIZE 23
90
91 static void html_prolog(struct Blob *ob, void *opaque){
92 INTER_BLOCK(ob);
93 BLOB_APPEND_LITTERAL(ob, "<div class=\"markdown\">\n");
94 assert( blob_size(ob)==PROLOG_SIZE );
95 }
96
97 static void html_epilog(struct Blob *ob, void *opaque){
98 INTER_BLOCK(ob);
99 BLOB_APPEND_LITTERAL(ob, "</div>\n");
@@ -126,13 +130,12 @@
130 void *opaque
131 ){
132 struct Blob *title = opaque;
133 /* The first header at the beginning of a text is considered as
134 * a title and not output. */
135 if( blob_size(ob)<=PROLOG_SIZE && blob_size(title)==0 ){
136 BLOB_APPEND_BLOB(title, text);
 
137 }
138 INTER_BLOCK(ob);
139 blob_appendf(ob, "<h%d>", level);
140 BLOB_APPEND_BLOB(ob, text);
141 blob_appendf(ob, "</h%d>", level);
142
143 DDED www/customskin.md
144 DDED www/th1.md
--- a/www/customskin.md
+++ b/www/customskin.md
@@ -0,0 +1,11 @@
1
+Customizing Fossi=======onal)default header looks# Sk</div
2
+Tcontent sectionnd the footer# SkNoticee that there are no `<html>` or `<head>` elements in the header,
3
+nonu.
4
+'>of Fossil-generated pages is not normally
5
+customizable. The appearance of Fossil is mostly governed by the CSS,
6
+header, and footer, all of which are changeable o
7
+that text is allowed to contain
8
+embedded [TH1](./th1.md) script to modify or change its content.
9
+With the header or footer, all text between &lt;th1&gt;...&lt;/th1&gt;
10
+is run as a TH1 script. And elements of the form &lt;$NAME&gt; are
11
+replaced by the value of the NAME variable in TH1. This
--- a/www/customskin.md
+++ b/www/customskin.md
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
--- a/www/customskin.md
+++ b/www/customskin.md
@@ -0,0 +1,11 @@
1 Customizing Fossi=======onal)default header looks# Sk</div
2 Tcontent sectionnd the footer# SkNoticee that there are no `<html>` or `<head>` elements in the header,
3 nonu.
4 '>of Fossil-generated pages is not normally
5 customizable. The appearance of Fossil is mostly governed by the CSS,
6 header, and footer, all of which are changeable o
7 that text is allowed to contain
8 embedded [TH1](./th1.md) script to modify or change its content.
9 With the header or footer, all text between &lt;th1&gt;...&lt;/th1&gt;
10 is run as a TH1 script. And elements of the form &lt;$NAME&gt; are
11 replaced by the value of the NAME variable in TH1. This
+2
--- a/www/th1.md
+++ b/www/th1.md
@@ -0,0 +1,2 @@
1
+ sCL CLCLCLCLCL. Refer to the
2
+TCL ttpiz_main.c or thsource fileeach each command does.
--- a/www/th1.md
+++ b/www/th1.md
@@ -0,0 +1,2 @@
 
 
--- a/www/th1.md
+++ b/www/th1.md
@@ -0,0 +1,2 @@
1 sCL CLCLCLCLCL. Refer to the
2 TCL ttpiz_main.c or thsource fileeach each command does.

Keyboard Shortcuts

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