Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No links table #1310

Merged
merged 4 commits into from
Nov 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,29 @@
|Response Examiner.|
|type|pattern|matches?|
|contents|!-''italic''-!|true|
#


'''Test that wikiwords, http links and e-mail adresses don't get interpreted inside no-links tables.'''
|script |
|start|Page Builder |
|line |!-^|WikiWord|https://localhost|[email protected]|-!|
|page |!-TableTestPageFour-! |
#
#
|Response Requester. |
|uri |valid?|contents?|
|!-TableTestPageFour-!|true | |
#
#
|Response Examiner. |
|type |pattern |matches?|wrapped html?|
|contents|!-<td>WikiWord</td>-!|true | |
#
|Response Examiner. |
|type |pattern |matches?|
|contents|!-WikiWord<a title="create page" href="WikiWord?edit&nonExistent=true">[?]</a>-!|false |
|contents|!-<td>https://localhost</td>-! |true |
|contents|!-<a href="https://localhost">https://localhost</a>-! |false |
|contents|!-<td>[email protected]</td>-! |true |
|contents|!-<a href="mailto:[email protected]">[email protected]</a>-! |false |
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,20 @@ If you don't want any markup directives interpreted in the table, then you can u
|!1 like a literal|--and is especially useful--|''for test tables.''|
|^SinceTheyTend| * to have WikiWord symbols in them.|

!2 No Link Generating tables
If you don't want Wikiwords, URL's or E-mail adresses interpreted in the table, but you do want symbols like !-!today-! interpreted, then you can use a special form where your table is preceded with a ^ character:
'''Markup Text'''
{{{^|ThisTableWillExclude|WikiWords, http://links|and [email protected] |
|from being parsed, |however |''it will respect formatting''|
|and parse symbols like !-!today (yyyyMMdd)-! |}}}
'''Displays as:'''
^|ThisTableWillExclude|WikiWords, http://links|and [email protected] |
|from being parsed, |however |''it will respect formatting''|
|and parse symbols like !today (yyyyMMdd) |

!2 Hidden table heads
You can hide the first row of a table. This allows you to write comment tables that just look like ordinary HTML tables.
The complete table still gets executed, the first row is just hidden by a CSS rule.
The complete table still gets executed, the first row is just hidden by a CSS rule.
Precede the first row with a '-'. This also works for literal tables.

'''Markup Text'''
Expand Down
6 changes: 4 additions & 2 deletions src/fitnesse/ContextConfigurator.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ public FitNesseContext makeFitNesseContext() throws IOException, PluginException
variableSource,
theme);

SymbolProvider symbolProvider = SymbolProvider.wikiParsingProvider;
SymbolProvider wikiParsingProvider = SymbolProvider.wikiParsingProvider;
SymbolProvider noLinksTableParsingProvider = SymbolProvider.noLinksTableParsingProvider;

SlimTableDefaultColoring.createInstanceIfNeeded(slimTableFactory);
SlimTableDefaultColoring.install();
Expand All @@ -184,7 +185,8 @@ public FitNesseContext makeFitNesseContext() throws IOException, PluginException
}
pluginsLoader.loadTestSystems(testSystemFactory);
pluginsLoader.loadFormatters(formatterFactory);
pluginsLoader.loadSymbolTypes(symbolProvider);
pluginsLoader.loadSymbolTypes(wikiParsingProvider);
pluginsLoader.loadSymbolTypes(noLinksTableParsingProvider);
pluginsLoader.loadSlimTables(slimTableFactory);
pluginsLoader.loadCustomComparators(customComparatorRegistry);
pluginsLoader.loadTestRunFactories(context.testRunFactoryRegistry);
Expand Down
6 changes: 6 additions & 0 deletions src/fitnesse/wikitext/parser/SymbolProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ SymbolType.Italic, SymbolType.Strike, new AnchorReference(), WikiWord.symbolType
new Headings()
});

public static final SymbolProvider noLinksTableParsingProvider = SymbolProvider.copy(wikiParsingProvider)
.remove(WikiWord.symbolType)
.remove(SymbolType.EMail)
.remove(Link.symbolType)
.add(SymbolType.EndCell);

public static final SymbolProvider tableParsingProvider = new SymbolProvider(wikiParsingProvider).add(SymbolType.EndCell);

public static final SymbolProvider aliasLinkProvider = new SymbolProvider(
Expand Down
6 changes: 5 additions & 1 deletion src/fitnesse/wikitext/parser/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public Table() {
wikiMatcher(new Matcher().startLine().string("!|"));
wikiMatcher(new Matcher().startLine().string("-|"));
wikiMatcher(new Matcher().startLine().string("-!|"));
wikiMatcher(new Matcher().startLine().string("-^|"));
wikiMatcher(new Matcher().startLine().string("^|"));
wikiRule(this);
htmlTranslation(this);
}
Expand Down Expand Up @@ -57,7 +59,9 @@ public Maybe<Symbol> parse(Symbol current, Parser parser) {
protected Symbol parseCell(Parser parser, String content) {
Symbol cell = (content.contains("!"))
? parser.parseToWithSymbols(cellTerminators, SymbolProvider.literalTableProvider, ParseSpecification.tablePriority)
: parser.parseToWithSymbols(cellTerminators, SymbolProvider.tableParsingProvider, ParseSpecification.tablePriority);
: (content.contains("^"))
? parser.parseToWithSymbols(cellTerminators, SymbolProvider.noLinksTableParsingProvider, ParseSpecification.tablePriority)
: parser.parseToWithSymbols(cellTerminators, SymbolProvider.tableParsingProvider, ParseSpecification.tablePriority);
cell.setType(tableCell);
return cell;
}
Expand Down