diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-03-23 10:12:20 +0000 |
---|---|---|
committer | ps-george <george.punter15@imperial.ac.uk> | 2018-03-23 10:12:20 +0000 |
commit | ec43fd6f3eb486d4493827793834268aeede9211 (patch) | |
tree | 57fe60d78c759f14de5aeaf867e09842fb43bbe5 /FMark/src | |
parent | 2ff041b2ff5f3f6a5dca248cf4ed36e1e0b378e0 (diff) | |
download | FMark-ec43fd6f3eb486d4493827793834268aeede9211.tar.gz FMark-ec43fd6f3eb486d4493827793834268aeede9211.zip |
Adding tests for %% (#165)
* Going through ps-george list for readmes_examples
* separating vanilla markdown into implemented list and design decisions
* Updating format
* moving build passing
* adding link to examples.fmark
* Individual README
* README updates
* Update README.md
* Update README.md
* Update README.md
* Update README.md
* typo fix
* Adding tests for %%
* Adding CLI and markalc docs
* remove .html file, can generate from example.fmark
* adding js
Diffstat (limited to 'FMark/src')
-rw-r--r-- | FMark/src/Common/Lexer/LexerTest.fs | 9 | ||||
-rw-r--r-- | FMark/src/Common/Markalc/README.md | 3 | ||||
-rw-r--r-- | FMark/src/Common/Parser/README.md | 2 | ||||
-rw-r--r-- | FMark/src/Common/Shared.fs | 4 | ||||
-rw-r--r-- | FMark/src/Common/TOCite/README.md | 53 |
5 files changed, 53 insertions, 18 deletions
diff --git a/FMark/src/Common/Lexer/LexerTest.fs b/FMark/src/Common/Lexer/LexerTest.fs index 7de338d..2c5c76e 100644 --- a/FMark/src/Common/Lexer/LexerTest.fs +++ b/FMark/src/Common/Lexer/LexerTest.fs @@ -221,6 +221,10 @@ let preprocessTest = "Calling nested macro with two arguments", "{% macro x(a; b) {{a}} {{b}} %} {{x(a; {{x(b; c)}})}}", "a b c" + + "Semicolon should not change", + "%%TOC excludes=[h2;h22]", + "%%TOC excludes=[h2;h22]" ] /// Complete multiline tests for the preprocessor @@ -349,6 +353,11 @@ let lexTest = "Wrong html close tag should be passed through", "<p></>s", [LITERAL "<p>"; LITERAL "</>s"] + + "Semi colon in TOC", + "%%TOC excludes=[h2;h22]", + [PERCENT; PERCENT; LITERAL "TOC"; WHITESPACE 1; LITERAL "excludes"; EQUAL; LSBRA; LITERAL "h2"; SEMICOLON + LITERAL "h22"; RSBRA; ENDLINE] ] /// Tests for the complete lexers with a string list as input diff --git a/FMark/src/Common/Markalc/README.md b/FMark/src/Common/Markalc/README.md index 5848503..d981b89 100644 --- a/FMark/src/Common/Markalc/README.md +++ b/FMark/src/Common/Markalc/README.md @@ -27,8 +27,9 @@ Calcs|39|42| |Addition|`a+b`|a plus b|Property based, all integer inputs. |Brackets|`a+(b-c)`|Specify order of operation.|Unit tested. |Cell References|`[0,2]`|Evaluates to contents of cell specified (row 0, col 2)|Unit tested| -|Range Cell Ref|`[0,0]:[2,0]`|Evaluates to list of cell references.|Unit tested, not fully.| +|Range Cell Ref|`[0,0]:[2,0]`|Evaluates to list of cell references.|Unit tested.| |Keyword Cell Ref|`[col=2,row=0]`|Alternative syntax, order doens't matter.|Unit tested| +|Specify Decimal Places|`=5.333,2`|Comma then a number specifies number of decimal places.|Unit tested| ##### Cell reference behaviour diff --git a/FMark/src/Common/Parser/README.md b/FMark/src/Common/Parser/README.md index b0585f7..232a9c4 100644 --- a/FMark/src/Common/Parser/README.md +++ b/FMark/src/Common/Parser/README.md @@ -1,6 +1,6 @@ # Project Contribution The Parser takes `Token list` from the Lexer(or Tokenizer) and outputs `ParsedObj list`. -After being manipulated be other top level functions, `ParsedObj list` will then be used to generate HTML. +After being manipulated by other top level functions, `ParsedObj list` will then be used to generate HTML. It follows [CommonMark Spec](http://spec.commonmark.org/0.28/). However, the Parser produced in individual-phased work is not a complete Markdown parser, due to limited time. diff --git a/FMark/src/Common/Shared.fs b/FMark/src/Common/Shared.fs index e150c7f..f2d4f63 100644 --- a/FMark/src/Common/Shared.fs +++ b/FMark/src/Common/Shared.fs @@ -23,7 +23,7 @@ let charList = ["#", HASH; "|", PIPE; "=", EQUAL; "-", MINUS; "+", PLUS; "*", AS "___", TUNDERSCORE; "~", TILDE; "~~", DTILDE; "~~~", TTILDE; "[", LSBRA "]", RSBRA; "(", LBRA; ")", RBRA; @"\", BSLASH; "/", SLASH; "<", LABRA ">", RABRA; "{", LCBRA; "}", RCBRA; "`", BACKTICK; - "!", EXCLAMATION; ":", COLON; "^", CARET; "%", PERCENT; ",", COMMA] + "!", EXCLAMATION; ":", COLON; "^", CARET; "%", PERCENT; ",", COMMA; ";", SEMICOLON] let charMap = charList |> List.map invTuple |> Map.ofList @@ -63,4 +63,4 @@ let removeChars lst s = let replaceChars pat (rep:string) s = Regex.Replace(s,pat,rep) let removeWhitespace (s:string) = - s |> removeChars ["\n";"\t";"\r";" "] + s |> removeChars ["\n";"\t";"\r";" "]
\ No newline at end of file diff --git a/FMark/src/Common/TOCite/README.md b/FMark/src/Common/TOCite/README.md index 63c683e..3058236 100644 --- a/FMark/src/Common/TOCite/README.md +++ b/FMark/src/Common/TOCite/README.md @@ -25,7 +25,28 @@ parser, allowing relative linking and other nice things. ## THeader list List of all headers found in the document, arranged by order of -their appearance. +their appearance. This is used to render headers with links in the +main parser, and also table of contents. + +### Table of Contents +Build with `%%TOC`, with optional argument `depth` and `exclude` + +For example, +``` +Paragraph 1 Oh look a butterfly! + +%%TOC depth=3 + +Paragraph 2 Oh noes it flew away :( +``` +This will build a table of content between paragraph 1 and 2, and only +contain headers of level 1 2, and 3. + +``` +%%TOC depth=3, excludes=["Appendix","Acknowledgement"] +``` +This table of content will exclude headers with the specified name. + ## ParsedObj list Both simple footers and references are given as `Footnote (ID * TLine)` @@ -34,6 +55,10 @@ and `Citation (ID * TFrmtedString * TLine)` in the `ParsedObj list`. should be rendered. This allows all style information to be hidden from the main parser. +The list is sorted, with footnotes in order of their numerical IDs first, +References in order of apperance after. Thus the order each explanatory +text comes in the fmark file does not matter. + ### Simple Footers Simple footers have numerical IDs. ``` @@ -72,36 +97,36 @@ Supported data fields |url|Address for website| |access|Date of access for websites, in `yyyy-mm-dd` format| -Pick a style at the beginning, or it will default to Harvard. +Pick a style with `%%RefStyle`, or it will default to Harvard. ``` -%%Style = Harvard +%%RefStyle = Harvard ``` -Then follow `field1= data1, field2= data2, ...` to use references. +Then follow `field1=data1, field2=data2, ...` to use references. +Spaces around equal signs is allowed. ``` -This is a citation[^Zifan]. This is another[^Eric] one. +This is a citation[^Mark]. This is another[^FMark] one. -[^Zifan], type= Book, author= Zifan Wang, title= Not a real book, year= 2018 -[^Eric], type= Website, author= Eric Wang, title= Not a real website, year= 2017 url= www.example.com/website access= 2018-3-4 +[^Mark], type = Book, author = Mark Smith, title = Not a real book, year = 2018 +[^FMark], type=Website, author=FMark Smith, title=Not a real website, year=2017 url=www.example.com/website access=2018-3-4 ``` With Harvard, it will look like this: -> This is a citation(Wang, 2018). This is another(Wang, 2017) one. +> This is a citation(Smith, 2018). This is another(Smith, 2017) one. At the end of the document: -> Wang, Z. (2018) *Not a real book*. +> Smith, M. (2018) *Not a real book*. > -> Wang, E. (2017) *Not a real website*. Available from: www.example.com/website [Accessed 4th March 2018]. +> Smith, F. (2017) *Not a real website*. Available from: www.example.com/website [Accessed 4th March 2018]. if Chicago style is chosen: -> This is a citation(Wang 2018). This is another(Wang 2017) one. +> This is a citation(Smith 2018). This is another(Smith 2017) one. At the end of the document: -> Zifan Wang. 2018. *Not a real book*. +> Mark Smith. 2018. *Not a real book*. > -> Eric Wang. 2017. "Not a real website." Accessed March 3, 2018. https://www.example.com/website - +> FMark Smith. 2017. "Not a real website." Accessed March 3, 2018. https://www.example.com/website --- # ALL INFORMATION AFTER THIS MAYBE OUTDATED |