aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQieerb <qieerbushe7@gmail.com>2018-03-22 14:04:09 +0000
committerQieerb <qieerbushe7@gmail.com>2018-03-22 14:04:09 +0000
commit548773ee47497982547b1820b6a02eb4cd14016b (patch)
treea05bb2cc49248b43186b7a77ddbdde280cc86f80
parent7d47d978f01fe8f328e76b541e227f45953e5302 (diff)
downloadFMark-548773ee47497982547b1820b6a02eb4cd14016b.tar.gz
FMark-548773ee47497982547b1820b6a02eb4cd14016b.zip
Sorts footers
-rw-r--r--FMark/src/Common/TOCite/.gitignore2
-rw-r--r--FMark/src/Common/TOCite/TOCite.fs8
-rw-r--r--FMark/src/Common/TOCite/TOCiteTest.fs6
-rw-r--r--examples/example.fmark28
4 files changed, 38 insertions, 6 deletions
diff --git a/FMark/src/Common/TOCite/.gitignore b/FMark/src/Common/TOCite/.gitignore
index f67ed2e..562f626 100644
--- a/FMark/src/Common/TOCite/.gitignore
+++ b/FMark/src/Common/TOCite/.gitignore
@@ -4,4 +4,4 @@ Debug
*.cache
*.pdb
*.dll
-mytest.fmark \ No newline at end of file
+mytest.fsx \ No newline at end of file
diff --git a/FMark/src/Common/TOCite/TOCite.fs b/FMark/src/Common/TOCite/TOCite.fs
index 3f45e24..fc32ff1 100644
--- a/FMark/src/Common/TOCite/TOCite.fs
+++ b/FMark/src/Common/TOCite/TOCite.fs
@@ -123,7 +123,13 @@ let citeGen' tLst =
match style with
| Some s -> citeParse' s tl
| None -> citeParse' Harvard tLst // use harvard as default style
- ftLst,tLst
+ let sortFt ft1 ft2 =
+ match ft1,ft2 with
+ | Footnote (i,_), Footnote (j,_) -> i-j
+ | Citation _, Footnote _ -> 1
+ | Footnote _, Citation _ -> -1
+ | _, _ -> 0
+ List.sortWith sortFt ftLst, tLst
let preParser tLst =
citeGen' tLst
diff --git a/FMark/src/Common/TOCite/TOCiteTest.fs b/FMark/src/Common/TOCite/TOCiteTest.fs
index 5ec0210..186808f 100644
--- a/FMark/src/Common/TOCite/TOCiteTest.fs
+++ b/FMark/src/Common/TOCite/TOCiteTest.fs
@@ -156,12 +156,12 @@ let testDataFt = [
[LITERAL "text3"; ENDLINE]
);
- "Footer texts no sorting",
+ "Footer texts with sorting",
[LSBRA; CARET; NUMBER "3"; RSBRA; COMMA; LITERAL "text3"; ENDLINE;
LSBRA; CARET; NUMBER "1"; RSBRA; COMMA; LITERAL "text1"; ENDLINE],
(
- [Footnote (3,[FrmtedString (Literal "text3")]);
- Footnote (1,[FrmtedString (Literal "text1")])],
+ [Footnote (1,[FrmtedString (Literal "text1")]);
+ Footnote (3,[FrmtedString (Literal "text3")])],
[]
)
diff --git a/examples/example.fmark b/examples/example.fmark
index 47db26c..360f910 100644
--- a/examples/example.fmark
+++ b/examples/example.fmark
@@ -1,3 +1,5 @@
+%%Style= Harvard
+
# FMark Example
## Table of contents
@@ -93,4 +95,28 @@ Unordered List 2:
$$2* \begin{pmatrix}
x_{00} & x_{01} & x_{01} \newline
x_{10} & x_{11} & x_{11} \newline
-x_{20} & x_{21} & x_{21} \end{pmatrix}$$ \ No newline at end of file
+x_{20} & x_{21} & x_{21} \end{pmatrix}$$
+
+## Footers
+
+### Simple footnote
+
+Here are some[^1] words, and more words[^2].
+
+[^2], A few lines to explain the words.
+ Another line to explain the words.
+
+[^1], We should probably sort them by ID numbers.
+
+### References
+
+All footnotes are collected and displayed at the end of the document[^Eric].
+The style of references are set at the top of the document.
+
+[^Eric], type= Book, author= Not Eric, year= 2018, title= An Introduction to FMark
+
+Note: Simple footnotes takes numerical IDs, and references need alphabetical IDs.
+
+# Other things
+
+Look the footers are rendered below this.