diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e953742..bf24a4bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,10 +8,10 @@ cmake_minimum_required (VERSION 2.6)
set (My_Project_Title "MultiMarkdown")
set (My_Project_Description "Lightweight markup processor to produce HTML, LaTeX, and more.")
set (My_Project_Author "Fletcher T. Penney")
-set (My_Project_Revised_Date "2017-03-22")
+set (My_Project_Revised_Date "2017-03-28")
set (My_Project_Version_Major 6)
set (My_Project_Version_Minor 0)
-set (My_Project_Version_Patch 0)
+set (My_Project_Version_Patch 1)
set (My_Project_Version "${My_Project_Version_Major}.${My_Project_Version_Minor}.${My_Project_Version_Patch}")
@@ -236,22 +236,33 @@ set (scripts
)
set (latex
- texmf/tex/latex/mmd6/mmd6-article-begin.tex
- texmf/tex/latex/mmd6/mmd6-article-footer.tex
- texmf/tex/latex/mmd6/mmd6-article-leader.tex
- texmf/tex/latex/mmd6/mmd6-criticmarkup.tex
- texmf/tex/latex/mmd6/mmd6-default-metadata.tex
- texmf/tex/latex/mmd6/mmd6-memoir-footer.tex
- texmf/tex/latex/mmd6/mmd6-memoir-layout-8.5x11.tex
- texmf/tex/latex/mmd6/mmd6-memoir-packages.tex
- texmf/tex/latex/mmd6/mmd6-memoir-setup.tex
- texmf/tex/latex/mmd6/mmd6-tufte-book-begin.tex
- texmf/tex/latex/mmd6/mmd6-tufte-book-footer.tex
- texmf/tex/latex/mmd6/mmd6-tufte-book-leader.tex
- texmf/tex/latex/mmd6/mmd6-tufte-footer.tex
- texmf/tex/latex/mmd6/mmd6-tufte-handout-begin.tex
- texmf/tex/latex/mmd6/mmd6-tufte-handout-footer.tex
- texmf/tex/latex/mmd6/mmd6-tufte-handout-leader.tex
+ texmf/tex/latex/mmd6/README.md
+
+ texmf/tex/latex/mmd6/article/mmd6-article-begin.tex
+ texmf/tex/latex/mmd6/article/mmd6-article-footer.tex
+ texmf/tex/latex/mmd6/article/mmd6-article-leader.tex
+
+ texmf/tex/latex/mmd6/letterhead/mmd-envelope.sty
+ texmf/tex/latex/mmd6/letterhead/mmd-letterhead.sty
+ texmf/tex/latex/mmd6/letterhead/mmd6-letterhead-begin.tex
+ texmf/tex/latex/mmd6/letterhead/mmd6-letterhead-footer.tex
+ texmf/tex/latex/mmd6/letterhead/mmd6-letterhead-leader.tex
+
+ texmf/tex/latex/mmd6/shared/mmd6-criticmarkup.tex
+ texmf/tex/latex/mmd6/shared/mmd6-default-metadata.tex
+ texmf/tex/latex/mmd6/shared/mmd6-memoir-footer.tex
+ texmf/tex/latex/mmd6/shared/mmd6-memoir-layout-8.5x11.tex
+ texmf/tex/latex/mmd6/shared/mmd6-memoir-packages.tex
+ texmf/tex/latex/mmd6/shared/mmd6-memoir-setup.tex
+ texmf/tex/latex/mmd6/shared/mmd6-title.tex
+ texmf/tex/latex/mmd6/shared/mmd6-tufte-footer.tex
+
+ texmf/tex/latex/mmd6/tufte-book/mmd6-tufte-book-begin.tex
+ texmf/tex/latex/mmd6/tufte-book/mmd6-tufte-book-footer.tex
+ texmf/tex/latex/mmd6/tufte-book/mmd6-tufte-book-leader.tex
+ texmf/tex/latex/mmd6/tufte-handout/mmd6-tufte-handout-begin.tex
+ texmf/tex/latex/mmd6/tufte-handout/mmd6-tufte-handout-footer.tex
+ texmf/tex/latex/mmd6/tufte-handout/mmd6-tufte-handout-leader.tex
)
# Public headers, will be installed in 'include'
diff --git a/DevelopmentNotes/DevelopmentNotes.epub b/DevelopmentNotes/DevelopmentNotes.epub
index 6e23e8dd..6aef81cb 100644
Binary files a/DevelopmentNotes/DevelopmentNotes.epub and b/DevelopmentNotes/DevelopmentNotes.epub differ
diff --git a/DevelopmentNotes/DevelopmentNotes.fodt b/DevelopmentNotes/DevelopmentNotes.fodt
index 1c76beb7..e642a36b 100644
--- a/DevelopmentNotes/DevelopmentNotes.fodt
+++ b/DevelopmentNotes/DevelopmentNotes.fodt
@@ -274,7 +274,7 @@
2017–03–28 – v 6.0.1: CHANGED: Adjust LaTeX support files CHANGED: Fix potential bug in tokenize function FIXED: Fix bug between ASCII 160 (non–breaking space) and ‘à’ character FIXED: Improve transclude base overriding of search paths, and explain change in QuickStart guide UPDATED: Update QuickStart to include more info about LaTeX 2017–03–22 – v 6.0.0: Version: 6.0.0 Version: 6.0.1 This document serves as a description of MultiMarkdown (MMD) v6, as well as a sample
document to demonstrate the various features. Specifically, differences from
@@ -264,6 +266,74 @@ MMD v6 includes support for substituting certain text phrases in other
languages. This only affects the HTML format. LaTeX support is slightly different than in prior versions of MMD. It is
+designed to be a bit more consistent, and easier for basic use. The previous approach used two types of metadata: In practice, one typically needs to be able to insert MMD 6 standardizes the metadata to use 3 new keys: You can use these 3 keys to replace the old In addition, there is a new shortcut key – Using the new system will require migrating your old configuration to the new
+naming convention, but once done I believe it should me much more intuitive to
+use. The LaTeX support files included with the MMD v6 repository support the use of
+the following **NOTE: You do have to install the MMD support files into the proper location
+**for your system. I would like to make this easier, but haven’t found the
+**best configuration yet. Metadata in MMD v6 includes new support for LaTeX – the Dependencies/Libraries
Changelog
+
diff --git a/DevelopmentNotes/DevelopmentNotes.pdf b/DevelopmentNotes/DevelopmentNotes.pdf
index 92bfca34..62eb9900 100644
Binary files a/DevelopmentNotes/DevelopmentNotes.pdf and b/DevelopmentNotes/DevelopmentNotes.pdf differ
diff --git a/DevelopmentNotes/DevelopmentNotes.txt b/DevelopmentNotes/DevelopmentNotes.txt
index c30260fa..c9102eb5 100644
--- a/DevelopmentNotes/DevelopmentNotes.txt
+++ b/DevelopmentNotes/DevelopmentNotes.txt
@@ -1,6 +1,6 @@
Title: MultiMarkdown v6 Development Notes
Author: Fletcher T. Penney
-Date: 2017-03-22
+Date: 2017-03-28
LaTeX Config: tufte-handout
Base Header Level: 3
uuid: dd2d8e76-dc2d-416d-9acd-5395d20871c2
@@ -466,6 +466,15 @@ more cross-platform approach than that used by MMD v5.
# Changelog #
+* 2017-03-28 -- v 6.0.1:
+
+* CHANGED: Adjust LaTeX support files
+* CHANGED: Fix potential bug in tokenize function
+* FIXED: Fix bug between ASCII 160 (non-breaking space) and 'à' character
+* FIXED: Improve transclude base overriding of search paths, and explain change in QuickStart guide
+* UPDATED: Update QuickStart to include more info about LaTeX
+
+
* 2017-03-22 -- v 6.0.0:
* Version bump
diff --git a/QuickStart/QuickStart.epub b/QuickStart/QuickStart.epub
index 8d41766e..99d8d0c3 100644
Binary files a/QuickStart/QuickStart.epub and b/QuickStart/QuickStart.epub differ
diff --git a/QuickStart/QuickStart.fodt b/QuickStart/QuickStart.fodt
index f6dca727..ea68b506 100644
--- a/QuickStart/QuickStart.fodt
+++ b/QuickStart/QuickStart.fodt
@@ -274,7 +274,7 @@
Introduction
-Internationalization
LaTeX Changes
+
+
+
+
+latex input
– this uses the name of a latex file that will be used in a
+\input{file}
command. This key can be used multiple times (the only
+metadata key that worked this way), and all the basic metadata is written to
+the LaTeX file in order.latex footer
– this file worked the same way as latex input
, but was
+inserted at the end of the file\input
commands at
+only a few key places in the final document:
+
+
+
+
+
+latex leader
– this specifies a file that will be used at the very
+beginning of the document.latex begin
– this comes after metadata, and before the body of the
+document. This will usually include the \begin{document}
command, hence the
+name.latex footer
– this comes after the body of the document.latex input
metadata keys, as
+long as you pay attention as to which is which. If you used more than three
+include statements, you may have to combine your latex files to fit into the
+new system.latex config
. This allows
+you to specify a “document name” that is used to automatically identify the
+corresponding latex leader
, latex begin
, and latex footer
files. For
+example, using latex config: artice
is the same as using:
+
+latex leader: mmd6-article-leader
+latex begin: mmd6-article-begin
+latex footer: mmd6-article-footer
+
latex config
values by default:
+
+
+article
tufte-book
tufte-handout
Metadata
latex config
key
@@ -281,6 +351,76 @@ Table of Contents
Table of Contents functionality is used when exporting to LaTeX or
OpenDocument formats.
File transclusion works basically the same way – {{file}}
is used to
+indicate a file that needs to be transcluded. {{file.*}}
allows for
+wildcard transclusion. What’s different is that the way search paths are
+handled is more flexible, though it may take a moment to understand.
When you process a file with MMD, it uses that file’s directory as the search +path for included files. For example:
+ +Directory | +Transcluded Filename | +Resolved Path | +
---|---|---|
/foo/bar/ |
+ bat |
+ /foo/bar/bat |
+
/foo/bar/ |
+ baz/bat |
+ /foo/bar/baz/bat |
+
/foo/bar/ |
+ ../bat |
+ /foo/bat |
+
This is the same as MMD v 5. What’s different is that when you transclude a
+file, the search path stays the same as the “parent” file, UNLESS you use
+the transclude base
metadata to override it. The simplest override is:
transclude base: .
+
+
+This means that any transclusions within the file will be calculated relative +to the file, regardless of the original search path.
+ +Alternatively you could specify that any transclusion happens inside a +subfolder:
+ +transclude base: folder/
+
+
+Or you can specify an absolute path:
+ +transclude base: /some/path
+
+
+This flexibility means that you can transclude different files based on +whether a file is being processed by itself or as part of a “parent” file. +This can be useful when a particular file can either be a standalone document, +or a chapter inside a larger document.
+Some features I plan to implement at some point:
diff --git a/QuickStart/QuickStart.pdf b/QuickStart/QuickStart.pdf index 00d00e83..92ddb34b 100644 Binary files a/QuickStart/QuickStart.pdf and b/QuickStart/QuickStart.pdf differ diff --git a/QuickStart/QuickStart.txt b/QuickStart/QuickStart.txt index 0021f603..57ec3b1b 100644 --- a/QuickStart/QuickStart.txt +++ b/QuickStart/QuickStart.txt @@ -1,6 +1,6 @@ Title: MultiMarkdown v6 Quick Start Guide Author: Fletcher T. Penney -Version: 6.0.0 +Version: 6.0.1 LaTeX Config: tufte-handout Base Header Level: 3 uuid: 0d6313fa-9135-477e-9c14-7d62c1977833 @@ -252,6 +252,69 @@ MMD v6 includes support for substituting certain text phrases in other languages. This only affects the HTML format. +## LaTeX Changes ## + +LaTeX support is slightly different than in prior versions of MMD. It is +designed to be a bit more consistent, and easier for basic use. + +The previous approach used two types of metadata: + +* `latex input` -- this uses the name of a latex file that will be used in a +`\input{file}` command. This key can be used multiple times (the only +metadata key that worked this way), and all the basic metadata is written to +the LaTeX file in order. + +* `latex footer` -- this file worked the same way as `latex input`, but was +inserted at the end of the file + +In practice, one typically needs to be able to insert `\input` commands at +only a few key places in the final document: + +1. At the very beginning +2. After metadata, and before the body of the document +3. After the body of the document + +MMD 6 standardizes the metadata to use 3 new keys: + +1. `latex leader` -- this specifies a file that will be used at the very +beginning of the document. + +2. `latex begin` -- this comes after metadata, and before the body of the +document. This will usually include the `\begin{document}` command, hence the +name. + +3. `latex footer` -- this comes after the body of the document. + +You can use these 3 keys to replace the old `latex input` metadata keys, as +long as you pay attention as to which is which. If you used more than three +include statements, you may have to combine your latex files to fit into the +new system. + +***In addition***, there is a new shortcut key -- `latex config`. This allows +you to specify a "document name" that is used to automatically identify the +corresponding `latex leader`, `latex begin`, and `latex footer` files. For +example, using `latex config: artice` is the same as using: + + latex leader: mmd6-article-leader + latex begin: mmd6-article-begin + latex footer: mmd6-article-footer + +Using the new system will require migrating your old configuration to the new +naming convention, but once done I believe it should me much more intuitive to +use. + +The LaTeX support files included with the MMD v6 repository support the use of +the following `latex config` values by default: + +* `article` +* `tufte-book` +* `tufte-handout` + +**NOTE: You do have to install the MMD support files into the proper location +**for your system. I would like to make this easier, but haven't found the +**best configuration yet. + + ## Metadata ## Metadata in MMD v6 includes new support for LaTeX -- the `latex config` key @@ -271,6 +334,47 @@ Table of Contents functionality is used when exporting to LaTeX or OpenDocument formats. +## Transclusion ## + +File transclusion works basically the same way -- `{{file}}` is used to +indicate a file that needs to be transcluded. `{{file.*}}` allows for +wildcard transclusion. What's different is that the way search paths are +handled is more flexible, though it may take a moment to understand. + +When you process a file with MMD, it uses that file's directory as the search +path for included files. For example: + +| Directory | Transcluded Filename | Resolved Path | +| ----------- | -------------------- | ------------------ | +| `/foo/bar/` | `bat` | `/foo/bar/bat` | +| `/foo/bar/` | `baz/bat` | `/foo/bar/baz/bat` | +| `/foo/bar/` | `../bat` | `/foo/bat` | + + +This is the same as MMD v 5. What's different is that when you transclude a +file, the search path stays the same as the "parent" file, **UNLESS** you use +the `transclude base` metadata to override it. The simplest override is: + + transclude base: . + +This means that any transclusions within the file will be calculated relative +to the file, regardless of the original search path. + +Alternatively you could specify that any transclusion happens inside a +subfolder: + + transclude base: folder/ + +Or you can specify an absolute path: + + transclude base: /some/path + +This flexibility means that you can transclude different files based on +whether a file is being processed by itself or as part of a "parent" file. +This can be useful when a particular file can either be a standalone document, +or a chapter inside a larger document. + + # Future Steps # Some features I plan to implement at some point: diff --git a/README.md b/README.md index 54c2ea49..03d8c357 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ | ---------- | ------------------------- | | Title: | MultiMarkdown | | Author: | Fletcher T. Penney | -| Date: | 2017-03-22 | +| Date: | 2017-03-28 | | Copyright: | Copyright © 2016 - 2017 Fletcher T. Penney. | -| Version: | 6.0.0 | +| Version: | 6.0.1 | ## An Announcement! ## diff --git a/Sources/libMultiMarkdown/lexer.c b/Sources/libMultiMarkdown/lexer.c index 19520d1d..d6ed45da 100644 --- a/Sources/libMultiMarkdown/lexer.c +++ b/Sources/libMultiMarkdown/lexer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.14.3 on Wed Mar 15 00:32:21 2017 */ +/* Generated by re2c 0.14.3 on Tue Mar 28 08:27:15 2017 */ /** MultiMarkdown 6 -- Lightweight markup processor to produce HTML, LaTeX, and more. @@ -83,24 +83,24 @@ int scan(Scanner * s, const char * stop) { yych = *YYCURSOR; switch (yych) { - case '\t': goto yy45; - case '\n': goto yy54; - case '\r': goto yy56; - case ' ': goto yy47; - case '!': goto yy18; - case '"': goto yy28; - case '#': goto yy49; - case '$': goto yy41; - case '%': goto yy51; - case '&': goto yy35; - case '\'': goto yy30; - case '(': goto yy20; - case ')': goto yy22; - case '*': goto yy57; - case '+': goto yy4; - case '-': goto yy6; - case '.': goto yy32; - case '/': goto yy37; + case '\t': goto yy46; + case '\n': goto yy55; + case '\r': goto yy57; + case ' ': goto yy48; + case '!': goto yy20; + case '"': goto yy29; + case '#': goto yy50; + case '$': goto yy42; + case '%': goto yy52; + case '&': goto yy36; + case '\'': goto yy31; + case '(': goto yy21; + case ')': goto yy23; + case '*': goto yy58; + case '+': goto yy6; + case '-': goto yy8; + case '.': goto yy33; + case '/': goto yy38; case '0': case '1': case '2': @@ -110,235 +110,242 @@ int scan(Scanner * s, const char * stop) { case '6': case '7': case '8': - case '9': goto yy53; - case ':': goto yy33; - case '<': goto yy8; - case '=': goto yy12; - case '>': goto yy24; - case '[': goto yy14; - case '\\': goto yy39; - case ']': goto yy16; - case '^': goto yy43; - case '_': goto yy59; - case '`': goto yy61; - case '{': goto yy2; - case '|': goto yy63; - case '}': goto yy26; - case '~': goto yy10; - case 0xA0: goto yy48; - default: goto yy65; + case '9': goto yy54; + case ':': goto yy34; + case '<': goto yy10; + case '=': goto yy14; + case '>': goto yy25; + case '[': goto yy16; + case '\\': goto yy40; + case ']': goto yy18; + case '^': goto yy44; + case '_': goto yy60; + case '`': goto yy62; + case '{': goto yy4; + case '|': goto yy64; + case '}': goto yy27; + case '~': goto yy12; + case 0xA0: goto yy49; + case 0xC3: goto yy2; + default: goto yy66; } yy2: - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - switch (yych) { - case '+': goto yy267; - case '-': goto yy266; - case '=': goto yy263; - case '>': goto yy265; - case '{': goto yy261; - case '~': goto yy264; + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case 0xA0: goto yy285; default: goto yy3; } yy3: - { return TEXT_BRACE_LEFT; } + { goto scan; } yy4: - yyaccept = 1; + yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case '+': goto yy258; + case '+': goto yy268; + case '-': goto yy267; + case '=': goto yy264; + case '>': goto yy266; + case '{': goto yy262; + case '~': goto yy265; default: goto yy5; } yy5: - { return PLUS; } + { return TEXT_BRACE_LEFT; } yy6: - ++YYCURSOR; - switch ((yych = *YYCURSOR)) { - case '-': goto yy252; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '+': goto yy259; default: goto yy7; } yy7: - { return DASH_N; } + { return PLUS; } yy8: - yyaccept = 2; - yych = *(YYMARKER = ++YYCURSOR); - switch (yych) { - case '<': goto yy249; + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '-': goto yy253; default: goto yy9; } yy9: - { return ANGLE_LEFT; } + { return DASH_N; } yy10: - yyaccept = 3; + yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case '>': goto yy245; - case '~': goto yy244; + case '<': goto yy250; default: goto yy11; } yy11: - { return SUBSCRIPT; } + { return ANGLE_LEFT; } yy12: - yyaccept = 4; + yyaccept = 3; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case '=': goto yy241; + case '>': goto yy246; + case '~': goto yy245; default: goto yy13; } yy13: - { return EQUAL; } + { return SUBSCRIPT; } yy14: - ++YYCURSOR; - switch ((yych = *YYCURSOR)) { - case '#': goto yy237; - case '%': goto yy231; - case '>': goto yy239; - case '?': goto yy233; - case '^': goto yy235; + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '=': goto yy242; default: goto yy15; } yy15: - { return BRACKET_LEFT; } + { return EQUAL; } yy16: ++YYCURSOR; - { return BRACKET_RIGHT; } + switch ((yych = *YYCURSOR)) { + case '#': goto yy238; + case '%': goto yy232; + case '>': goto yy240; + case '?': goto yy234; + case '^': goto yy236; + default: goto yy17; + } +yy17: + { return BRACKET_LEFT; } yy18: ++YYCURSOR; - switch ((yych = *YYCURSOR)) { - case '[': goto yy229; - default: goto yy19; - } -yy19: - { goto scan; } + { return BRACKET_RIGHT; } yy20: + yych = *++YYCURSOR; + switch (yych) { + case '[': goto yy230; + default: goto yy3; + } +yy21: ++YYCURSOR; { return PAREN_LEFT; } -yy22: +yy23: ++YYCURSOR; { return PAREN_RIGHT; } -yy24: +yy25: ++YYCURSOR; { return ANGLE_RIGHT; } -yy26: +yy27: ++YYCURSOR; switch ((yych = *YYCURSOR)) { - case '}': goto yy227; - default: goto yy27; + case '}': goto yy228; + default: goto yy28; } -yy27: - { return TEXT_BRACE_RIGHT; } yy28: + { return TEXT_BRACE_RIGHT; } +yy29: ++YYCURSOR; { return QUOTE_DOUBLE; } -yy30: +yy31: ++YYCURSOR; switch ((yych = *YYCURSOR)) { - case '\'': goto yy225; - default: goto yy31; + case '\'': goto yy226; + default: goto yy32; } -yy31: - { return QUOTE_SINGLE; } yy32: + { return QUOTE_SINGLE; } +yy33: yyaccept = 5; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case ' ': goto yy217; - case '.': goto yy218; - default: goto yy19; + case ' ': goto yy218; + case '.': goto yy219; + default: goto yy3; } -yy33: +yy34: ++YYCURSOR; { return COLON; } -yy35: +yy36: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { case 'A': - case 'a': goto yy212; - default: goto yy36; + case 'a': goto yy213; + default: goto yy37; } -yy36: - { return AMPERSAND; } yy37: + { return AMPERSAND; } +yy38: ++YYCURSOR; { return SLASH; } -yy39: +yy40: ++YYCURSOR; switch ((yych = *YYCURSOR)) { - case '\n': goto yy135; - case '\r': goto yy137; - case ' ': goto yy140; - case '!': goto yy200; - case '"': goto yy190; - case '#': goto yy170; - case '$': goto yy168; - case '%': goto yy166; - case '&': goto yy154; - case '\'': goto yy188; - case '(': goto yy182; - case ')': goto yy180; - case '*': goto yy146; - case '+': goto yy164; - case ',': goto yy196; - case '-': goto yy162; - case '.': goto yy202; - case '/': goto yy150; - case ':': goto yy192; - case ';': goto yy194; - case '<': goto yy158; - case '=': goto yy160; - case '>': goto yy156; - case '?': goto yy198; - case '@': goto yy152; - case '[': goto yy174; - case '\\': goto yy138; - case ']': goto yy172; - case '^': goto yy148; - case '_': goto yy144; - case '`': goto yy186; - case '{': goto yy178; - case '|': goto yy142; - case '}': goto yy176; - case '~': goto yy184; - default: goto yy40; + case '\n': goto yy136; + case '\r': goto yy138; + case ' ': goto yy141; + case '!': goto yy201; + case '"': goto yy191; + case '#': goto yy171; + case '$': goto yy169; + case '%': goto yy167; + case '&': goto yy155; + case '\'': goto yy189; + case '(': goto yy183; + case ')': goto yy181; + case '*': goto yy147; + case '+': goto yy165; + case ',': goto yy197; + case '-': goto yy163; + case '.': goto yy203; + case '/': goto yy151; + case ':': goto yy193; + case ';': goto yy195; + case '<': goto yy159; + case '=': goto yy161; + case '>': goto yy157; + case '?': goto yy199; + case '@': goto yy153; + case '[': goto yy175; + case '\\': goto yy139; + case ']': goto yy173; + case '^': goto yy149; + case '_': goto yy145; + case '`': goto yy187; + case '{': goto yy179; + case '|': goto yy143; + case '}': goto yy177; + case '~': goto yy185; + default: goto yy41; } -yy40: - { return TEXT_BACKSLASH; } yy41: + { return TEXT_BACKSLASH; } +yy42: ++YYCURSOR; switch ((yych = *YYCURSOR)) { - case '$': goto yy133; - default: goto yy42; + case '$': goto yy134; + default: goto yy43; } -yy42: - { return MATH_DOLLAR_SINGLE; } yy43: + { return MATH_DOLLAR_SINGLE; } +yy44: ++YYCURSOR; { return SUPERSCRIPT; } -yy45: +yy46: ++YYCURSOR; { return INDENT_TAB; } -yy47: +yy48: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { - case '\t': goto yy120; - case '\n': goto yy54; - case '\r': goto yy132; + case '\t': goto yy121; + case '\n': goto yy55; + case '\r': goto yy133; case ' ': - case 0xA0: goto yy122; - default: goto yy19; + case 0xA0: goto yy123; + default: goto yy3; } -yy48: +yy49: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { - case '\t': goto yy120; + case '\t': goto yy121; case ' ': - case 0xA0: goto yy122; - default: goto yy19; + case 0xA0: goto yy123; + default: goto yy3; } -yy49: +yy50: YYCTXMARKER = YYCURSOR + 1; yyaccept = 7; yych = *(YYMARKER = ++YYCURSOR); @@ -347,20 +354,20 @@ int scan(Scanner * s, const char * stop) { case '\n': case '\r': case ' ': - case 0xA0: goto yy81; - case '#': goto yy79; - default: goto yy50; + case 0xA0: goto yy82; + case '#': goto yy80; + default: goto yy51; } -yy50: - { return TEXT_HASH; } yy51: + { return TEXT_HASH; } +yy52: ++YYCURSOR; { return TEXT_PERCENT; } -yy53: +yy54: yyaccept = 5; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case '.': goto yy70; + case '.': goto yy71; case '0': case '1': case '2': @@ -370,86 +377,86 @@ int scan(Scanner * s, const char * stop) { case '6': case '7': case '8': - case '9': goto yy72; - default: goto yy19; + case '9': goto yy73; + default: goto yy3; } -yy54: - ++YYCURSOR; yy55: - { return TEXT_NL; } + ++YYCURSOR; yy56: + { return TEXT_NL; } +yy57: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy54; - default: goto yy55; + case '\n': goto yy55; + default: goto yy56; } -yy57: +yy58: ++YYCURSOR; { return STAR; } -yy59: +yy60: ++YYCURSOR; { return UL; } -yy61: +yy62: ++YYCURSOR; yych = *YYCURSOR; - goto yy69; -yy62: - { return BACKTICK; } + goto yy70; yy63: + { return BACKTICK; } +yy64: ++YYCURSOR; yych = *YYCURSOR; - goto yy67; -yy64: - { return PIPE; } + goto yy68; yy65: - yych = *++YYCURSOR; - goto yy19; + { return PIPE; } yy66: + yych = *++YYCURSOR; + goto yy3; +yy67: ++YYCURSOR; yych = *YYCURSOR; -yy67: +yy68: switch (yych) { - case '|': goto yy66; - default: goto yy64; + case '|': goto yy67; + default: goto yy65; } -yy68: +yy69: ++YYCURSOR; yych = *YYCURSOR; -yy69: +yy70: switch (yych) { - case '`': goto yy68; - default: goto yy62; + case '`': goto yy69; + default: goto yy63; } -yy70: +yy71: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { case '\t': case ' ': - case 0xA0: goto yy77; - case '\n': goto yy74; - case '\r': goto yy76; - default: goto yy71; + case 0xA0: goto yy78; + case '\n': goto yy75; + case '\r': goto yy77; + default: goto yy72; } -yy71: +yy72: YYCURSOR = YYMARKER; switch (yyaccept) { - case 0: goto yy3; - case 1: goto yy5; - case 2: goto yy9; - case 3: goto yy11; - case 4: goto yy13; - case 5: goto yy19; - case 6: goto yy36; - case 7: goto yy50; - case 8: goto yy129; - default: goto yy262; - } -yy72: + case 0: goto yy5; + case 1: goto yy7; + case 2: goto yy11; + case 3: goto yy13; + case 4: goto yy15; + case 5: goto yy3; + case 6: goto yy37; + case 7: goto yy51; + case 8: goto yy130; + default: goto yy263; + } +yy73: ++YYCURSOR; yych = *YYCURSOR; switch (yych) { - case '.': goto yy70; + case '.': goto yy71; case '0': case '1': case '2': @@ -459,30 +466,30 @@ int scan(Scanner * s, const char * stop) { case '6': case '7': case '8': - case '9': goto yy72; - default: goto yy71; + case '9': goto yy73; + default: goto yy72; } -yy74: - ++YYCURSOR; yy75: + ++YYCURSOR; +yy76: YYCURSOR = YYCTXMARKER; { return TEXT_NUMBER_POSS_LIST; } -yy76: +yy77: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy74; - default: goto yy75; + case '\n': goto yy75; + default: goto yy76; } -yy77: +yy78: ++YYCURSOR; yych = *YYCURSOR; switch (yych) { case '\t': case ' ': - case 0xA0: goto yy77; - default: goto yy75; + case 0xA0: goto yy78; + default: goto yy76; } -yy79: +yy80: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { @@ -490,61 +497,61 @@ int scan(Scanner * s, const char * stop) { case '\n': case '\r': case ' ': - case 0xA0: goto yy87; - case '#': goto yy92; - default: goto yy71; + case 0xA0: goto yy88; + case '#': goto yy93; + default: goto yy72; } -yy80: +yy81: ++YYCURSOR; yych = *YYCURSOR; -yy81: +yy82: switch (yych) { case '\t': case ' ': - case 0xA0: goto yy80; - case '\n': goto yy83; - case '\r': goto yy85; - default: goto yy82; + case 0xA0: goto yy81; + case '\n': goto yy84; + case '\r': goto yy86; + default: goto yy83; } -yy82: - { return HASH1; } yy83: - ++YYCURSOR; + { return HASH1; } yy84: + ++YYCURSOR; +yy85: YYCURSOR = YYCTXMARKER; { return HASH1; } -yy85: +yy86: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy83; - default: goto yy84; + case '\n': goto yy84; + default: goto yy85; } -yy86: +yy87: ++YYCURSOR; yych = *YYCURSOR; -yy87: +yy88: switch (yych) { case '\t': case ' ': - case 0xA0: goto yy86; - case '\n': goto yy89; - case '\r': goto yy91; - default: goto yy88; + case 0xA0: goto yy87; + case '\n': goto yy90; + case '\r': goto yy92; + default: goto yy89; } -yy88: - { return HASH2; } yy89: - ++YYCURSOR; + { return HASH2; } yy90: + ++YYCURSOR; +yy91: YYCURSOR = YYCTXMARKER; { return HASH2; } -yy91: +yy92: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy89; - default: goto yy90; + case '\n': goto yy90; + default: goto yy91; } -yy92: +yy93: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { @@ -552,11 +559,11 @@ int scan(Scanner * s, const char * stop) { case '\n': case '\r': case ' ': - case 0xA0: goto yy95; - case '#': goto yy93; - default: goto yy71; + case 0xA0: goto yy96; + case '#': goto yy94; + default: goto yy72; } -yy93: +yy94: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { @@ -564,61 +571,61 @@ int scan(Scanner * s, const char * stop) { case '\n': case '\r': case ' ': - case 0xA0: goto yy101; - case '#': goto yy106; - default: goto yy71; + case 0xA0: goto yy102; + case '#': goto yy107; + default: goto yy72; } -yy94: +yy95: ++YYCURSOR; yych = *YYCURSOR; -yy95: +yy96: switch (yych) { case '\t': case ' ': - case 0xA0: goto yy94; - case '\n': goto yy97; - case '\r': goto yy99; - default: goto yy96; + case 0xA0: goto yy95; + case '\n': goto yy98; + case '\r': goto yy100; + default: goto yy97; } -yy96: - { return HASH3; } yy97: - ++YYCURSOR; + { return HASH3; } yy98: + ++YYCURSOR; +yy99: YYCURSOR = YYCTXMARKER; { return HASH3; } -yy99: +yy100: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy97; - default: goto yy98; + case '\n': goto yy98; + default: goto yy99; } -yy100: +yy101: ++YYCURSOR; yych = *YYCURSOR; -yy101: +yy102: switch (yych) { case '\t': case ' ': - case 0xA0: goto yy100; - case '\n': goto yy103; - case '\r': goto yy105; - default: goto yy102; + case 0xA0: goto yy101; + case '\n': goto yy104; + case '\r': goto yy106; + default: goto yy103; } -yy102: - { return HASH4; } yy103: - ++YYCURSOR; + { return HASH4; } yy104: + ++YYCURSOR; +yy105: YYCURSOR = YYCTXMARKER; { return HASH4; } -yy105: +yy106: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy103; - default: goto yy104; + case '\n': goto yy104; + default: goto yy105; } -yy106: +yy107: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { @@ -626,11 +633,11 @@ int scan(Scanner * s, const char * stop) { case '\n': case '\r': case ' ': - case 0xA0: goto yy109; - case '#': goto yy107; - default: goto yy71; + case 0xA0: goto yy110; + case '#': goto yy108; + default: goto yy72; } -yy107: +yy108: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { @@ -638,465 +645,468 @@ int scan(Scanner * s, const char * stop) { case '\n': case '\r': case ' ': - case 0xA0: goto yy115; - default: goto yy71; + case 0xA0: goto yy116; + default: goto yy72; } -yy108: +yy109: ++YYCURSOR; yych = *YYCURSOR; -yy109: +yy110: switch (yych) { case '\t': case ' ': - case 0xA0: goto yy108; - case '\n': goto yy111; - case '\r': goto yy113; - default: goto yy110; + case 0xA0: goto yy109; + case '\n': goto yy112; + case '\r': goto yy114; + default: goto yy111; } -yy110: - { return HASH5; } yy111: - ++YYCURSOR; + { return HASH5; } yy112: + ++YYCURSOR; +yy113: YYCURSOR = YYCTXMARKER; { return HASH5; } -yy113: +yy114: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy111; - default: goto yy112; + case '\n': goto yy112; + default: goto yy113; } -yy114: +yy115: ++YYCURSOR; yych = *YYCURSOR; -yy115: +yy116: switch (yych) { case '\t': case ' ': - case 0xA0: goto yy114; - case '\n': goto yy117; - case '\r': goto yy119; - default: goto yy116; + case 0xA0: goto yy115; + case '\n': goto yy118; + case '\r': goto yy120; + default: goto yy117; } -yy116: - { return HASH6; } yy117: - ++YYCURSOR; + { return HASH6; } yy118: + ++YYCURSOR; +yy119: YYCURSOR = YYCTXMARKER; { return HASH6; } -yy119: +yy120: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy117; - default: goto yy118; + case '\n': goto yy118; + default: goto yy119; } -yy120: +yy121: ++YYCURSOR; YYCURSOR = YYCTXMARKER; { return NON_INDENT_SPACE; } -yy122: +yy123: ++YYCURSOR; switch ((yych = *YYCURSOR)) { - case '\n': goto yy125; - case '\r': goto yy127; + case '\n': goto yy126; + case '\r': goto yy128; case ' ': - case 0xA0: goto yy124; - default: goto yy123; + case 0xA0: goto yy125; + default: goto yy124; } -yy123: - { return NON_INDENT_SPACE; } yy124: + { return NON_INDENT_SPACE; } +yy125: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy125; - case '\r': goto yy127; + case '\n': goto yy126; + case '\r': goto yy128; case ' ': - case 0xA0: goto yy128; - default: goto yy123; + case 0xA0: goto yy129; + default: goto yy124; } -yy125: - ++YYCURSOR; yy126: - { return TEXT_LINEBREAK; } + ++YYCURSOR; yy127: + { return TEXT_LINEBREAK; } +yy128: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy125; - default: goto yy126; + case '\n': goto yy126; + default: goto yy127; } -yy128: +yy129: yyaccept = 8; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case '\n': goto yy125; - case '\r': goto yy127; + case '\n': goto yy126; + case '\r': goto yy128; case ' ': - case 0xA0: goto yy130; - default: goto yy129; + case 0xA0: goto yy131; + default: goto yy130; } -yy129: - { return INDENT_SPACE; } yy130: + { return INDENT_SPACE; } +yy131: ++YYCURSOR; yych = *YYCURSOR; switch (yych) { - case '\n': goto yy125; - case '\r': goto yy127; + case '\n': goto yy126; + case '\r': goto yy128; case ' ': - case 0xA0: goto yy130; - default: goto yy71; + case 0xA0: goto yy131; + default: goto yy72; } -yy132: +yy133: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy54; - default: goto yy55; + case '\n': goto yy55; + default: goto yy56; } -yy133: +yy134: ++YYCURSOR; { return MATH_DOLLAR_DOUBLE; } -yy135: - ++YYCURSOR; yy136: - { return TEXT_LINEBREAK; } + ++YYCURSOR; yy137: + { return TEXT_LINEBREAK; } +yy138: yych = *++YYCURSOR; switch (yych) { - case '\n': goto yy135; - default: goto yy136; + case '\n': goto yy136; + default: goto yy137; } -yy138: +yy139: ++YYCURSOR; switch ((yych = *YYCURSOR)) { - case '(': goto yy204; - case ')': goto yy206; - case '[': goto yy208; - case ']': goto yy210; - default: goto yy139; + case '(': goto yy205; + case ')': goto yy207; + case '[': goto yy209; + case ']': goto yy211; + default: goto yy140; } -yy139: - { return ESCAPED_CHARACTER; } yy140: + { return ESCAPED_CHARACTER; } +yy141: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy142: +yy143: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy144: +yy145: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy146: +yy147: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy148: +yy149: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy150: +yy151: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy152: +yy153: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy154: +yy155: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy156: +yy157: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy158: +yy159: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy160: +yy161: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy162: +yy163: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy164: +yy165: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy166: +yy167: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy168: +yy169: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy170: +yy171: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy172: +yy173: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy174: +yy175: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy176: +yy177: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy178: +yy179: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy180: +yy181: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy182: +yy183: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy184: +yy185: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy186: +yy187: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy188: +yy189: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy190: +yy191: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy192: +yy193: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy194: +yy195: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy196: +yy197: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy198: +yy199: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy200: +yy201: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy202: +yy203: ++YYCURSOR; { return ESCAPED_CHARACTER; } -yy204: +yy205: ++YYCURSOR; { return MATH_PAREN_OPEN; } -yy206: +yy207: ++YYCURSOR; { return MATH_PAREN_CLOSE; } -yy208: +yy209: ++YYCURSOR; { return MATH_BRACKET_OPEN; } -yy210: +yy211: ++YYCURSOR; { return MATH_BRACKET_CLOSE; } -yy212: +yy213: yych = *++YYCURSOR; switch (yych) { case 'M': - case 'm': goto yy213; - default: goto yy71; + case 'm': goto yy214; + default: goto yy72; } -yy213: +yy214: yych = *++YYCURSOR; switch (yych) { case 'P': - case 'p': goto yy214; - default: goto yy71; + case 'p': goto yy215; + default: goto yy72; } -yy214: +yy215: yych = *++YYCURSOR; switch (yych) { - case ';': goto yy215; - default: goto yy71; + case ';': goto yy216; + default: goto yy72; } -yy215: +yy216: ++YYCURSOR; { return AMPERSAND_LONG; } -yy217: +yy218: yych = *++YYCURSOR; switch (yych) { - case '.': goto yy221; - default: goto yy71; + case '.': goto yy222; + default: goto yy72; } -yy218: +yy219: yych = *++YYCURSOR; switch (yych) { - case '.': goto yy219; - default: goto yy71; + case '.': goto yy220; + default: goto yy72; } -yy219: +yy220: ++YYCURSOR; { return ELLIPSIS; } -yy221: +yy222: yych = *++YYCURSOR; switch (yych) { - case ' ': goto yy222; - default: goto yy71; + case ' ': goto yy223; + default: goto yy72; } -yy222: +yy223: yych = *++YYCURSOR; switch (yych) { - case '.': goto yy223; - default: goto yy71; + case '.': goto yy224; + default: goto yy72; } -yy223: +yy224: ++YYCURSOR; { return ELLIPSIS; } -yy225: +yy226: ++YYCURSOR; { return QUOTE_RIGHT_ALT; } -yy227: +yy228: ++YYCURSOR; { return BRACE_DOUBLE_RIGHT; } -yy229: +yy230: ++YYCURSOR; { return BRACKET_IMAGE_LEFT; } -yy231: +yy232: ++YYCURSOR; { return BRACKET_VARIABLE_LEFT; } -yy233: +yy234: ++YYCURSOR; { return BRACKET_GLOSSARY_LEFT; } -yy235: +yy236: ++YYCURSOR; { return BRACKET_FOOTNOTE_LEFT; } -yy237: +yy238: ++YYCURSOR; { return BRACKET_CITATION_LEFT; } -yy239: +yy240: ++YYCURSOR; { return BRACKET_ABBREVIATION_LEFT; } -yy241: +yy242: yych = *++YYCURSOR; switch (yych) { - case '}': goto yy242; - default: goto yy71; + case '}': goto yy243; + default: goto yy72; } -yy242: +yy243: ++YYCURSOR; { return CRITIC_HI_CLOSE; } -yy244: +yy245: yych = *++YYCURSOR; switch (yych) { - case '}': goto yy247; - default: goto yy71; + case '}': goto yy248; + default: goto yy72; } -yy245: +yy246: ++YYCURSOR; { return CRITIC_SUB_DIV; } -yy247: +yy248: ++YYCURSOR; { return CRITIC_SUB_CLOSE; } -yy249: +yy250: yych = *++YYCURSOR; switch (yych) { - case '}': goto yy250; - default: goto yy71; + case '}': goto yy251; + default: goto yy72; } -yy250: +yy251: ++YYCURSOR; { return CRITIC_COM_CLOSE; } -yy252: +yy253: ++YYCURSOR; switch ((yych = *YYCURSOR)) { - case '-': goto yy256; - case '}': goto yy254; - default: goto yy253; + case '-': goto yy257; + case '}': goto yy255; + default: goto yy254; } -yy253: - { return DASH_N; } yy254: + { return DASH_N; } +yy255: ++YYCURSOR; { return CRITIC_DEL_CLOSE; } -yy256: +yy257: ++YYCURSOR; { return DASH_M; } -yy258: +yy259: yych = *++YYCURSOR; switch (yych) { - case '}': goto yy259; - default: goto yy71; + case '}': goto yy260; + default: goto yy72; } -yy259: +yy260: ++YYCURSOR; { return CRITIC_ADD_CLOSE; } -yy261: +yy262: yyaccept = 9; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'T': goto yy278; - default: goto yy262; + case 'T': goto yy279; + default: goto yy263; } -yy262: - { return BRACE_DOUBLE_LEFT; } yy263: - yych = *++YYCURSOR; - switch (yych) { - case '=': goto yy276; - default: goto yy71; - } + { return BRACE_DOUBLE_LEFT; } yy264: yych = *++YYCURSOR; switch (yych) { - case '~': goto yy274; - default: goto yy71; + case '=': goto yy277; + default: goto yy72; } yy265: yych = *++YYCURSOR; switch (yych) { - case '>': goto yy272; - default: goto yy71; + case '~': goto yy275; + default: goto yy72; } yy266: yych = *++YYCURSOR; switch (yych) { - case '-': goto yy270; - default: goto yy71; + case '>': goto yy273; + default: goto yy72; } yy267: yych = *++YYCURSOR; switch (yych) { - case '+': goto yy268; - default: goto yy71; + case '-': goto yy271; + default: goto yy72; } yy268: + yych = *++YYCURSOR; + switch (yych) { + case '+': goto yy269; + default: goto yy72; + } +yy269: ++YYCURSOR; { return CRITIC_ADD_OPEN; } -yy270: +yy271: ++YYCURSOR; { return CRITIC_DEL_OPEN; } -yy272: +yy273: ++YYCURSOR; { return CRITIC_COM_OPEN; } -yy274: +yy275: ++YYCURSOR; { return CRITIC_SUB_OPEN; } -yy276: +yy277: ++YYCURSOR; { return CRITIC_HI_OPEN; } -yy278: - yych = *++YYCURSOR; - switch (yych) { - case 'O': goto yy279; - default: goto yy71; - } yy279: yych = *++YYCURSOR; switch (yych) { - case 'C': goto yy280; - default: goto yy71; + case 'O': goto yy280; + default: goto yy72; } yy280: yych = *++YYCURSOR; switch (yych) { - case '}': goto yy281; - default: goto yy71; + case 'C': goto yy281; + default: goto yy72; } yy281: yych = *++YYCURSOR; switch (yych) { case '}': goto yy282; - default: goto yy71; + default: goto yy72; } yy282: + yych = *++YYCURSOR; + switch (yych) { + case '}': goto yy283; + default: goto yy72; + } +yy283: ++YYCURSOR; { return TOC; } +yy285: + ++YYCURSOR; + { return TEXT_PLAIN; } } } diff --git a/Sources/libMultiMarkdown/lexer.re b/Sources/libMultiMarkdown/lexer.re index 998169f9..44fd2654 100644 --- a/Sources/libMultiMarkdown/lexer.re +++ b/Sources/libMultiMarkdown/lexer.re @@ -92,6 +92,9 @@ int scan(Scanner * s, const char * stop) { // The order of these seems to matter + // Don't split `à` character + '\303' '\240' { return TEXT_PLAIN; } + "{{TOC}}" { return TOC; } "{++" { return CRITIC_ADD_OPEN; } diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 0a461323..55d1242b 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -789,14 +789,14 @@ void strip_quote_markers_from_block(mmd_engine * e, token * block) { /// Create a token chain from source string /// stop_on_empty_line allows us to stop parsing part of the way through -token * mmd_tokenize_string(mmd_engine * e, const char * str, size_t len, bool stop_on_empty_line) { +token * mmd_tokenize_string(mmd_engine * e, size_t start, size_t len, bool stop_on_empty_line) { // Reset metadata flag e->allow_meta = (e->extensions & EXT_COMPATIBILITY) ? false : true; // Create a scanner (for re2c) Scanner s; - s.start = str; + s.start = &e->dstr->str[start]; s.cur = s.start; // Strip trailing whitespace @@ -804,7 +804,7 @@ token * mmd_tokenize_string(mmd_engine * e, const char * str, size_t len, bool s // len--; // Where do we stop parsing? - const char * stop = str + len; + const char * stop = &e->dstr->str[start] + len; int type; // TOKEN type token * t; // Create tokens for incorporation @@ -812,7 +812,7 @@ token * mmd_tokenize_string(mmd_engine * e, const char * str, size_t len, bool s token * root = token_new(0,0,0); // Store the final parse tree here token * line = token_new(0,0,0); // Store current line here - const char * last_stop = str; // Remember where last token ended + const char * last_stop = &e->dstr->str[start]; // Remember where last token ended do { // Scan for next token (type of 0 means there is nothing left); @@ -824,20 +824,20 @@ token * mmd_tokenize_string(mmd_engine * e, const char * str, size_t len, bool s if (type) { // Create a default token type for the skipped characters - t = token_new(TEXT_PLAIN, (size_t)(last_stop - str), (size_t)(s.start - last_stop)); + t = token_new(TEXT_PLAIN, (size_t)(last_stop - e->dstr->str), (size_t)(s.start - last_stop)); token_append_child(line, t); } else { if (stop > last_stop) { // Source text ends without newline - t = token_new(TEXT_PLAIN, (size_t)(last_stop - str), (size_t)(stop - last_stop)); + t = token_new(TEXT_PLAIN, (size_t)(last_stop - e->dstr->str), (size_t)(stop - last_stop)); token_append_child(line, t); } } } else if (type == 0 && stop > last_stop) { // Source text ends without newline - t = token_new(TEXT_PLAIN, (size_t)(last_stop - str), (size_t)(stop - last_stop)); + t = token_new(TEXT_PLAIN, (size_t)(last_stop - e->dstr->str), (size_t)(stop - last_stop)); token_append_child(line, t); } @@ -855,7 +855,7 @@ token * mmd_tokenize_string(mmd_engine * e, const char * str, size_t len, bool s case TEXT_LINEBREAK: case TEXT_NL: // We hit the end of a line - t = token_new(type, (size_t)(s.start - str), (size_t)(s.cur - s.start)); + t = token_new(type, (size_t)(s.start - e->dstr->str), (size_t)(s.cur - s.start)); token_append_child(line, t); // What sort of line is this? @@ -867,10 +867,10 @@ token * mmd_tokenize_string(mmd_engine * e, const char * str, size_t len, bool s if (line->type == LINE_EMPTY) return root; } - line = token_new(0,s.cur - str,0); + line = token_new(0,s.cur - e->dstr->str,0); break; default: - t = token_new(type, (size_t)(s.start - str), (size_t)(s.cur - s.start)); + t = token_new(type, (size_t)(s.start - e->dstr->str), (size_t)(s.cur - s.start)); token_append_child(line, t); break; } @@ -1839,14 +1839,14 @@ token * mmd_engine_parse_substring(mmd_engine * e, size_t byte_start, size_t byt e->definition_stack->size = 0; // Tokenize the string - token * doc = mmd_tokenize_string(e, &e->dstr->str[byte_start], byte_len, false); + token * doc = mmd_tokenize_string(e, byte_start, byte_len, false); // Parse tokens into blocks mmd_parse_token_chain(e, doc); if (doc) { // Parse blocks for pairs - mmd_assign_ambidextrous_tokens_in_block(e, doc, &e->dstr->str[byte_start], 0); + mmd_assign_ambidextrous_tokens_in_block(e, doc, e->dstr->str, 0); // Prepare stack to be used for token pairing // This avoids allocating/freeing one for each iteration. @@ -1863,7 +1863,7 @@ token * mmd_engine_parse_substring(mmd_engine * e, size_t byte_start, size_t byt pair_emphasis_tokens(doc); #ifndef NDEBUG - token_tree_describe(doc, &e->dstr->str[byte_start]); + token_tree_describe(doc, e->dstr->str); #endif } @@ -1898,7 +1898,7 @@ bool mmd_has_metadata(mmd_engine * e, size_t * end) { token_tree_free(e->root); // Tokenize the string (up until first empty line) - token * doc = mmd_tokenize_string(e, &e->dstr->str[0], e->dstr->currentStringLength, true); + token * doc = mmd_tokenize_string(e, 0, e->dstr->currentStringLength, true); // Parse tokens into blocks mmd_parse_token_chain(e, doc); diff --git a/Sources/libMultiMarkdown/transclude.c b/Sources/libMultiMarkdown/transclude.c index 53f0f5dd..e6472415 100644 --- a/Sources/libMultiMarkdown/transclude.c +++ b/Sources/libMultiMarkdown/transclude.c @@ -274,12 +274,12 @@ DString * scan_file(const char * fname) { /// Recursively transclude source text, given a search directory. /// Track files to prevent infinite recursive loops -void transclude_source(DString * source, const char * dir, short format, stack * parsed, stack * manifest) { +void transclude_source(DString * source, const char * search_path, const char * source_path, short format, stack * parsed, stack * manifest) { DString * file_path; DString * buffer; - // Ensure folder is tidied up - char * folder = path_from_dir_base(dir, NULL); + // Ensure search_folder is tidied up + char * search_folder = path_from_dir_base(search_path, NULL); char * start, * stop; char text[1100]; @@ -289,22 +289,28 @@ void transclude_source(DString * source, const char * dir, short format, stack * size_t offset; size_t last_match; - // TODO: Does this source have metadata that overrides the search directory? mmd_engine * e = mmd_engine_create_with_dstring(source, EXT_TRANSCLUDE); if (mmd_has_metadata(e, &offset)) { temp = metavalue_for_key(e, "transclude base"); if (temp) { - free(folder); + // The new file overrides the search path + free(search_folder); - folder = path_from_dir_base(dir, temp); + // First, calculate path to this source file + char * temp_path = path_from_dir_base(search_path, source_path); + + // Then, calculate new search path relative to source + search_folder = path_from_dir_base(temp_path, temp); + + free(temp_path); } } mmd_engine_free(e, false); - if (folder == NULL) { + if (search_folder == NULL) { // We don't have anywhere to search, so nothing to do goto exit; } @@ -348,9 +354,9 @@ void transclude_source(DString * source, const char * dir, short format, stack * file_path = d_string_new(text); } else { // Relative path - file_path = d_string_new(folder); + file_path = d_string_new(search_folder); - // Ensure that folder ends in separator + // Ensure that search_folder ends in separator add_trailing_sep(file_path); d_string_append(file_path, text); @@ -419,8 +425,15 @@ void transclude_source(DString * source, const char * dir, short format, stack * d_string_erase(source, start - source->str, 2 + stop - start); // Recursively check this file for transclusions - transclude_source(buffer, folder, format, parse_stack, manifest); + char * new_search_path; + char * source_filename; + split_path_file(&new_search_path, &source_filename, file_path->str); + transclude_source(buffer, search_folder, new_search_path, format, parse_stack, manifest); + + free(new_search_path); + free(source_filename); + // Strip metadata from buffer now that we have parsed it e = mmd_engine_create_with_dstring(buffer, EXT_TRANSCLUDE); @@ -469,7 +482,7 @@ void transclude_source(DString * source, const char * dir, short format, stack * stack_free(parse_stack); } - free(folder); + free(search_folder); } diff --git a/Sources/libMultiMarkdown/transclude.h b/Sources/libMultiMarkdown/transclude.h index 612cb3ee..9dda79aa 100644 --- a/Sources/libMultiMarkdown/transclude.h +++ b/Sources/libMultiMarkdown/transclude.h @@ -73,7 +73,7 @@ DString * scan_file(const char * fname); /// Recursively transclude source text, given a search directory. /// Track files to prevent infinite recursive loops -void transclude_source(DString * source, const char * dir, short format, stack * parsed, stack * manifest); +void transclude_source(DString * source, const char * search_path, const char * source_path, short format, stack * parsed, stack * manifest); #endif diff --git a/Sources/multimarkdown/main.c b/Sources/multimarkdown/main.c index ec379c9f..9eda9eab 100644 --- a/Sources/multimarkdown/main.c +++ b/Sources/multimarkdown/main.c @@ -340,7 +340,7 @@ int main(int argc, char** argv) { if (extensions & EXT_TRANSCLUDE) { - transclude_source(buffer, folder, format, NULL, NULL); + transclude_source(buffer, folder, "", format, NULL, NULL); // Don't free folder -- owned by dirname } @@ -417,7 +417,7 @@ int main(int argc, char** argv) { // Perform transclusion(s) char * folder = dirname((char *) a_file->filename[0]); - transclude_source(buffer, folder, format, NULL, NULL); + transclude_source(buffer, folder, "", format, NULL, NULL); // Don't free folder -- owned by dirname } diff --git a/tests/MMD6Tests/International.fodt b/tests/MMD6Tests/International.fodt new file mode 100644 index 00000000..e1660b24 --- /dev/null +++ b/tests/MMD6Tests/International.fodt @@ -0,0 +1,284 @@ + +été
+ +à la
+ + + + diff --git a/tests/MMD6Tests/International.htmlc b/tests/MMD6Tests/International.htmlc new file mode 100644 index 00000000..e06a860d --- /dev/null +++ b/tests/MMD6Tests/International.htmlc @@ -0,0 +1,6 @@ +Title: International
+latex config: article
été
+ +à la
diff --git a/tests/MMD6Tests/International.tex b/tests/MMD6Tests/International.tex new file mode 100644 index 00000000..3c16783d --- /dev/null +++ b/tests/MMD6Tests/International.tex @@ -0,0 +1,10 @@ +\input{mmd6-article-leader} +\def\mytitle{International} +\input{mmd6-article-begin} + +été + +à la + +\input{mmd6-article-footer} +\end{document} diff --git a/tests/MMD6Tests/International.text b/tests/MMD6Tests/International.text new file mode 100644 index 00000000..80ee2d41 --- /dev/null +++ b/tests/MMD6Tests/International.text @@ -0,0 +1,6 @@ +Title: International +latex config: article + +été + +à la diff --git a/tests/MMD6Tests/Transclusion.fodt b/tests/MMD6Tests/Transclusion.fodt index 28a5809e..ea2ac6bb 100644 --- a/tests/MMD6Tests/Transclusion.fodt +++ b/tests/MMD6Tests/Transclusion.fodt @@ -292,7 +292,8 @@This text is included in transclusion/baz.txt
.
This should pull in bar.txt
, if run from the parent directory.
This should pull in bar.txt
, if run from the parent directory, since it
+does not override the transclude base
metadata.
This text is included in bar.txt
.
This is a file with no metadata.
+This text is included in transclusion/baz2.txt
.
This should pull in transclusion/bar.txt
, even if run from the parent
+directory, since it overrides the transclude base
metadata.
This text is included in transclusion\bar.txt
.
foo can no longer be found – {{foo.txt}}
+