diff --git a/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteWidgetTests/TestTables/content.txt b/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteWidgetTests/TestTables/content.txt index a38ce01037..f8819d6a31 100644 --- a/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteWidgetTests/TestTables/content.txt +++ b/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteWidgetTests/TestTables/content.txt @@ -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|test@mail.com|-!| +|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>test@mail.com</td>-! |true | +|contents|!-<a href="mailto:test@mail.com">test@mail.com</a>-! |false | diff --git a/FitNesseRoot/FitNesse/UserGuide/FitNesseWiki/MarkupLanguageReference/MarkupTable/content.txt b/FitNesseRoot/FitNesse/UserGuide/FitNesseWiki/MarkupLanguageReference/MarkupTable/content.txt index 21a4f59afe..91c2adabde 100644 --- a/FitNesseRoot/FitNesse/UserGuide/FitNesseWiki/MarkupLanguageReference/MarkupTable/content.txt +++ b/FitNesseRoot/FitNesse/UserGuide/FitNesseWiki/MarkupLanguageReference/MarkupTable/content.txt @@ -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@adress.es | +|from being parsed, |however |''it will respect formatting''| +|and parse symbols like !-!today (yyyyMMdd)-! |}}} +'''Displays as:''' +^|ThisTableWillExclude|WikiWords, http://links|and email@adress.es | +|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''' diff --git a/src/fitnesse/ContextConfigurator.java b/src/fitnesse/ContextConfigurator.java index c19f88b857..4358a05360 100644 --- a/src/fitnesse/ContextConfigurator.java +++ b/src/fitnesse/ContextConfigurator.java @@ -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(); @@ -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); diff --git a/src/fitnesse/wikitext/parser/SymbolProvider.java b/src/fitnesse/wikitext/parser/SymbolProvider.java index 93a69f1f2e..a9e2d2b377 100644 --- a/src/fitnesse/wikitext/parser/SymbolProvider.java +++ b/src/fitnesse/wikitext/parser/SymbolProvider.java @@ -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( diff --git a/src/fitnesse/wikitext/parser/Table.java b/src/fitnesse/wikitext/parser/Table.java index 71520e135e..380bc4bf24 100644 --- a/src/fitnesse/wikitext/parser/Table.java +++ b/src/fitnesse/wikitext/parser/Table.java @@ -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); } @@ -57,7 +59,9 @@ public Maybe 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; }