diff --git a/ClickToBuild.cmd b/ClickToBuild.cmd
index 23cd2267d0a..53e1c8d6cab 100644
--- a/ClickToBuild.cmd
+++ b/ClickToBuild.cmd
@@ -23,13 +23,14 @@ echo "Unable to detect suitable environment. Build may not succeed."
SET target=%1
SET project=%2
+SET solution=%3
IF "%target%" == "" SET target=Build
-IF "%project%" =="" SET project=Orchard.proj
+IF "%project%" == "" SET project=Orchard.proj
+IF "%solution%" == "" SET solution=src\Orchard.sln
-lib\nuget\nuget.exe restore .\src\Orchard.sln
+lib\nuget\nuget.exe restore %solution%
-msbuild /t:%target% %project%
-
-pause
+msbuild /t:%target% %project% /p:Solution=%solution%
+pause
\ No newline at end of file
diff --git a/ClickToBuildAzurePackage.cmd b/ClickToBuildAzurePackage.cmd
index 5f6eb130076..c432229fd3a 100644
--- a/ClickToBuildAzurePackage.cmd
+++ b/ClickToBuildAzurePackage.cmd
@@ -2,5 +2,4 @@ SET target=%1
IF "%target%"=="" SET target=Build
-ClickToBuild %target% AzurePackage.proj
-
+ClickToBuild %target% Orchard.proj src\Orchard.Azure\Orchard.Azure.sln
\ No newline at end of file
diff --git a/Orchard.proj b/Orchard.proj
index 80ab256480c..d08fb50f881 100644
--- a/Orchard.proj
+++ b/Orchard.proj
@@ -6,6 +6,7 @@
$(MSBuildProjectDirectory)\lib$(MSBuildProjectDirectory)\src
+ $(SrcFolder)\Orchard.Azure$(MSBuildProjectDirectory)\build$(MSBuildProjectDirectory)\buildtasks$(MSBuildProjectDirectory)\artifacts
@@ -28,21 +29,32 @@
x64x86Release
+
+ $(SrcFolder)\Orchard.sln
+ $(AzureSrcFolder)\Orchard.Azure.sln
+ $(OrchardSolution)$(BUILD_NUMBER)
+
+
+
+
+
+
-
+
-
+
@@ -95,19 +107,19 @@
-
+
-
+
-
+
@@ -115,16 +127,16 @@
-
+
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
+
-
+
@@ -298,7 +299,6 @@
-
-
+
@@ -350,11 +350,11 @@
$(MSBuildProjectDirectory)\**\*.hgignore;
$(MSBuildProjectDirectory)\**\*.hg*\**\*;
$(LibFolder)\nunit\addins\**\*;
- " Exclude="$(MSBuildProjectDirectory)\src\Orchard.Azure\Orchard.Azure.CloudService\*Content\**\*" />
+ " Exclude="$(AzureSrcFolder)\Orchard.Azure.CloudService\*Content\**\*" />
-
+
-
-
-
NUnit Acceptance Tests
-
- Developers love self-referential programs! Hence, NUnit has always run all it's
- own tests, even those that are not really unit tests.
-
Now, beginning with NUnit 2.4, NUnit has top-level tests using Ward Cunningham's
- FIT framework. At this time, the tests are pretty rudimentary, but it's a start
- and it's a framework for doing more.
-
Running the Tests
-
Open a console or shell window and navigate to the NUnit bin directory, which
- contains this file. To run the test under Microsoft .Net, enter the command
-
- Note the space and dot at the end of each command. The results of your test
- will be in TestResults.html in the same directory.
-
Platform and CLR Version
-
-
-
NUnit.Fixtures.PlatformInfo
-
-
-
Verify Unit Tests
-
- Load and run the NUnit unit tests, verifying that the results are as expected.
- When these tests are run on different platforms, different numbers of tests may
- be skipped, so the values for Skipped and Run tests are informational only.
-
- The number of tests in each assembly should be constant across all platforms -
- any discrepancy usually means that one of the test source files was not
- compiled on the platform. There should be no failures and no tests ignored.
-
Note:
- At the moment, the nunit.extensions.tests assembly is failing because the
- fixture doesn't initialize addins in the test domain.
-
-
-
-
NUnit.Fixtures.AssemblyRunner
-
-
-
Assembly
-
Tests()
-
Run()
-
Skipped()
-
Ignored()
-
Failures()
-
-
-
nunit.framework.tests.dll
-
397
-
-
-
0
-
0
-
-
-
nunit.core.tests.dll
-
355
-
-
-
0
-
0
-
-
-
nunit.util.tests.dll
-
238
-
-
-
0
-
0
-
-
-
nunit.mocks.tests.dll
-
43
-
-
-
0
-
0
-
-
-
nunit.extensions.tests.dll
-
5
-
-
-
0
-
0
-
-
-
nunit-console.tests.dll
-
40
-
-
-
0
-
0
-
-
-
nunit.uikit.tests.dll
-
34
-
-
-
0
-
0
-
-
-
nunit-gui.tests.dll
-
15
-
-
-
0
-
0
-
-
-
nunit.fixtures.tests.dll
-
6
-
-
-
0
-
0
-
-
-
Code Snippet Tests
-
- These tests create a test assembly from a snippet of code and then load and run
- the tests that it contains, verifying that the structure of the loaded tests is
- as expected and that the number of tests run, skipped, ignored or failed is
- correct.
-
-
-
-
NUnit.Fixtures.SnippetRunner
-
-
-
Code
-
Tree()
-
Run()
-
Skipped()
-
Ignored()
-
Failures()
-
-
-
public class TestClass
-{
-}
-
-
EMPTY
-
0
-
0
-
0
-
0
-
-
-
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
-}
-
-
TestClass
-
0
-
0
-
0
-
0
-
-
-
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
- [Test]
- public void T1() { }
- [Test]
- public void T2() { }
- [Test]
- public void T3() { }
-}
-
-
TestClass
->T1
->T2
->T3
-
-
3
-
0
-
0
-
0
-
-
-
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass1
-{
- [Test]
- public void T1() { }
-}
-
-[TestFixture]
-public class TestClass2
-{
- [Test]
- public void T2() { }
- [Test]
- public void T3() { }
-}
-
-
TestClass1
->T1
-TestClass2
->T2
->T3
-
-
3
-
0
-
0
-
0
-
-
-
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
- [Test]
- public void T1() { }
- [Test, Ignore]
- public void T2() { }
- [Test]
- public void T3() { }
-}
-
-
TestClass
->T1
->T2
->T3
-
-
2
-
0
-
1
-
0
-
-
-
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
- [Test]
- public void T1() { }
- [Test, Explicit]
- public void T2() { }
- [Test]
- public void T3() { }
-}
-
-
TestClass
->T1
->T2
->T3
-
-
2
-
1
-
0
-
0
-
-
-
Summary Information
-
-
-
fit.Summary
-
-
-
-
diff --git a/lib/nunit/NUnitTests.config b/lib/nunit/NUnitTests.config
deleted file mode 100644
index de8a656988d..00000000000
--- a/lib/nunit/NUnitTests.config
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/nunit/NUnitTests.nunit b/lib/nunit/NUnitTests.nunit
deleted file mode 100644
index e7bb7f432a3..00000000000
--- a/lib/nunit/NUnitTests.nunit
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/nunit/agent.conf b/lib/nunit/agent.conf
deleted file mode 100644
index ddbcd8ea6d8..00000000000
--- a/lib/nunit/agent.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
- 8080
- .
-
\ No newline at end of file
diff --git a/lib/nunit/agent.log.conf b/lib/nunit/agent.log.conf
deleted file mode 100644
index 4bd90ca4931..00000000000
--- a/lib/nunit/agent.log.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/nunit/clr.bat b/lib/nunit/clr.bat
deleted file mode 100644
index 0a838482ca8..00000000000
--- a/lib/nunit/clr.bat
+++ /dev/null
@@ -1,96 +0,0 @@
-@echo off
-rem Run a program under a particular version of the .Net framework
-rem by setting the COMPLUS_Version environment variable.
-rem
-rem This command was written by Charlie Poole for the NUnit project.
-rem You may use it separately from NUnit at your own risk.
-
-if "%1"=="/?" goto help
-if "%1"=="?" goto help
-if "%1"=="" goto GetVersion
-if /I "%1"=="off" goto RemoveVersion
-if "%2"=="" goto SetVersion
-goto main
-
-:help
-echo Control the version of the .Net framework that is used. The
-echo command has several forms:
-echo.
-echo CLR
-echo Reports the version of the CLR that has been set
-echo.
-echo CLR version
-echo Sets the local shell environment to use a specific
-echo version of the CLR for subsequent commands.
-echo.
-echo CLR version command [arguments]
-echo Executes a single command using the specified CLR version.
-echo.
-echo CLR off
-echo Turns off specific version selection for commands
-echo.
-echo The CLR version may be specified as vn.n.n or n.n.n. In addition,
-echo the following shortcuts are recognized:
-echo net-1.0, 1.0 For version 1.0.3705
-echo net-1.1, 1.1 For version 1.1.4322
-echo beta2 For version 2.0.50215
-echo net-2.0, 2.0 For version 2.0.50727
-echo.
-echo NOTE:
-echo Any specific settings for required or supported runtime in
-echo the ^ section of a program's config file will
-echo override the version specified by this command, and the
-echo command will have no effect.
-echo.
-goto done
-
-:main
-
-setlocal
-set CMD=
-call :SetVersion %1
-shift /1
-
-:loop 'Copy remaining arguments to form the command
-if "%1"=="" goto run
-set CMD=%CMD% %1
-shift /1
-goto :loop
-
-:run 'Execute the command
-%CMD%
-endlocal
-goto done
-
-:SetVersion
-set COMPLUS_Version=%1
-
-rem Substitute proper format for certain names
-if /I "%COMPLUS_Version:~0,1%"=="v" goto useit
-if /I "%COMPLUS_Version%"=="net-1.0" set COMPLUS_Version=v1.0.3705&goto report
-if /I "%COMPLUS_Version%"=="1.0" set COMPLUS_Version=v1.0.3705&goto report
-if /I "%COMPLUS_Version%"=="net-1.1" set COMPLUS_Version=v1.1.4322&goto report
-if /I "%COMPLUS_Version%"=="1.1" set COMPLUS_Version=v1.1.4322&goto report
-if /I "%COMPLUS_Version%"=="beta2" set COMPLUS_Version=v2.0.50215&goto report
-if /I "%COMPLUS_Version%"=="net-2.0" set COMPLUS_Version=v2.0.50727&goto report
-if /I "%COMPLUS_Version%"=="2.0" set COMPLUS_Version=v2.0.50727&goto report
-
-rem Add additional substitutions here, branching to report
-
-rem assume it's a version number without 'v'
-set COMPLUS_Version=v%COMPLUS_Version%
-
-:report
-echo Setting CLR version to %COMPLUS_Version%
-goto done
-
-:GetVersion
-if "%COMPLUS_Version%"=="" echo CLR version is not set
-if NOT "%COMPLUS_Version%"=="" echo CLR version is set to %COMPLUS_Version%
-goto done
-
-:RemoveVersion
-set COMPLUS_Version=
-echo CLR version is no longer set
-
-:done
\ No newline at end of file
diff --git a/lib/nunit/launcher.log.conf b/lib/nunit/launcher.log.conf
deleted file mode 100644
index 4bd90ca4931..00000000000
--- a/lib/nunit/launcher.log.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/nunit/lib/Failure.png b/lib/nunit/lib/Failure.png
deleted file mode 100644
index 2e400b276fc..00000000000
Binary files a/lib/nunit/lib/Failure.png and /dev/null differ
diff --git a/lib/nunit/lib/Ignored.png b/lib/nunit/lib/Ignored.png
deleted file mode 100644
index 478efbf00be..00000000000
Binary files a/lib/nunit/lib/Ignored.png and /dev/null differ
diff --git a/lib/nunit/lib/Inconclusive.png b/lib/nunit/lib/Inconclusive.png
deleted file mode 100644
index 4807b7cedbc..00000000000
Binary files a/lib/nunit/lib/Inconclusive.png and /dev/null differ
diff --git a/lib/nunit/lib/Skipped.png b/lib/nunit/lib/Skipped.png
deleted file mode 100644
index 7c9fc64e387..00000000000
Binary files a/lib/nunit/lib/Skipped.png and /dev/null differ
diff --git a/lib/nunit/lib/Success.png b/lib/nunit/lib/Success.png
deleted file mode 100644
index 2a301508c65..00000000000
Binary files a/lib/nunit/lib/Success.png and /dev/null differ
diff --git a/lib/nunit/lib/fit.dll b/lib/nunit/lib/fit.dll
deleted file mode 100644
index 40bbef0e292..00000000000
Binary files a/lib/nunit/lib/fit.dll and /dev/null differ
diff --git a/lib/nunit/lib/log4net.dll b/lib/nunit/lib/log4net.dll
deleted file mode 100644
index 20a2e1c47de..00000000000
Binary files a/lib/nunit/lib/log4net.dll and /dev/null differ
diff --git a/lib/nunit/lib/nunit-console-runner.dll b/lib/nunit/lib/nunit-console-runner.dll
deleted file mode 100644
index 3f9c0e9316d..00000000000
Binary files a/lib/nunit/lib/nunit-console-runner.dll and /dev/null differ
diff --git a/lib/nunit/lib/nunit-gui-runner.dll b/lib/nunit/lib/nunit-gui-runner.dll
deleted file mode 100644
index 894c3383fda..00000000000
Binary files a/lib/nunit/lib/nunit-gui-runner.dll and /dev/null differ
diff --git a/lib/nunit/lib/nunit.core.dll b/lib/nunit/lib/nunit.core.dll
deleted file mode 100644
index 6fd79cf1469..00000000000
Binary files a/lib/nunit/lib/nunit.core.dll and /dev/null differ
diff --git a/lib/nunit/lib/nunit.core.interfaces.dll b/lib/nunit/lib/nunit.core.interfaces.dll
deleted file mode 100644
index 2794827b971..00000000000
Binary files a/lib/nunit/lib/nunit.core.interfaces.dll and /dev/null differ
diff --git a/lib/nunit/lib/nunit.fixtures.dll b/lib/nunit/lib/nunit.fixtures.dll
deleted file mode 100644
index 1658b3791b9..00000000000
Binary files a/lib/nunit/lib/nunit.fixtures.dll and /dev/null differ
diff --git a/lib/nunit/lib/nunit.uiexception.dll b/lib/nunit/lib/nunit.uiexception.dll
deleted file mode 100644
index 3f05866d919..00000000000
Binary files a/lib/nunit/lib/nunit.uiexception.dll and /dev/null differ
diff --git a/lib/nunit/lib/nunit.uikit.dll b/lib/nunit/lib/nunit.uikit.dll
deleted file mode 100644
index cb3cfdf9a6a..00000000000
Binary files a/lib/nunit/lib/nunit.uikit.dll and /dev/null differ
diff --git a/lib/nunit/lib/nunit.util.dll b/lib/nunit/lib/nunit.util.dll
deleted file mode 100644
index 71ca49bca56..00000000000
Binary files a/lib/nunit/lib/nunit.util.dll and /dev/null differ
diff --git a/lib/nunit/license.txt b/lib/nunit/license.txt
deleted file mode 100644
index 66a5ebf28bb..00000000000
--- a/lib/nunit/license.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-Copyright 2002-2008 Charlie Poole
-Copyright 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-Copyright 2000-2002 Philip A. Craig
-
-This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required.
-
-Portions Copyright 2002-2008 Charlie Poole or Copyright 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright 2000-2002 Philip A. Craig
-
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source distribution.
diff --git a/lib/nunit/nunit-agent.exe b/lib/nunit/nunit-agent.exe
deleted file mode 100644
index 9b189c1aab8..00000000000
Binary files a/lib/nunit/nunit-agent.exe and /dev/null differ
diff --git a/lib/nunit/nunit-agent.exe.config b/lib/nunit/nunit-agent.exe.config
deleted file mode 100644
index e33ec06e0e2..00000000000
--- a/lib/nunit/nunit-agent.exe.config
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/nunit/nunit-console-x86.exe b/lib/nunit/nunit-console-x86.exe
deleted file mode 100644
index 83849f3afd2..00000000000
Binary files a/lib/nunit/nunit-console-x86.exe and /dev/null differ
diff --git a/lib/nunit/nunit-console-x86.exe.config b/lib/nunit/nunit-console-x86.exe.config
deleted file mode 100644
index bd83fb17113..00000000000
--- a/lib/nunit/nunit-console-x86.exe.config
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/nunit/nunit-console.exe b/lib/nunit/nunit-console.exe
deleted file mode 100644
index 9f6190573ff..00000000000
Binary files a/lib/nunit/nunit-console.exe and /dev/null differ
diff --git a/lib/nunit/nunit-console.exe.config b/lib/nunit/nunit-console.exe.config
deleted file mode 100644
index 32956794162..00000000000
--- a/lib/nunit/nunit-console.exe.config
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/nunit/nunit-x86.exe b/lib/nunit/nunit-x86.exe
deleted file mode 100644
index 13832377797..00000000000
Binary files a/lib/nunit/nunit-x86.exe and /dev/null differ
diff --git a/lib/nunit/nunit-x86.exe.config b/lib/nunit/nunit-x86.exe.config
deleted file mode 100644
index 9d5ca14e971..00000000000
--- a/lib/nunit/nunit-x86.exe.config
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/nunit/nunit.exe b/lib/nunit/nunit.exe
deleted file mode 100644
index e3a0d28e1ae..00000000000
Binary files a/lib/nunit/nunit.exe and /dev/null differ
diff --git a/lib/nunit/nunit.exe.config b/lib/nunit/nunit.exe.config
deleted file mode 100644
index 9d5ca14e971..00000000000
--- a/lib/nunit/nunit.exe.config
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/nunit/nunit.framework.dll b/lib/nunit/nunit.framework.dll
deleted file mode 100644
index 2729ddf2890..00000000000
Binary files a/lib/nunit/nunit.framework.dll and /dev/null differ
diff --git a/lib/nunit/pnunit-agent.exe b/lib/nunit/pnunit-agent.exe
deleted file mode 100644
index 7a559eb243e..00000000000
Binary files a/lib/nunit/pnunit-agent.exe and /dev/null differ
diff --git a/lib/nunit/pnunit-agent.exe.config b/lib/nunit/pnunit-agent.exe.config
deleted file mode 100644
index f4236b6dd1b..00000000000
--- a/lib/nunit/pnunit-agent.exe.config
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/nunit/pnunit-launcher.exe b/lib/nunit/pnunit-launcher.exe
deleted file mode 100644
index 5251378d873..00000000000
Binary files a/lib/nunit/pnunit-launcher.exe and /dev/null differ
diff --git a/lib/nunit/pnunit-launcher.exe.config b/lib/nunit/pnunit-launcher.exe.config
deleted file mode 100644
index 87828f68deb..00000000000
--- a/lib/nunit/pnunit-launcher.exe.config
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/nunit/pnunit.framework.dll b/lib/nunit/pnunit.framework.dll
deleted file mode 100644
index 494dc721cc3..00000000000
Binary files a/lib/nunit/pnunit.framework.dll and /dev/null differ
diff --git a/lib/nunit/pnunit.tests.dll b/lib/nunit/pnunit.tests.dll
deleted file mode 100644
index ac67a2b4f3c..00000000000
Binary files a/lib/nunit/pnunit.tests.dll and /dev/null differ
diff --git a/lib/nunit/runFile.exe b/lib/nunit/runFile.exe
deleted file mode 100644
index a7944586696..00000000000
Binary files a/lib/nunit/runFile.exe and /dev/null differ
diff --git a/lib/nunit/runFile.exe.config b/lib/nunit/runFile.exe.config
deleted file mode 100644
index f58f099b6a2..00000000000
--- a/lib/nunit/runFile.exe.config
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/nunit/runpnunit.bat b/lib/nunit/runpnunit.bat
deleted file mode 100644
index a05cbb7d95b..00000000000
--- a/lib/nunit/runpnunit.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-start pnunit-agent agent.conf
-pnunit-launcher test.conf
\ No newline at end of file
diff --git a/lib/nunit/test.conf b/lib/nunit/test.conf
deleted file mode 100644
index 14cd11307bf..00000000000
--- a/lib/nunit/test.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
- Testing
-
-
- Testing
- pnunit.tests.dll
- TestLibraries.Testing.EqualTo19
- localhost:8080
-
- ..\server
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Orchard.Azure/Orchard.Azure.sln b/src/Orchard.Azure/Orchard.Azure.sln
index 87820064bdd..25dfb7e6796 100644
--- a/src/Orchard.Azure/Orchard.Azure.sln
+++ b/src/Orchard.Azure/Orchard.Azure.sln
@@ -490,12 +490,12 @@ Global
{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{1C981BB3-26F7-494C-9005-CC27A5144233} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{05660F47-D649-48BD-9DED-DF4E01E7CFF9} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
- {8F116B06-1C0E-4E4C-9A0A-D2FAB851E768} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
+ {8F116B06-1C0E-4E4C-9A0A-D2FAB851E768} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14}
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{194D3CCC-1153-474D-8176-FDE8D7D0D0BD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{CB70A642-8CEC-4DDE-8C9F-AD08900EC98D} = {84650275-884D-4CBB-9CC0-67553996E211}
{FBC8B571-ED50-49D8-8D9D-64AB7454A0D6} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
- {137906EA-15FE-4AD8-A6A0-27528F0477D6} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14}
+ {137906EA-15FE-4AD8-A6A0-27528F0477D6} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{3420C92A-747F-4990-BA08-F2C9531E44AD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{C889167C-E52C-4A65-A419-224B3D1B957D} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{99002B65-86F7-415E-BF4A-381AA8AB9CCC} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
@@ -507,14 +507,14 @@ Global
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{6F759635-13D7-4E94-BCC9-80445D63F117} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14}
- {3F72A4E9-7B72-4260-B010-C16EC54F9BAF} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
+ {3F72A4E9-7B72-4260-B010-C16EC54F9BAF} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14}
{475B6C45-B27C-438B-8966-908B9D6D1077} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{66FCCD76-2761-47E3-8D11-B45D0001DDAA} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{3787DDE5-E5C8-4841-BDA7-DCB325388064} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{5531E894-D259-45A3-AA61-26DBE720C1CE} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{91BC2E7F-DA04-421C-98EF-76D37CEC130C} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{E826F796-8CE3-4B5B-8423-5AA5F81D2FC3} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
- {2CF067CA-064B-43C6-8B88-5E3B99A65F1D} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
+ {2CF067CA-064B-43C6-8B88-5E3B99A65F1D} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14}
{F301EF7D-F19C-4D83-AA94-CB64F29C037D} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{FE5C5947-D2D5-42C5-992A-13D672946135} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{9CD5C81F-5828-4384-8474-2E2BE71D5EDD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
diff --git a/src/Orchard.Core.Tests/Properties/AssemblyInfo.cs b/src/Orchard.Core.Tests/Properties/AssemblyInfo.cs
index 2e3d2f71441..1ce9e62ce04 100644
--- a/src/Orchard.Core.Tests/Properties/AssemblyInfo.cs
+++ b/src/Orchard.Core.Tests/Properties/AssemblyInfo.cs
@@ -30,5 +30,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.10")]
-[assembly: AssemblyFileVersion("1.10")]
+[assembly: AssemblyVersion("1.10.1")]
+[assembly: AssemblyFileVersion("1.10.1")]
diff --git a/src/Orchard.Profile/Properties/AssemblyInfo.cs b/src/Orchard.Profile/Properties/AssemblyInfo.cs
index a420575c15d..3e5c2463486 100644
--- a/src/Orchard.Profile/Properties/AssemblyInfo.cs
+++ b/src/Orchard.Profile/Properties/AssemblyInfo.cs
@@ -30,5 +30,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.10")]
-[assembly: AssemblyFileVersion("1.10")]
+[assembly: AssemblyVersion("1.10.1")]
+[assembly: AssemblyFileVersion("1.10.1")]
diff --git a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs
index 306fa0e8b47..6894b11faee 100644
--- a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs
+++ b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs
@@ -24,7 +24,7 @@ public void GivenIHaveInstalledOrchard(string virtualDirectory) {
webApp.GivenIHaveACleanSiteWith(
virtualDirectory,
TableData(
- new { extension = "Module", names = "Lucene, Markdown, Orchard.Alias, Orchard.AntiSpam, Orchard.ArchiveLater, Orchard.Autoroute, Orchard.Azure, Orchard.Blogs, Orchard.Caching, Orchard.CodeGeneration, Orchard.Comments, Orchard.ContentPermissions, Orchard.ContentPicker, Orchard.ContentTypes, Orchard.CustomForms, Orchard.DesignerTools, Orchard.Email, Orchard.Fields, Orchard.Forms, Orchard.ImageEditor, Orchard.ImportExport, Orchard.Indexing, Orchard.JobsQueue, Orchard.Resources, Orchard.Layouts, Orchard.Lists, Orchard.Localization, Orchard.Media, Orchard.MediaLibrary, Orchard.MediaPicker, Orchard.MediaProcessing, Orchard.Migrations, Orchard.Modules, Orchard.MultiTenancy, Orchard.OutputCache, Orchard.Packaging, Orchard.Pages, Orchard.Projections, Orchard.PublishLater, Orchard.Recipes, Orchard.Roles, Orchard.Rules, Orchard.Scripting, Orchard.Scripting.CSharp, Orchard.Scripting.Dlr, Orchard.Search, Orchard.SecureSocketsLayer, Orchard.Setup, Orchard.Tags, Orchard.TaskLease, Orchard.Taxonomies, Orchard.Templates, Orchard.Themes, Orchard.Tokens, Orchard.Users, Orchard.Warmup, Orchard.Widgets, Orchard.Workflows, Orchard.Conditions, SysCache, TinyMce, Upgrade" },
+ new { extension = "Module", names = "Lucene, Markdown, Orchard.Alias, Orchard.AntiSpam, Orchard.ArchiveLater, Orchard.Autoroute, Orchard.Azure, Orchard.Blogs, Orchard.Caching, Orchard.CodeGeneration, Orchard.Comments, Orchard.ContentPermissions, Orchard.ContentPicker, Orchard.ContentTypes, Orchard.DesignerTools, Orchard.Email, Orchard.Fields, Orchard.Forms, Orchard.ImageEditor, Orchard.ImportExport, Orchard.Indexing, Orchard.JobsQueue, Orchard.Resources, Orchard.Layouts, Orchard.Lists, Orchard.Localization, Orchard.MediaLibrary, Orchard.MediaProcessing, Orchard.Migrations, Orchard.Modules, Orchard.MultiTenancy, Orchard.OutputCache, Orchard.Packaging, Orchard.Pages, Orchard.Projections, Orchard.PublishLater, Orchard.Recipes, Orchard.Roles, Orchard.Scripting, Orchard.Scripting.CSharp, Orchard.Scripting.Dlr, Orchard.Search, Orchard.SecureSocketsLayer, Orchard.Setup, Orchard.Tags, Orchard.Taxonomies, Orchard.Templates, Orchard.Themes, Orchard.Tokens, Orchard.Users, Orchard.Warmup, Orchard.Widgets, Orchard.Workflows, Orchard.Conditions, SysCache, TinyMce, Upgrade" },
new { extension = "Core", names = "Common, Containers, Contents, Dashboard, Feeds, Navigation, Scheduling, Settings, Shapes, Title, XmlRpc" },
new { extension = "Theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));
diff --git a/src/Orchard.Specs/Boolean.feature b/src/Orchard.Specs/Boolean.feature
index c36d964ba51..5335a953f1e 100644
--- a/src/Orchard.Specs/Boolean.feature
+++ b/src/Orchard.Specs/Boolean.feature
@@ -53,7 +53,7 @@ Scenario: Creating and using Boolean fields
And I go to "Admin/Contents/Create/Event"
Then I should see "Check if the event is active"
- # The default value should be selected
+ # The default value should be proposed on creation
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
@@ -65,14 +65,8 @@ Scenario: Creating and using Boolean fields
# The value should be required
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
- | name | value |
- | Fields[0].BooleanFieldSettings.Optional | false |
- And I fill in
- | name | value |
- | Fields[0].BooleanFieldSettings.NotSetLabel | May be |
- And I fill in
- | name | value |
- | Fields[0].BooleanFieldSettings.SelectionMode | Radiobutton |
+ | name | value |
+ | Fields[0].BooleanFieldSettings.Optional | false |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
diff --git a/src/Orchard.Specs/Boolean.feature.cs b/src/Orchard.Specs/Boolean.feature.cs
index f074e5cb270..937fa3e320f 100644
--- a/src/Orchard.Specs/Boolean.feature.cs
+++ b/src/Orchard.Specs/Boolean.feature.cs
@@ -195,40 +195,22 @@ public virtual void CreatingAndUsingBooleanFields()
"false"});
#line 67
testRunner.And("I fill in", ((string)(null)), table6, "And ");
-#line hidden
- TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table7.AddRow(new string[] {
- "Fields[0].BooleanFieldSettings.NotSetLabel",
- "May be"});
#line 70
- testRunner.And("I fill in", ((string)(null)), table7, "And ");
-#line hidden
- TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table8.AddRow(new string[] {
- "Fields[0].BooleanFieldSettings.SelectionMode",
- "Radiobutton"});
-#line 73
- testRunner.And("I fill in", ((string)(null)), table8, "And ");
-#line 76
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 77
+#line 71
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
- TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table9.AddRow(new string[] {
+ table7.AddRow(new string[] {
"Event.Active.Value",
""});
-#line 78
- testRunner.And("I fill in", ((string)(null)), table9, "And ");
-#line 81
+#line 72
+ testRunner.And("I fill in", ((string)(null)), table7, "And ");
+#line 75
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 82
+#line 76
testRunner.Then("I should see \"The field Active is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
diff --git a/src/Orchard.Specs/DateTime.feature b/src/Orchard.Specs/DateTime.feature
index ac4c8d2d8ec..d5861da701d 100644
--- a/src/Orchard.Specs/DateTime.feature
+++ b/src/Orchard.Specs/DateTime.feature
@@ -89,9 +89,9 @@ Scenario: Creating and using Date fields
# Required & Date and Time
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
- | name | value |
- | Fields[0].DateTimeFieldSettings.Display | DateAndTime |
- | Fields[0].DateTimeFieldSettings.Required | true |
+ | name | value |
+ | Fields[0].DateTimeFieldSettings.Display | DateAndTime |
+ | Fields[0].DateTimeFieldSettings.Required | true |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "Event.EventDate.Editor.Date"
@@ -139,6 +139,23 @@ Scenario: Creating and using Date fields
When I hit "Save"
Then I should see "Date of the event is required."
+ # The default value should be proposed on creation
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].DateTimeFieldSettings.Display | DateAndTime |
+ | Fields[0].DateTimeFieldSettings.Editor.Date | 01/31/2016 |
+ | Fields[0].DateTimeFieldSettings.Editor.Time | 10:00 AM |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "Event.EventDate.Editor.Date"
+ When I hit "Save"
+ And I am redirected
+ Then I should see "Your Event has been created."
+ When I go to "Admin/Contents/List"
+ Then I should see "Date of the event"
+ And I should see "1/31/2016 10:00"
+
Scenario: Creating and using date time fields in another culture
# Creating an Event content type
@@ -190,4 +207,4 @@ Scenario: Creating and using date time fields in another culture
| Event.EventDate.Editor.Time | 18:00 |
And I hit "Save"
And I am redirected
- Then I should see "Your Event has been created."
+ Then I should see "Your Event has been created."
\ No newline at end of file
diff --git a/src/Orchard.Specs/DateTime.feature.cs b/src/Orchard.Specs/DateTime.feature.cs
index 8439bf7567e..1204750915f 100644
--- a/src/Orchard.Specs/DateTime.feature.cs
+++ b/src/Orchard.Specs/DateTime.feature.cs
@@ -350,6 +350,41 @@ public virtual void CreatingAndUsingDateFields()
testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 140
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 143
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table15.AddRow(new string[] {
+ "Fields[0].DateTimeFieldSettings.Display",
+ "DateAndTime"});
+ table15.AddRow(new string[] {
+ "Fields[0].DateTimeFieldSettings.Editor.Date",
+ "01/31/2016"});
+ table15.AddRow(new string[] {
+ "Fields[0].DateTimeFieldSettings.Editor.Time",
+ "10:00 AM"});
+#line 144
+ testRunner.And("I fill in", ((string)(null)), table15, "And ");
+#line 149
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 150
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 151
+ testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 152
+ testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line 153
+ testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 154
+ testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 155
+ testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line 156
+ testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 157
+ testRunner.And("I should see \"1/31/2016 10:00\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
this.ScenarioCleanup();
}
@@ -359,119 +394,119 @@ public virtual void CreatingAndUsingDateFields()
public virtual void CreatingAndUsingDateTimeFieldsInAnotherCulture()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using date time fields in another culture", ((string[])(null)));
-#line 142
+#line 159
this.ScenarioSetup(scenarioInfo);
-#line 145
+#line 162
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line 146
+#line 163
testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 147
+#line 164
testRunner.And("I have the file \"Content\\orchard.core.po\" in \"Core\\App_Data\\Localization\\fr-FR\\or" +
"chard.core.po\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 148
+#line 165
testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 149
+#line 166
testRunner.Then("I should see \"]*>.*?Create new type\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 150
+#line 167
testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
- TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table15.AddRow(new string[] {
+ table16.AddRow(new string[] {
"DisplayName",
"Event"});
- table15.AddRow(new string[] {
+ table16.AddRow(new string[] {
"Name",
"Event"});
-#line 151
- testRunner.And("I fill in", ((string)(null)), table15, "And ");
-#line 155
+#line 168
+ testRunner.And("I fill in", ((string)(null)), table16, "And ");
+#line 172
testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 156
+#line 173
testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 157
+#line 174
testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 160
+#line 177
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 161
+#line 178
testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
- TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table16.AddRow(new string[] {
+ table17.AddRow(new string[] {
"DisplayName",
"Date of the event"});
- table16.AddRow(new string[] {
+ table17.AddRow(new string[] {
"Name",
"EventDate"});
- table16.AddRow(new string[] {
+ table17.AddRow(new string[] {
"FieldTypeName",
"DateTimeField"});
-#line 162
- testRunner.And("I fill in", ((string)(null)), table16, "And ");
-#line 167
+#line 179
+ testRunner.And("I fill in", ((string)(null)), table17, "And ");
+#line 184
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 168
+#line 185
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 169
+#line 186
testRunner.Then("I should see \"The \\\"Date of the event\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 172
+#line 189
testRunner.When("I have \"fr-FR\" as the default culture", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 173
+#line 190
testRunner.And("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
- TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table17.AddRow(new string[] {
+ table18.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"DateAndTime"});
- table17.AddRow(new string[] {
+ table18.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Required",
"true"});
-#line 174
- testRunner.And("I fill in", ((string)(null)), table17, "And ");
-#line 178
+#line 191
+ testRunner.And("I fill in", ((string)(null)), table18, "And ");
+#line 195
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 179
+#line 196
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
- TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table18.AddRow(new string[] {
+ table19.AddRow(new string[] {
"Event.EventDate.Editor.Date",
"01/31/2012"});
- table18.AddRow(new string[] {
+ table19.AddRow(new string[] {
"Event.EventDate.Editor.Time",
"12:00 AM"});
-#line 180
- testRunner.And("I fill in", ((string)(null)), table18, "And ");
-#line 184
+#line 197
+ testRunner.And("I fill in", ((string)(null)), table19, "And ");
+#line 201
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 185
+#line 202
testRunner.Then("I should see \"Date of the event could not be parsed as a valid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 186
+#line 203
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
- TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table20 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table19.AddRow(new string[] {
+ table20.AddRow(new string[] {
"Event.EventDate.Editor.Date",
"31/01/2012"});
- table19.AddRow(new string[] {
+ table20.AddRow(new string[] {
"Event.EventDate.Editor.Time",
"18:00"});
-#line 187
- testRunner.And("I fill in", ((string)(null)), table19, "And ");
-#line 191
+#line 204
+ testRunner.And("I fill in", ((string)(null)), table20, "And ");
+#line 208
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 192
+#line 209
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 193
+#line 210
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
diff --git a/src/Orchard.Specs/Enumeration.feature b/src/Orchard.Specs/Enumeration.feature
index 6864b9a834c..bee7b46ecf5 100644
--- a/src/Orchard.Specs/Enumeration.feature
+++ b/src/Orchard.Specs/Enumeration.feature
@@ -107,3 +107,34 @@ Scenario: Creating and using Enumeration fields
And I go to "Admin/Contents/Create/Event"
And I hit "Save"
Then I should see "The field Location is mandatory."
+
+ # The default value should be proposed on creation
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].EnumerationFieldSettings.Options | Seattle |
+ | Fields[0].EnumerationFieldSettings.ListMode | Dropdown |
+ | Fields[0].EnumerationFieldSettings.DefaultValue | Seattle |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "selected=\"selected">Seattle"
+
+ # The required attribute should be used
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].EnumerationFieldSettings.Required | true |
+ | Fields[0].EnumerationFieldSettings.ListMode | Listbox |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "required=\"required\""
+
+ # The required attribute should not be used
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].EnumerationFieldSettings.Required | false |
+ | Fields[0].EnumerationFieldSettings.ListMode | Listbox |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should not see "required=\"required\""
diff --git a/src/Orchard.Specs/Enumeration.feature.cs b/src/Orchard.Specs/Enumeration.feature.cs
index 88a011d4f81..6f62ed7f9f8 100644
--- a/src/Orchard.Specs/Enumeration.feature.cs
+++ b/src/Orchard.Specs/Enumeration.feature.cs
@@ -273,6 +273,69 @@ public virtual void CreatingAndUsingEnumerationFields()
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 109
testRunner.Then("I should see \"The field Location is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 112
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table11.AddRow(new string[] {
+ "Fields[0].EnumerationFieldSettings.Options",
+ "Seattle"});
+ table11.AddRow(new string[] {
+ "Fields[0].EnumerationFieldSettings.ListMode",
+ "Dropdown"});
+ table11.AddRow(new string[] {
+ "Fields[0].EnumerationFieldSettings.DefaultValue",
+ "Seattle"});
+#line 113
+ testRunner.And("I fill in", ((string)(null)), table11, "And ");
+#line 118
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 119
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 120
+ testRunner.Then("I should see \"selected=\\\"selected\">Seattle\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 123
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table12.AddRow(new string[] {
+ "Fields[0].EnumerationFieldSettings.Required",
+ "true"});
+ table12.AddRow(new string[] {
+ "Fields[0].EnumerationFieldSettings.ListMode",
+ "Listbox"});
+#line 124
+ testRunner.And("I fill in", ((string)(null)), table12, "And ");
+#line 128
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 129
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 130
+ testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 133
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table13.AddRow(new string[] {
+ "Fields[0].EnumerationFieldSettings.Required",
+ "false"});
+ table13.AddRow(new string[] {
+ "Fields[0].EnumerationFieldSettings.ListMode",
+ "Listbox"});
+#line 134
+ testRunner.And("I fill in", ((string)(null)), table13, "And ");
+#line 138
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 139
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 140
+ testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
diff --git a/src/Orchard.Specs/Hosting/TraceEnabledDataServicesProviderFactory.cs b/src/Orchard.Specs/Hosting/TraceEnabledDataServicesProviderFactory.cs
index 8e79f2b7a51..204e1e1eb8b 100644
--- a/src/Orchard.Specs/Hosting/TraceEnabledDataServicesProviderFactory.cs
+++ b/src/Orchard.Specs/Hosting/TraceEnabledDataServicesProviderFactory.cs
@@ -13,7 +13,8 @@ public TraceEnabledBuilder(string dataFolder, string connectionString) : base(da
}
public override IPersistenceConfigurer GetPersistenceConfigurer(bool createDatabase) {
var config = (MsSqlCeConfiguration)base.GetPersistenceConfigurer(createDatabase);
- config.ShowSql();
+ // Uncomment to display SQL while running tests
+ // config.ShowSql();
return config;
}
}
diff --git a/src/Orchard.Specs/Input.feature b/src/Orchard.Specs/Input.feature
index 35a8e761c98..2db7cb2c259 100644
--- a/src/Orchard.Specs/Input.feature
+++ b/src/Orchard.Specs/Input.feature
@@ -128,3 +128,30 @@ Scenario: Creating and using Input fields
When I go to "Admin/Contents/List"
Then I should see "Contact:"
And I should see "contact@orchardproject.net"
+
+ # The default value should be proposed on creation
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].InputFieldSettings.DefaultValue | contact@orchardproject.net |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "value=\"contact@orchardproject.net\""
+
+ # The required attribute should be used
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].InputFieldSettings.Required | true |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "required=\"required\""
+
+ # The required attribute should not be used
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].InputFieldSettings.Required | false |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should not see "required=\"required\""
\ No newline at end of file
diff --git a/src/Orchard.Specs/Input.feature.cs b/src/Orchard.Specs/Input.feature.cs
index 2e9c5415871..7d3df6de0cd 100644
--- a/src/Orchard.Specs/Input.feature.cs
+++ b/src/Orchard.Specs/Input.feature.cs
@@ -297,6 +297,57 @@ public virtual void CreatingAndUsingInputFields()
testRunner.Then("I should see \"Contact:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 130
testRunner.And("I should see \"contact@orchardproject.net\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 133
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table13.AddRow(new string[] {
+ "Fields[0].InputFieldSettings.DefaultValue",
+ "contact@orchardproject.net"});
+#line 134
+ testRunner.And("I fill in", ((string)(null)), table13, "And ");
+#line 137
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 138
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 139
+ testRunner.Then("I should see \"value=\\\"contact@orchardproject.net\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 142
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table14.AddRow(new string[] {
+ "Fields[0].InputFieldSettings.Required",
+ "true"});
+#line 143
+ testRunner.And("I fill in", ((string)(null)), table14, "And ");
+#line 146
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 147
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 148
+ testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 151
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table15.AddRow(new string[] {
+ "Fields[0].InputFieldSettings.Required",
+ "false"});
+#line 152
+ testRunner.And("I fill in", ((string)(null)), table15, "And ");
+#line 155
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 156
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 157
+ testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
diff --git a/src/Orchard.Specs/Link.feature b/src/Orchard.Specs/Link.feature
index 9ae1de5389d..2916a0a05f7 100644
--- a/src/Orchard.Specs/Link.feature
+++ b/src/Orchard.Specs/Link.feature
@@ -67,4 +67,31 @@ Scenario: Creating and using Link fields
| name | value |
| Event.SiteUrl.Value | |
And I hit "Save"
- Then I should see "Url is required for Site Url."
\ No newline at end of file
+ Then I should see "Url is required for Site Url."
+
+ # The default value should be proposed on creation
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].LinkFieldSettings.DefaultValue | http://www.orchardproject.net |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "value=\"http://www.orchardproject.net\""
+
+ # The required attribute should be used
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].LinkFieldSettings.Required | true |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "required=\"required\""
+
+ # The required attribute should not be used
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].LinkFieldSettings.Required | false |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should not see "required=\"required\""
\ No newline at end of file
diff --git a/src/Orchard.Specs/Link.feature.cs b/src/Orchard.Specs/Link.feature.cs
index 84b100ed46f..6f3b58a639a 100644
--- a/src/Orchard.Specs/Link.feature.cs
+++ b/src/Orchard.Specs/Link.feature.cs
@@ -204,6 +204,57 @@ public virtual void CreatingAndUsingLinkFields()
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 70
testRunner.Then("I should see \"Url is required for Site Url.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 73
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table8.AddRow(new string[] {
+ "Fields[0].LinkFieldSettings.DefaultValue",
+ "http://www.orchardproject.net"});
+#line 74
+ testRunner.And("I fill in", ((string)(null)), table8, "And ");
+#line 77
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 78
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 79
+ testRunner.Then("I should see \"value=\\\"http://www.orchardproject.net\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 82
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table9.AddRow(new string[] {
+ "Fields[0].LinkFieldSettings.Required",
+ "true"});
+#line 83
+ testRunner.And("I fill in", ((string)(null)), table9, "And ");
+#line 86
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 87
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 88
+ testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 91
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table10.AddRow(new string[] {
+ "Fields[0].LinkFieldSettings.Required",
+ "false"});
+#line 92
+ testRunner.And("I fill in", ((string)(null)), table10, "And ");
+#line 95
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 96
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 97
+ testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
diff --git a/src/Orchard.Specs/MultiTenancy.feature b/src/Orchard.Specs/MultiTenancy.feature
index 7134c19c96e..4701fd9ef89 100644
--- a/src/Orchard.Specs/MultiTenancy.feature
+++ b/src/Orchard.Specs/MultiTenancy.feature
@@ -25,6 +25,7 @@ Scenario: A new tenant is created
And I fill in
| name | value |
| Name | Scott |
+ | RequestUrlPrefix | scott |
And I hit "Save"
And I am redirected
Then I should see "
Scott\s*
"
@@ -37,6 +38,7 @@ Scenario: A new tenant is created with uninitialized state
And I fill in
| name | value |
| Name | Scott |
+ | RequestUrlPrefix | scott |
And I hit "Save"
And I am redirected
Then I should see "
"
@@ -199,4 +201,4 @@ Scenario: Listing tenants from command line
And I have tenant "Alpha" on "example.org" as "New-site-name"
When I execute >tenant list
Then I should see "Name: Alpha"
- And I should see "Request URL host: example.org"
\ No newline at end of file
+ And I should see "Request URL host: example.org"
diff --git a/src/Orchard.Specs/MultiTenancy.feature.cs b/src/Orchard.Specs/MultiTenancy.feature.cs
index f2867c62f62..5cee8d1d6ce 100644
--- a/src/Orchard.Specs/MultiTenancy.feature.cs
+++ b/src/Orchard.Specs/MultiTenancy.feature.cs
@@ -129,6 +129,9 @@ public virtual void ANewTenantIsCreated()
table1.AddRow(new string[] {
"Name",
"Scott"});
+ table1.AddRow(new string[] {
+ "RequestUrlPrefix",
+ "scott"});
#line 25
testRunner.And("I fill in", ((string)(null)), table1, "And ");
#line 28
@@ -163,6 +166,9 @@ public virtual void ANewTenantIsCreatedWithUninitializedState()
table2.AddRow(new string[] {
"Name",
"Scott"});
+ table2.AddRow(new string[] {
+ "RequestUrlPrefix",
+ "scott"});
#line 37
testRunner.And("I fill in", ((string)(null)), table2, "And ");
#line 40
diff --git a/src/Orchard.Specs/Numeric.feature b/src/Orchard.Specs/Numeric.feature
index d01d96bc8ce..4e76bfd2fc8 100644
--- a/src/Orchard.Specs/Numeric.feature
+++ b/src/Orchard.Specs/Numeric.feature
@@ -96,4 +96,39 @@ Scenario: Creating and using numeric fields
| Fields[0].NumericFieldSettings.Maximum | b |
And I hit "Save"
Then I should see "The value 'a' is not valid for Minimum."
- And I should see "The value 'b' is not valid for Maximum."
\ No newline at end of file
+ And I should see "The value 'b' is not valid for Maximum."
+
+ # The value should be validated
+ When I go to "Admin/Contents/Create/Event"
+ And I fill in
+ | name | value |
+ | Event.Guests.Value | a |
+ And I hit "Save"
+ Then I should see "Guests is an invalid number"
+
+ # The default value should be proposed on creation
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].NumericFieldSettings.DefaultValue | 1234 |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "value=\"1234\""
+
+ # The required attribute should be used
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].NumericFieldSettings.Required | true |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "required=\"required\""
+
+ # The required attribute should not be used
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].NumericFieldSettings.Required | false |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should not see "required=\"required\""
\ No newline at end of file
diff --git a/src/Orchard.Specs/Numeric.feature.cs b/src/Orchard.Specs/Numeric.feature.cs
index e90b2c1bf1d..4b7744a4405 100644
--- a/src/Orchard.Specs/Numeric.feature.cs
+++ b/src/Orchard.Specs/Numeric.feature.cs
@@ -265,6 +265,72 @@ public virtual void CreatingAndUsingNumericFields()
testRunner.Then("I should see \"The value 'a' is not valid for Minimum.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 99
testRunner.And("I should see \"The value 'b' is not valid for Maximum.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 102
+ testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table11.AddRow(new string[] {
+ "Event.Guests.Value",
+ "a"});
+#line 103
+ testRunner.And("I fill in", ((string)(null)), table11, "And ");
+#line 106
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 107
+ testRunner.Then("I should see \"Guests is an invalid number\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 110
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table12.AddRow(new string[] {
+ "Fields[0].NumericFieldSettings.DefaultValue",
+ "1234"});
+#line 111
+ testRunner.And("I fill in", ((string)(null)), table12, "And ");
+#line 114
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 115
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 116
+ testRunner.Then("I should see \"value=\\\"1234\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 119
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table13.AddRow(new string[] {
+ "Fields[0].NumericFieldSettings.Required",
+ "true"});
+#line 120
+ testRunner.And("I fill in", ((string)(null)), table13, "And ");
+#line 123
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 124
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 125
+ testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 128
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table14.AddRow(new string[] {
+ "Fields[0].NumericFieldSettings.Required",
+ "false"});
+#line 129
+ testRunner.And("I fill in", ((string)(null)), table14, "And ");
+#line 132
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 133
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 134
+ testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
diff --git a/src/Orchard.Specs/Orchard.Specs.csproj b/src/Orchard.Specs/Orchard.Specs.csproj
index 53136e1ea9e..40369c75248 100644
--- a/src/Orchard.Specs/Orchard.Specs.csproj
+++ b/src/Orchard.Specs/Orchard.Specs.csproj
@@ -205,6 +205,11 @@
TrueTrue
+
+ Text.feature
+ True
+ True
+ Input.featureTrue
@@ -371,6 +376,10 @@
HostComponents.config
+
+ SpecFlowSingleFileGenerator
+ Text.feature.cs
+ SpecFlowSingleFileGeneratorInput.feature.cs
diff --git a/src/Orchard.Specs/Properties/AssemblyInfo.cs b/src/Orchard.Specs/Properties/AssemblyInfo.cs
index 16d72e0d4b7..93ca9db20f5 100644
--- a/src/Orchard.Specs/Properties/AssemblyInfo.cs
+++ b/src/Orchard.Specs/Properties/AssemblyInfo.cs
@@ -30,5 +30,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.10")]
-[assembly: AssemblyFileVersion("1.10")]
+[assembly: AssemblyVersion("1.10.1")]
+[assembly: AssemblyFileVersion("1.10.1")]
diff --git a/src/Orchard.Specs/Text.feature b/src/Orchard.Specs/Text.feature
new file mode 100644
index 00000000000..0be4fc69351
--- /dev/null
+++ b/src/Orchard.Specs/Text.feature
@@ -0,0 +1,101 @@
+Feature: Text Field
+ In order to add Text content to my types
+ As an administrator
+ I want to create, edit and publish Text fields
+
+Scenario: Creating and using Text fields
+
+ # Creating an Event content type
+ Given I have installed Orchard
+ And I have installed "Orchard.Fields"
+ When I go to "Admin/ContentTypes"
+ Then I should see "]*>.*?Create new type"
+ When I go to "Admin/ContentTypes/Create"
+ And I fill in
+ | name | value |
+ | DisplayName | Event |
+ | Name | Event |
+ And I hit "Create"
+ And I go to "Admin/ContentTypes/"
+ Then I should see "Event"
+
+ # Adding a Text field
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I follow "Add Field"
+ And I fill in
+ | name | value |
+ | DisplayName | Subject |
+ | Name | Subject |
+ | FieldTypeName | TextField |
+ And I hit "Save"
+ And I am redirected
+ Then I should see "The \"Subject\" field has been added."
+
+ # The display option should be effective
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].TextFieldSettingsEventsViewModel.Settings.Flavor | Large |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "class=\"text large\""
+
+ # The value should be required
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | true |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ And I fill in
+ | name | value |
+ | Event.Subject.Text | |
+ And I hit "Save"
+ Then I should see "The field Subject is mandatory."
+
+ # The hint should be displayed
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].TextFieldSettingsEventsViewModel.Settings.Hint | Subject of the event |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "Subject of the event"
+
+ # Creating an Event content item
+ When I go to "Admin/Contents/Create/Event"
+ Then I should see "Subject"
+ When I fill in
+ | name | value |
+ | Event.Subject.Text | Orchard Harvest 2015 |
+ And I hit "Save"
+ And I am redirected
+ Then I should see "Your Event has been created."
+ And I should see "Orchard Harvest 2015"
+
+ # The default value should be proposed on creation
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue | Orchard Harvest 2016 |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "value=\"Orchard Harvest 2016\""
+
+ # The required attribute should be used
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | true |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "required=\"required\""
+
+ # The required attribute should not be used
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | false |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should not see "required=\"required\""
\ No newline at end of file
diff --git a/src/Orchard.Specs/Text.feature.cs b/src/Orchard.Specs/Text.feature.cs
new file mode 100644
index 00000000000..922a284917d
--- /dev/null
+++ b/src/Orchard.Specs/Text.feature.cs
@@ -0,0 +1,268 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.9.0.77
+// SpecFlow Generator Version:1.9.0.0
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+#region Designer generated code
+#pragma warning disable
+namespace Orchard.Specs
+{
+ using TechTalk.SpecFlow;
+
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")]
+ [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [NUnit.Framework.TestFixtureAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Text Field")]
+ public partial class TextFieldFeature
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+#line 1 "Text.feature"
+#line hidden
+
+ [NUnit.Framework.TestFixtureSetUpAttribute()]
+ public virtual void FeatureSetup()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Text Field", " In order to add Text content to my types\r\n As an administrator\r\n I want to cr" +
+ "eate, edit and publish Text fields", ProgrammingLanguage.CSharp, ((string[])(null)));
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ [NUnit.Framework.TestFixtureTearDownAttribute()]
+ public virtual void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ [NUnit.Framework.SetUpAttribute()]
+ public virtual void TestInitialize()
+ {
+ }
+
+ [NUnit.Framework.TearDownAttribute()]
+ public virtual void ScenarioTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioStart(scenarioInfo);
+ }
+
+ public virtual void ScenarioCleanup()
+ {
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Creating and using Text fields")]
+ public virtual void CreatingAndUsingTextFields()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using Text fields", ((string[])(null)));
+#line 6
+this.ScenarioSetup(scenarioInfo);
+#line 9
+ testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
+#line 10
+ testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 11
+ testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line 12
+ testRunner.Then("I should see \"]*>.*?Create new type\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 13
+ testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table1.AddRow(new string[] {
+ "DisplayName",
+ "Event"});
+ table1.AddRow(new string[] {
+ "Name",
+ "Event"});
+#line 14
+ testRunner.And("I fill in", ((string)(null)), table1, "And ");
+#line 18
+ testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 19
+ testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 20
+ testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 23
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line 24
+ testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line hidden
+ TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table2.AddRow(new string[] {
+ "DisplayName",
+ "Subject"});
+ table2.AddRow(new string[] {
+ "Name",
+ "Subject"});
+ table2.AddRow(new string[] {
+ "FieldTypeName",
+ "TextField"});
+#line 25
+ testRunner.And("I fill in", ((string)(null)), table2, "And ");
+#line 30
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 31
+ testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 32
+ testRunner.Then("I should see \"The \\\"Subject\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 35
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table3.AddRow(new string[] {
+ "Fields[0].TextFieldSettingsEventsViewModel.Settings.Flavor",
+ "Large"});
+#line 36
+ testRunner.And("I fill in", ((string)(null)), table3, "And ");
+#line 39
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 40
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 41
+ testRunner.Then("I should see \"class=\\\"text large\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 44
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table4.AddRow(new string[] {
+ "Fields[0].TextFieldSettingsEventsViewModel.Settings.Required",
+ "true"});
+#line 45
+ testRunner.And("I fill in", ((string)(null)), table4, "And ");
+#line 48
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 49
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line hidden
+ TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table5.AddRow(new string[] {
+ "Event.Subject.Text",
+ ""});
+#line 50
+ testRunner.And("I fill in", ((string)(null)), table5, "And ");
+#line 53
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 54
+ testRunner.Then("I should see \"The field Subject is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 57
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table6.AddRow(new string[] {
+ "Fields[0].TextFieldSettingsEventsViewModel.Settings.Hint",
+ "Subject of the event"});
+#line 58
+ testRunner.And("I fill in", ((string)(null)), table6, "And ");
+#line 61
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 62
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 63
+ testRunner.Then("I should see \"Subject of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 66
+ testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line 67
+ testRunner.Then("I should see \"Subject\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line hidden
+ TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table7.AddRow(new string[] {
+ "Event.Subject.Text",
+ "Orchard Harvest 2015"});
+#line 68
+ testRunner.When("I fill in", ((string)(null)), table7, "When ");
+#line 71
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 72
+ testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 73
+ testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 74
+ testRunner.And("I should see \"Orchard Harvest 2015\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 77
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table8.AddRow(new string[] {
+ "Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue",
+ "Orchard Harvest 2016"});
+#line 78
+ testRunner.And("I fill in", ((string)(null)), table8, "And ");
+#line 81
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 82
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 83
+ testRunner.Then("I should see \"value=\\\"Orchard Harvest 2016\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 86
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table9.AddRow(new string[] {
+ "Fields[0].TextFieldSettingsEventsViewModel.Settings.Required",
+ "true"});
+#line 87
+ testRunner.And("I fill in", ((string)(null)), table9, "And ");
+#line 90
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 91
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 92
+ testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 95
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table10.AddRow(new string[] {
+ "Fields[0].TextFieldSettingsEventsViewModel.Settings.Required",
+ "false"});
+#line 96
+ testRunner.And("I fill in", ((string)(null)), table10, "And ");
+#line 99
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 100
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 101
+ testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line hidden
+ this.ScenarioCleanup();
+ }
+ }
+}
+#pragma warning restore
+#endregion
diff --git a/src/Orchard.Tests.Modules/Properties/AssemblyInfo.cs b/src/Orchard.Tests.Modules/Properties/AssemblyInfo.cs
index a8924a7a7d1..942c0ba17bf 100644
--- a/src/Orchard.Tests.Modules/Properties/AssemblyInfo.cs
+++ b/src/Orchard.Tests.Modules/Properties/AssemblyInfo.cs
@@ -30,5 +30,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.10")]
-[assembly: AssemblyFileVersion("1.10")]
+[assembly: AssemblyVersion("1.10.1")]
+[assembly: AssemblyFileVersion("1.10.1")]
diff --git a/src/Orchard.Tests/DataUtility.cs b/src/Orchard.Tests/DataUtility.cs
index 20e12285c06..4c28290f807 100644
--- a/src/Orchard.Tests/DataUtility.cs
+++ b/src/Orchard.Tests/DataUtility.cs
@@ -23,7 +23,8 @@ public static ISessionFactory CreateSessionFactory(string fileName, params Type[
// .Conventions.AddFromAssemblyOf();
var persistenceModel = AbstractDataServicesProvider.CreatePersistenceModel(types.Select(t => new RecordBlueprint { TableName = "Test_" + t.Name, Type = t }).ToList());
var persistenceConfigurer = new SqlCeDataServicesProvider(fileName).GetPersistenceConfigurer(true/*createDatabase*/);
- ((MsSqlCeConfiguration)persistenceConfigurer).ShowSql();
+ // Uncomment to display SQL while running tests
+ // ((MsSqlCeConfiguration)persistenceConfigurer).ShowSql();
return Fluently.Configure()
.Database(persistenceConfigurer)
diff --git a/src/Orchard.Tests/FluentDbTests.cs b/src/Orchard.Tests/FluentDbTests.cs
index 39a038cd44d..70f8df0b082 100644
--- a/src/Orchard.Tests/FluentDbTests.cs
+++ b/src/Orchard.Tests/FluentDbTests.cs
@@ -46,7 +46,8 @@ public void CreatingSchemaForStatedClassesInTempFile() {
var fileName = "temp.sdf";
var persistenceConfigurer = new SqlCeDataServicesProvider(fileName).GetPersistenceConfigurer(true/*createDatabase*/);
- ((MsSqlCeConfiguration)persistenceConfigurer).ShowSql();
+ // Uncomment to display SQL while running tests
+ // ((MsSqlCeConfiguration)persistenceConfigurer).ShowSql();
var sessionFactory = Fluently.Configure()
.Database(persistenceConfigurer)
diff --git a/src/Orchard.Tests/Properties/AssemblyInfo.cs b/src/Orchard.Tests/Properties/AssemblyInfo.cs
index 02b2f097a00..dc92960f126 100644
--- a/src/Orchard.Tests/Properties/AssemblyInfo.cs
+++ b/src/Orchard.Tests/Properties/AssemblyInfo.cs
@@ -33,5 +33,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.10")]
-[assembly: AssemblyFileVersion("1.10")]
+[assembly: AssemblyVersion("1.10.1")]
+[assembly: AssemblyFileVersion("1.10.1")]
diff --git a/src/Orchard.WarmupStarter/Properties/AssemblyInfo.cs b/src/Orchard.WarmupStarter/Properties/AssemblyInfo.cs
index 409508a244f..83166cb9bac 100644
--- a/src/Orchard.WarmupStarter/Properties/AssemblyInfo.cs
+++ b/src/Orchard.WarmupStarter/Properties/AssemblyInfo.cs
@@ -32,8 +32,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.10")]
-[assembly: AssemblyFileVersion("1.10")]
+[assembly: AssemblyVersion("1.10.1")]
+[assembly: AssemblyFileVersion("1.10.1")]
// Enable web application to call this assembly in Full Trust
[assembly: AllowPartiallyTrustedCallers]
diff --git a/src/Orchard.Web.Tests/Properties/AssemblyInfo.cs b/src/Orchard.Web.Tests/Properties/AssemblyInfo.cs
index 266bef2aebf..203fbfe611a 100644
--- a/src/Orchard.Web.Tests/Properties/AssemblyInfo.cs
+++ b/src/Orchard.Web.Tests/Properties/AssemblyInfo.cs
@@ -33,5 +33,5 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.10")]
-[assembly: AssemblyFileVersion("1.10")]
+[assembly: AssemblyVersion("1.10.1")]
+[assembly: AssemblyFileVersion("1.10.1")]
diff --git a/src/Orchard.Web/Config/HostComponents.config b/src/Orchard.Web/Config/HostComponents.config
index 0e3fddd2570..e6866215114 100644
--- a/src/Orchard.Web/Config/HostComponents.config
+++ b/src/Orchard.Web/Config/HostComponents.config
@@ -95,7 +95,7 @@
-
+
@@ -120,5 +120,13 @@
+
+
+
+
+
+
+
+
diff --git a/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs b/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs
index b0dec0d20bf..8b8b92abc94 100644
--- a/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs
+++ b/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs
@@ -45,10 +45,13 @@ protected override DriverResult Display(ContentPart part, TextField field, strin
protected override DriverResult Editor(ContentPart part, TextField field, dynamic shapeHelper) {
return ContentShape("Fields_Common_Text_Edit", GetDifferentiator(field, part),
() => {
+ var settings = field.PartFieldDefinition.Settings.GetModel();
+ var text = part.IsNew() ? settings.DefaultValue : field.Value;
+
var viewModel = new TextFieldDriverViewModel {
Field = field,
- Text = field.Value,
- Settings = field.PartFieldDefinition.Settings.GetModel(),
+ Text = text,
+ Settings = settings,
ContentItem = part.ContentItem
};
@@ -58,28 +61,15 @@ protected override DriverResult Editor(ContentPart part, TextField field, dynami
protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater, dynamic shapeHelper) {
- var viewModel = new TextFieldDriverViewModel {
- Field = field,
- Text = field.Value,
- Settings = field.PartFieldDefinition.Settings.GetModel(),
- ContentItem = part.ContentItem
- };
+ var viewModel = new TextFieldDriverViewModel();
if (updater.TryUpdateModel(viewModel, GetPrefix(field, part), null, null)) {
- if (viewModel.Settings.Required && string.IsNullOrWhiteSpace(viewModel.Text)) {
- updater.AddModelError("Text", T("The field {0} is mandatory", T(field.DisplayName)));
- return ContentShape("Fields_Common_Text_Edit", GetDifferentiator(field, part),
- () => shapeHelper.EditorTemplate(TemplateName: "Fields.Common.Text.Edit", Model: viewModel, Prefix: GetPrefix(field, part)));
- }
+ var settings = field.PartFieldDefinition.Settings.GetModel();
field.Value = viewModel.Text;
- var settings = field.PartFieldDefinition.Settings.GetModel();
- if (String.IsNullOrEmpty(field.Value) && !String.IsNullOrEmpty(settings.DefaultValue)) {
- field.Value = settings.DefaultValue;
- }
- else {
- field.Value = viewModel.Text;
+ if (settings.Required && String.IsNullOrWhiteSpace(field.Value)) {
+ updater.AddModelError("Text", T("The field {0} is mandatory", T(field.DisplayName)));
}
}
diff --git a/src/Orchard.Web/Core/Common/Module.txt b/src/Orchard.Web/Core/Common/Module.txt
index c22491d28ca..c2ed93b80d9 100644
--- a/src/Orchard.Web/Core/Common/Module.txt
+++ b/src/Orchard.Web/Core/Common/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The common module introduces content parts that are going to be used by most content types (common, body, identity).
FeatureDescription: Core content parts.
diff --git a/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml b/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml
index bbd84d3504d..01bdbffded9 100644
--- a/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml
+++ b/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml
@@ -1,8 +1,6 @@
@model Orchard.Core.Common.ViewModels.TextFieldSettingsEventsViewModel
-@* This is a token-less default value editor that can be overridden from features that can depend on Orchard.Tokens. *@
-
@Html.TextBoxFor(m => m.Settings.DefaultValue, new { @class = "text large" })
-@T("Default value for the field. If there is no value given for the actual field, this will be filled in. (optional)")
+@T("The default value proposed when creating a content item. (optional)")
@Html.ValidationMessageFor(m => m.Settings.DefaultValue)
\ No newline at end of file
diff --git a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml
index de76c21bbd1..833887b1a7d 100644
--- a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml
+++ b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml
@@ -12,7 +12,4 @@
@if (HasText(Model.Settings.Hint)) {
@Model.Settings.Hint
}
- @if (!String.IsNullOrWhiteSpace(Model.Settings.DefaultValue)) {
- @T("If the field is left empty then the default value will be used.")
- }
\ No newline at end of file
diff --git a/src/Orchard.Web/Core/Containers/Module.txt b/src/Orchard.Web/Core/Containers/Module.txt
index 123205ff2b0..5dd850798b7 100644
--- a/src/Orchard.Web/Core/Containers/Module.txt
+++ b/src/Orchard.Web/Core/Containers/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The containers module introduces container and containable behaviors for content items.
FeatureDescription: Container and containable parts to enable parent-child relationships between content items.
diff --git a/src/Orchard.Web/Core/Contents/Module.txt b/src/Orchard.Web/Core/Contents/Module.txt
index ae1fd1e0d06..be6ee8d81f5 100644
--- a/src/Orchard.Web/Core/Contents/Module.txt
+++ b/src/Orchard.Web/Core/Contents/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The contents module enables the creation of custom content types.
Features:
diff --git a/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml b/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml
index 3a6d0e64ee3..6c52bf6a7db 100644
--- a/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml
+++ b/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml
@@ -8,7 +8,7 @@
Layout.Title = T("New {0}", Html.Raw(typeDisplayName)).Text;
}
-@using (Html.BeginFormAntiForgeryPost(Url.Action("Create", new { ReturnUrl = Request.QueryString["ReturnUrl"] }), FormMethod.Post, new { enctype = "multipart/form-data" })) {
+@using (Html.BeginFormAntiForgeryPost(Url.Action("Create", new { ReturnUrl = Request.QueryString["ReturnUrl"] }), FormMethod.Post, new { enctype = "multipart/form-data", @class = "no-multisubmit" })) {
@Html.ValidationSummary()
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
@Display(Model)
diff --git a/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml b/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml
index 8361060cdee..a06041fc94f 100644
--- a/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml
+++ b/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml
@@ -8,7 +8,7 @@
Layout.Title = pageTitle;
}
-@using (Html.BeginFormAntiForgeryPost(Url.Action("Edit"), FormMethod.Post, new { enctype = "multipart/form-data" })) {
+@using (Html.BeginFormAntiForgeryPost(Url.Action("Edit"), FormMethod.Post, new { enctype = "multipart/form-data", @class= "no-multisubmit" })) {
@Html.ValidationSummary()
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
@Display(Model)
diff --git a/src/Orchard.Web/Core/Dashboard/Module.txt b/src/Orchard.Web/Core/Dashboard/Module.txt
index 00c98816f5a..2af44b6bb82 100644
--- a/src/Orchard.Web/Core/Dashboard/Module.txt
+++ b/src/Orchard.Web/Core/Dashboard/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The dashboard module is providing the dashboard screen of the admininstration UI of the application.
FeatureDescription: Standard admin dashboard.
diff --git a/src/Orchard.Web/Core/Feeds/Module.txt b/src/Orchard.Web/Core/Feeds/Module.txt
index 65940b478a9..864977bad68 100644
--- a/src/Orchard.Web/Core/Feeds/Module.txt
+++ b/src/Orchard.Web/Core/Feeds/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The Feeds module is providing RSS feeds to content items.
FeatureDescription: RSS feeds for content items.
diff --git a/src/Orchard.Web/Core/Navigation/Module.txt b/src/Orchard.Web/Core/Navigation/Module.txt
index 080349f409d..af528f6259c 100644
--- a/src/Orchard.Web/Core/Navigation/Module.txt
+++ b/src/Orchard.Web/Core/Navigation/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The navigation module creates and manages a simple navigation menu for the front-end of the application and allows you to add content items to the admin menu.
FeatureDescription: Menu management.
diff --git a/src/Orchard.Web/Core/Properties/AssemblyInfo.cs b/src/Orchard.Web/Core/Properties/AssemblyInfo.cs
index 3fc2fad1c51..a5f74e88b4d 100644
--- a/src/Orchard.Web/Core/Properties/AssemblyInfo.cs
+++ b/src/Orchard.Web/Core/Properties/AssemblyInfo.cs
@@ -30,6 +30,6 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.10")]
-[assembly: AssemblyFileVersion("1.10")]
+[assembly: AssemblyVersion("1.10.1")]
+[assembly: AssemblyFileVersion("1.10.1")]
diff --git a/src/Orchard.Web/Core/Reports/Module.txt b/src/Orchard.Web/Core/Reports/Module.txt
index 0ecd0ca4e2b..7b9a61a2102 100644
--- a/src/Orchard.Web/Core/Reports/Module.txt
+++ b/src/Orchard.Web/Core/Reports/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The dashboard module is providing the reports screen of the application.
FeatureDescription: Reports management.
diff --git a/src/Orchard.Web/Core/Scheduling/Module.txt b/src/Orchard.Web/Core/Scheduling/Module.txt
index 29c407af70e..8ffc09edf53 100644
--- a/src/Orchard.Web/Core/Scheduling/Module.txt
+++ b/src/Orchard.Web/Core/Scheduling/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The scheduling module enables background task scheduling.
FeatureDescription: Scheduled background tasks.
diff --git a/src/Orchard.Web/Core/Settings/Module.txt b/src/Orchard.Web/Core/Settings/Module.txt
index 335b6d45c86..e02610c8887 100644
--- a/src/Orchard.Web/Core/Settings/Module.txt
+++ b/src/Orchard.Web/Core/Settings/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The settings module creates site settings that other modules can contribute to.
FeatureDescription: Site settings.
diff --git a/src/Orchard.Web/Core/Shapes/Module.txt b/src/Orchard.Web/Core/Shapes/Module.txt
index 91604839544..5254bf843f2 100644
--- a/src/Orchard.Web/Core/Shapes/Module.txt
+++ b/src/Orchard.Web/Core/Shapes/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The shapes module contains core shape templates and display hooks.
FeatureDescription: Core shape templates and display hooks.
diff --git a/src/Orchard.Web/Core/Title/Module.txt b/src/Orchard.Web/Core/Title/Module.txt
index d2817ffb372..7460786cf99 100644
--- a/src/Orchard.Web/Core/Title/Module.txt
+++ b/src/Orchard.Web/Core/Title/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The title module enables content items to have titles.
FeatureDescription: Title content part.
diff --git a/src/Orchard.Web/Core/XmlRpc/Module.txt b/src/Orchard.Web/Core/XmlRpc/Module.txt
index 7ead9857d0d..79849d9712f 100644
--- a/src/Orchard.Web/Core/XmlRpc/Module.txt
+++ b/src/Orchard.Web/Core/XmlRpc/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The XmlRpc module enables creation of contents from client applications such as LiveWriter.
FeatureDescription: XML-RPC opt-in implementation.
diff --git a/src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs b/src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs
index b2032ca4410..ed7949b284e 100644
--- a/src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs
+++ b/src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs
@@ -14,7 +14,7 @@ public LuceneSearchHit(Document document, float score) {
_score = score;
}
- public int ContentItemId { get { return int.Parse(GetString("id")); } }
+ public int ContentItemId { get { return GetInt("id"); } }
public int GetInt(string name) {
var field = _doc.GetField(name);
diff --git a/src/Orchard.Web/Modules/Lucene/Module.txt b/src/Orchard.Web/Modules/Lucene/Module.txt
index f6788e5277c..c6ab9b0b405 100644
--- a/src/Orchard.Web/Modules/Lucene/Module.txt
+++ b/src/Orchard.Web/Modules/Lucene/Module.txt
@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
-Version: 1.10
+Version: 1.10.1
OrchardVersion: 1.9
Description: The Lucene module enables the site to be indexed using Lucene.NET. The index generated by this module can then be used by the search module to provide an integrated full-text search experience to a web site.
FeatureDescription: Lucene indexing services.
diff --git a/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs
index fa1a87479de..a768a60354a 100644
--- a/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs
+++ b/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs
@@ -30,6 +30,6 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.10")]
-[assembly: AssemblyFileVersion("1.10")]
+[assembly: AssemblyVersion("1.10.1")]
+[assembly: AssemblyFileVersion("1.10.1")]
diff --git a/src/Orchard.Web/Modules/Markdown/Markdown.cs b/src/Orchard.Web/Modules/Markdown/Markdown.cs
deleted file mode 100644
index 68d33db695a..00000000000
--- a/src/Orchard.Web/Modules/Markdown/Markdown.cs
+++ /dev/null
@@ -1,1829 +0,0 @@
-/*
- * MarkdownSharp
- * -------------
- * a C# Markdown processor
- *
- * Markdown is a text-to-HTML conversion tool for web writers
- * Copyright (c) 2004 John Gruber
- * http://daringfireball.net/projects/markdown/
- *
- * Markdown.NET
- * Copyright (c) 2004-2009 Milan Negovan
- * http://www.aspnetresources.com
- * http://aspnetresources.com/blog/markdown_announced.aspx
- *
- * MarkdownSharp
- * Copyright (c) 2009-2011 Jeff Atwood
- * http://stackoverflow.com
- * http://www.codinghorror.com/blog/
- * http://code.google.com/p/markdownsharp/
- *
- * History: Milan ported the Markdown processor to C#. He granted license to me so I can open source it
- * and let the community contribute to and improve MarkdownSharp.
- *
- */
-
-#region Copyright and license
-
-/*
-
-Copyright (c) 2009 - 2010 Jeff Atwood
-
-http://www.opensource.org/licenses/mit-license.php
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-Copyright (c) 2003-2004 John Gruber
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-* Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-* Neither the name "Markdown" nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-This software is provided by the copyright holders and contributors "as
-is" and any express or implied warranties, including, but not limited
-to, the implied warranties of merchantability and fitness for a
-particular purpose are disclaimed. In no event shall the copyright owner
-or contributors be liable for any direct, indirect, incidental, special,
-exemplary, or consequential damages (including, but not limited to,
-procurement of substitute goods or services; loss of use, data, or
-profits; or business interruption) however caused and on any theory of
-liability, whether in contract, strict liability, or tort (including
-negligence or otherwise) arising in any way out of the use of this
-software, even if advised of the possibility of such damage.
-*/
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace MarkdownSharp
-{
-
- public class MarkdownOptions
- {
- ///
- /// when true, (most) bare plain URLs are auto-hyperlinked
- /// WARNING: this is a significant deviation from the markdown spec
- ///
- public bool AutoHyperlink { get; set; }
- ///
- /// when true, RETURN becomes a literal newline
- /// WARNING: this is a significant deviation from the markdown spec
- ///
- public bool AutoNewlines { get; set; }
- ///
- /// use ">" for HTML output, or " />" for XHTML output
- ///
- public string EmptyElementSuffix { get; set; }
- ///
- /// when false, email addresses will never be auto-linked
- /// WARNING: this is a significant deviation from the markdown spec
- ///
- public bool LinkEmails { get; set; }
- ///
- /// when true, bold and italic require non-word characters on either side
- /// WARNING: this is a significant deviation from the markdown spec
- ///
- public bool StrictBoldItalic { get; set; }
-
- ///
- /// when true, asterisks may be used for intraword emphasis
- /// this does nothing if StrictBoldItalic is false
- ///
- public bool AsteriskIntraWordEmphasis { get; set; }
- }
-
-
- ///
- /// Markdown is a text-to-HTML conversion tool for web writers.
- /// Markdown allows you to write using an easy-to-read, easy-to-write plain text format,
- /// then convert it to structurally valid XHTML (or HTML).
- ///
- public class Markdown
- {
- private const string _version = "1.13";
-
- #region Constructors and Options
-
- ///
- /// Create a new Markdown instance using default options
- ///
- public Markdown() : this(false)
- {
- }
-
- ///
- /// Create a new Markdown instance and optionally load options from a configuration
- /// file. There they should be stored in the appSettings section, available options are:
- ///
- /// Markdown.StrictBoldItalic (true/false)
- /// Markdown.EmptyElementSuffix (">" or " />" without the quotes)
- /// Markdown.LinkEmails (true/false)
- /// Markdown.AutoNewLines (true/false)
- /// Markdown.AutoHyperlink (true/false)
- /// Markdown.AsteriskIntraWordEmphasis (true/false)
- ///
- ///
- public Markdown(bool loadOptionsFromConfigFile)
- {
- if (!loadOptionsFromConfigFile) return;
-
- var settings = ConfigurationManager.AppSettings;
- foreach (string key in settings.Keys)
- {
- switch (key)
- {
- case "Markdown.AutoHyperlink":
- _autoHyperlink = Convert.ToBoolean(settings[key]);
- break;
- case "Markdown.AutoNewlines":
- _autoNewlines = Convert.ToBoolean(settings[key]);
- break;
- case "Markdown.EmptyElementSuffix":
- _emptyElementSuffix = settings[key];
- break;
- case "Markdown.LinkEmails":
- _linkEmails = Convert.ToBoolean(settings[key]);
- break;
- case "Markdown.StrictBoldItalic":
- _strictBoldItalic = Convert.ToBoolean(settings[key]);
- break;
- case "Markdown.AsteriskIntraWordEmphasis":
- _asteriskIntraWordEmphasis = Convert.ToBoolean(settings[key]);
- break;
- }
- }
- }
-
- ///
- /// Create a new Markdown instance and set the options from the MarkdownOptions object.
- ///
- public Markdown(MarkdownOptions options)
- {
- _autoHyperlink = options.AutoHyperlink;
- _autoNewlines = options.AutoNewlines;
- _emptyElementSuffix = options.EmptyElementSuffix;
- _linkEmails = options.LinkEmails;
- _strictBoldItalic = options.StrictBoldItalic;
- _asteriskIntraWordEmphasis = options.AsteriskIntraWordEmphasis;
- }
-
-
- ///
- /// use ">" for HTML output, or " />" for XHTML output
- ///
- public string EmptyElementSuffix
- {
- get { return _emptyElementSuffix; }
- set { _emptyElementSuffix = value; }
- }
- private string _emptyElementSuffix = " />";
-
- ///
- /// when false, email addresses will never be auto-linked
- /// WARNING: this is a significant deviation from the markdown spec
- ///
- public bool LinkEmails
- {
- get { return _linkEmails; }
- set { _linkEmails = value; }
- }
- private bool _linkEmails = true;
-
- ///
- /// when true, bold and italic require non-word characters on either side
- /// WARNING: this is a significant deviation from the markdown spec
- ///
- public bool StrictBoldItalic
- {
- get { return _strictBoldItalic; }
- set { _strictBoldItalic = value; }
- }
- private bool _strictBoldItalic = false;
-
- ///
- /// when true, asterisks may be used for intraword emphasis
- /// this does nothing if StrictBoldItalic is false
- ///
- public bool AsteriskIntraWordEmphasis
- {
- get { return _asteriskIntraWordEmphasis; }
- set { _asteriskIntraWordEmphasis = value; }
- }
- private bool _asteriskIntraWordEmphasis = false;
-
- ///
- /// when true, RETURN becomes a literal newline
- /// WARNING: this is a significant deviation from the markdown spec
- ///
- public bool AutoNewLines
- {
- get { return _autoNewlines; }
- set { _autoNewlines = value; }
- }
- private bool _autoNewlines = false;
-
- ///
- /// when true, (most) bare plain URLs are auto-hyperlinked
- /// WARNING: this is a significant deviation from the markdown spec
- ///
- public bool AutoHyperlink
- {
- get { return _autoHyperlink; }
- set { _autoHyperlink = value; }
- }
- private bool _autoHyperlink = false;
-
- #endregion
-
- private enum TokenType { Text, Tag }
-
- private struct Token
- {
- public Token(TokenType type, string value)
- {
- this.Type = type;
- this.Value = value;
- }
- public TokenType Type;
- public string Value;
- }
-
- ///
- /// maximum nested depth of [] and () supported by the transform; implementation detail
- ///
- private const int _nestDepth = 6;
-
- ///
- /// Tabs are automatically converted to spaces as part of the transform
- /// this constant determines how "wide" those tabs become in spaces
- ///
- private const int _tabWidth = 4;
-
- private const string _markerUL = @"[*+-]";
- private const string _markerOL = @"\d+[.]";
-
- private static readonly Dictionary _escapeTable;
- private static readonly Dictionary _invertedEscapeTable;
- private static readonly Dictionary _backslashEscapeTable;
-
- private readonly Dictionary _urls = new Dictionary();
- private readonly Dictionary _titles = new Dictionary();
- private readonly Dictionary _htmlBlocks = new Dictionary();
-
- private int _listLevel;
- private static string AutoLinkPreventionMarker = "\x1AP"; // temporarily replaces "://" where auto-linking shouldn't happen
-
- ///
- /// In the static constuctor we'll initialize what stays the same across all transforms.
- ///
- static Markdown()
- {
- // Table of hash values for escaped characters:
- _escapeTable = new Dictionary();
- _invertedEscapeTable = new Dictionary();
- // Table of hash value for backslash escaped characters:
- _backslashEscapeTable = new Dictionary();
-
- string backslashPattern = "";
-
- foreach (char c in @"\`*_{}[]()>#+-.!/:")
- {
- string key = c.ToString();
- string hash = GetHashKey(key, isHtmlBlock: false);
- _escapeTable.Add(key, hash);
- _invertedEscapeTable.Add(hash, key);
- _backslashEscapeTable.Add(@"\" + key, hash);
- backslashPattern += Regex.Escape(@"\" + key) + "|";
- }
-
- _backslashEscapes = new Regex(backslashPattern.Substring(0, backslashPattern.Length - 1), RegexOptions.Compiled);
- }
-
- ///
- /// current version of MarkdownSharp;
- /// see http://code.google.com/p/markdownsharp/ for the latest code or to contribute
- ///
- public string Version
- {
- get { return _version; }
- }
-
- ///
- /// Transforms the provided Markdown-formatted text to HTML;
- /// see http://en.wikipedia.org/wiki/Markdown
- ///
- ///
- /// The order in which other subs are called here is
- /// essential. Link and image substitutions need to happen before
- /// EscapeSpecialChars(), so that any *'s or _'s in the a
- /// and img tags get encoded.
- ///
- public string Transform(string text)
- {
- if (String.IsNullOrEmpty(text)) return "";
-
- Setup();
-
- text = Normalize(text);
-
- text = HashHTMLBlocks(text);
- text = StripLinkDefinitions(text);
- text = RunBlockGamut(text);
- text = Unescape(text);
-
- Cleanup();
-
- return text + "\n";
- }
-
-
- ///
- /// Perform transformations that form block-level tags like paragraphs, headers, and list items.
- ///
- private string RunBlockGamut(string text, bool unhash = true)
- {
- text = DoHeaders(text);
- text = DoHorizontalRules(text);
- text = DoLists(text);
- text = DoCodeBlocks(text);
- text = DoBlockQuotes(text);
-
- // We already ran HashHTMLBlocks() before, in Markdown(), but that
- // was to escape raw HTML in the original Markdown source. This time,
- // we're escaping the markup we've just created, so that we don't wrap
- //
tags around block-level tags.
- text = HashHTMLBlocks(text);
-
- text = FormParagraphs(text, unhash: unhash);
-
- return text;
- }
-
-
- ///
- /// Perform transformations that occur *within* block-level tags like paragraphs, headers, and list items.
- ///
- private string RunSpanGamut(string text)
- {
- text = DoCodeSpans(text);
- text = EscapeSpecialCharsWithinTagAttributes(text);
- text = EscapeBackslashes(text);
-
- // Images must come first, because ![foo][f] looks like an anchor.
- text = DoImages(text);
- text = DoAnchors(text);
-
- // Must come after DoAnchors(), because you can use < and >
- // delimiters in inline links like [this]().
- text = DoAutoLinks(text);
-
- text = text.Replace(AutoLinkPreventionMarker, "://");
-
- text = EncodeAmpsAndAngles(text);
- text = DoItalicsAndBold(text);
- text = DoHardBreaks(text);
-
- return text;
- }
-
- private static Regex _newlinesLeadingTrailing = new Regex(@"^\n+|\n+\z", RegexOptions.Compiled);
- private static Regex _newlinesMultiple = new Regex(@"\n{2,}", RegexOptions.Compiled);
- private static Regex _leadingWhitespace = new Regex(@"^[ ]*", RegexOptions.Compiled);
-
- private static Regex _htmlBlockHash = new Regex("\x1AH\\d+H", RegexOptions.Compiled);
-
- ///
- /// splits on two or more newlines, to form "paragraphs";
- /// each paragraph is then unhashed (if it is a hash and unhashing isn't turned off) or wrapped in HTML p tag
- ///
- private string FormParagraphs(string text, bool unhash = true)
- {
- // split on two or more newlines
- string[] grafs = _newlinesMultiple.Split(_newlinesLeadingTrailing.Replace(text, ""));
-
- for (int i = 0; i < grafs.Length; i++)
- {
- if (grafs[i].StartsWith("\x1AH"))
- {
- // unhashify HTML blocks
- if (unhash)
- {
- int sanityCheck = 50; // just for safety, guard against an infinite loop
- bool keepGoing = true; // as long as replacements where made, keep going
- while (keepGoing && sanityCheck > 0)
- {
- keepGoing = false;
- grafs[i] = _htmlBlockHash.Replace(grafs[i], match =>
- {
- keepGoing = true;
- return _htmlBlocks[match.Value];
- });
- sanityCheck--;
- }
- /* if (keepGoing)
- {
- // Logging of an infinite loop goes here.
- // If such a thing should happen, please open a new issue on http://code.google.com/p/markdownsharp/
- // with the input that caused it.
- }*/
- }
- }
- else
- {
- // do span level processing inside the block, then wrap result in
";
- }
- }
-
- return string.Join("\n\n", grafs);
- }
-
-
- private void Setup()
- {
- // Clear the global hashes. If we don't clear these, you get conflicts
- // from other articles when generating a page which contains more than
- // one article (e.g. an index page that shows the N most recent
- // articles):
- _urls.Clear();
- _titles.Clear();
- _htmlBlocks.Clear();
- _listLevel = 0;
- }
-
- private void Cleanup()
- {
- Setup();
- }
-
- private static string _nestedBracketsPattern;
-
- ///
- /// Reusable pattern to match balanced [brackets]. See Friedl's
- /// "Mastering Regular Expressions", 2nd Ed., pp. 328-331.
- ///
- private static string GetNestedBracketsPattern()
- {
- // in other words [this] and [this[also]] and [this[also[too]]]
- // up to _nestDepth
- if (_nestedBracketsPattern == null)
- _nestedBracketsPattern =
- RepeatString(@"
- (?> # Atomic matching
- [^\[\]]+ # Anything other than brackets
- |
- \[
- ", _nestDepth) + RepeatString(
- @" \]
- )*"
- , _nestDepth);
- return _nestedBracketsPattern;
- }
-
- private static string _nestedParensPattern;
-
- ///
- /// Reusable pattern to match balanced (parens). See Friedl's
- /// "Mastering Regular Expressions", 2nd Ed., pp. 328-331.
- ///
- private static string GetNestedParensPattern()
- {
- // in other words (this) and (this(also)) and (this(also(too)))
- // up to _nestDepth
- if (_nestedParensPattern == null)
- _nestedParensPattern =
- RepeatString(@"
- (?> # Atomic matching
- [^()\s]+ # Anything other than parens or whitespace
- |
- \(
- ", _nestDepth) + RepeatString(
- @" \)
- )*"
- , _nestDepth);
- return _nestedParensPattern;
- }
-
- private static Regex _linkDef = new Regex(string.Format(@"
- ^[ ]{{0,{0}}}\[([^\[\]]+)\]: # id = $1
- [ ]*
- \n? # maybe *one* newline
- [ ]*
- (\S+?)>? # url = $2
- [ ]*
- \n? # maybe one newline
- [ ]*
- (?:
- (?<=\s) # lookbehind for whitespace
- [""(]
- (.+?) # title = $3
- ["")]
- [ ]*
- )? # title is optional
- (?:\n+|\Z)", _tabWidth - 1), RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
-
- ///
- /// Strips link definitions from text, stores the URLs and titles in hash references.
- ///
- ///
- /// ^[id]: url "optional title"
- ///
- private string StripLinkDefinitions(string text)
- {
- return _linkDef.Replace(text, new MatchEvaluator(LinkEvaluator));
- }
-
- private string LinkEvaluator(Match match)
- {
- string linkID = match.Groups[1].Value.ToLowerInvariant();
- _urls[linkID] = EncodeAmpsAndAngles(match.Groups[2].Value);
-
- if (match.Groups[3] != null && match.Groups[3].Length > 0)
- _titles[linkID] = match.Groups[3].Value.Replace("\"", """);
-
- return "";
- }
-
- // compiling this monster regex results in worse performance. trust me.
- private static Regex _blocksHtml = new Regex(GetBlockPattern(), RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
-
-
- ///
- /// derived pretty much verbatim from PHP Markdown
- ///
- private static string GetBlockPattern()
- {
-
- // Hashify HTML blocks:
- // We only want to do this for block-level HTML tags, such as headers,
- // lists, and tables. That's because we still want to wrap
s around
- // "paragraphs" that are wrapped in non-block-level tags, such as anchors,
- // phrase emphasis, and spans. The list of tags we're looking for is
- // hard-coded:
- //
- // * List "a" is made of tags which can be both inline or block-level.
- // These will be treated block-level when the start tag is alone on
- // its line, otherwise they're not matched here and will be taken as
- // inline later.
- // * List "b" is made of tags which are always block-level;
- //
- string blockTagsA = "ins|del";
- string blockTagsB = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|script|noscript|form|fieldset|iframe|math";
-
- // Regular expression for the content of a block tag.
- string attr = @"
- (?> # optional tag attributes
- \s # starts with whitespace
- (?>
- [^>""/]+ # text outside quotes
- |
- /+(?!>) # slash not followed by >
- |
- ""[^""]*"" # text inside double quotes (tolerate >)
- |
- '[^']*' # text inside single quotes (tolerate >)
- )*
- )?
- ";
-
- string content = RepeatString(@"
- (?>
- [^<]+ # content without tag
- |
- <\2 # nested opening tag
- " + attr + @" # attributes
- (?>
- />
- |
- >", _nestDepth) + // end of opening tag
- ".*?" + // last level nested tag content
- RepeatString(@"
- \2\s*> # closing nested tag
- )
- |
- <(?!/\2\s*> # other tags with a different name
- )
- )*", _nestDepth);
-
- string content2 = content.Replace(@"\2", @"\3");
-
- // First, look for nested blocks, e.g.:
- //
- //
- // tags for inner block must be indented.
- //
- //
- //
- // The outermost tags must start at the left margin for this to match, and
- // the inner nested divs must be indented.
- // We need to do this before the next, more liberal match, because the next
- // match will start at the first `
` and stop at the first `
`.
- string pattern = @"
- (?>
- (?>
- (?<=\n) # Starting at the beginning of a line
- | # or
- \A\n? # the beginning of the doc
- )
- ( # save in $1
-
- # Match from `\n` to `\n`, handling nested tags
- # in between.
-
- <($block_tags_b_re) # start tag = $2
- $attr> # attributes followed by > and \n
- $content # content, support nesting
- \2> # the matching end tag
- [ ]* # trailing spaces
- (?=\n+|\Z) # followed by a newline or end of document
-
- | # Special version for tags of group a.
-
- <($block_tags_a_re) # start tag = $3
- $attr>[ ]*\n # attributes followed by >
- $content2 # content, support nesting
- \3> # the matching end tag
- [ ]* # trailing spaces
- (?=\n+|\Z) # followed by a newline or end of document
-
- | # Special case just for . It was easier to make a special
- # case than to make the other regex more complicated.
-
- [ ]{0,$less_than_tab}
- # the matching end tag
- [ ]*
- (?=\n{2,}|\Z) # followed by a blank line or end of document
-
- | # Special case for standalone HTML comments:
-
- (?<=\n\n|\A) # preceded by a blank line or start of document
- [ ]{0,$less_than_tab}
- (?s:
-
- )
- [ ]*
- (?=\n{2,}|\Z) # followed by a blank line or end of document
-
- | # PHP and ASP-style processor instructions ( and <%)
-
- [ ]{0,$less_than_tab}
- (?s:
- <([?%]) # $4
- .*?
- \4>
- )
- [ ]*
- (?=\n{2,}|\Z) # followed by a blank line or end of document
-
- )
- )";
-
- pattern = pattern.Replace("$less_than_tab", (_tabWidth - 1).ToString());
- pattern = pattern.Replace("$block_tags_b_re", blockTagsB);
- pattern = pattern.Replace("$block_tags_a_re", blockTagsA);
- pattern = pattern.Replace("$attr", attr);
- pattern = pattern.Replace("$content2", content2);
- pattern = pattern.Replace("$content", content);
-
- return pattern;
- }
-
- ///
- /// replaces any block-level HTML blocks with hash entries
- ///
- private string HashHTMLBlocks(string text)
- {
- return _blocksHtml.Replace(text, new MatchEvaluator(HtmlEvaluator));
- }
-
- private string HtmlEvaluator(Match match)
- {
- string text = match.Groups[1].Value;
- string key = GetHashKey(text, isHtmlBlock: true);
- _htmlBlocks[key] = text;
-
- return string.Concat("\n\n", key, "\n\n");
- }
-
- private static string GetHashKey(string s, bool isHtmlBlock)
- {
- var delim = isHtmlBlock ? 'H' : 'E';
- return "\x1A" + delim + Math.Abs(s.GetHashCode()).ToString() + delim;
- }
-
- private static Regex _htmlTokens = new Regex(@"
- ()| # match
- (<\?.*?\?>)| # match " +
- RepeatString(@"
- (<[A-Za-z\/!$](?:[^<>]|", _nestDepth) + RepeatString(@")*>)", _nestDepth) +
- " # match and ",
- RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
-
- ///
- /// returns an array of HTML tokens comprising the input string. Each token is
- /// either a tag (possibly with nested, tags contained therein, such
- /// as <a href="<MTFoo>">, or a run of text between tags. Each element of the
- /// array is a two-element array; the first is either 'tag' or 'text'; the second is
- /// the actual value.
- ///
- private List TokenizeHTML(string text)
- {
- int pos = 0;
- int tagStart = 0;
- var tokens = new List();
-
- // this regex is derived from the _tokenize() subroutine in Brad Choate's MTRegex plugin.
- // http://www.bradchoate.com/past/mtregex.php
- foreach (Match m in _htmlTokens.Matches(text))
- {
- tagStart = m.Index;
-
- if (pos < tagStart)
- tokens.Add(new Token(TokenType.Text, text.Substring(pos, tagStart - pos)));
-
- tokens.Add(new Token(TokenType.Tag, m.Value));
- pos = tagStart + m.Length;
- }
-
- if (pos < text.Length)
- tokens.Add(new Token(TokenType.Text, text.Substring(pos, text.Length - pos)));
-
- return tokens;
- }
-
-
- private static Regex _anchorRef = new Regex(string.Format(@"
- ( # wrap whole match in $1
- \[
- ({0}) # link text = $2
- \]
-
- [ ]? # one optional space
- (?:\n[ ]*)? # one optional newline followed by spaces
-
- \[
- (.*?) # id = $3
- \]
- )", GetNestedBracketsPattern()), RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
-
- private static Regex _anchorInline = new Regex(string.Format(@"
- ( # wrap whole match in $1
- \[
- ({0}) # link text = $2
- \]
- \( # literal paren
- [ ]*
- ({1}) # href = $3
- [ ]*
- ( # $4
- (['""]) # quote char = $5
- (.*?) # title = $6
- \5 # matching quote
- [ ]* # ignore any spaces between closing quote and )
- )? # title is optional
- \)
- )", GetNestedBracketsPattern(), GetNestedParensPattern()),
- RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
-
- private static Regex _anchorRefShortcut = new Regex(@"
- ( # wrap whole match in $1
- \[
- ([^\[\]]+) # link text = $2; can't contain [ or ]
- \]
- )", RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
-
- ///
- /// Turn Markdown link shortcuts into HTML anchor tags
- ///
- ///
- /// [link text](url "title")
- /// [link text][id]
- /// [id]
- ///
- private string DoAnchors(string text)
- {
- if (!text.Contains("["))
- return text;
-
- // First, handle reference-style links: [link text] [id]
- text = _anchorRef.Replace(text, new MatchEvaluator(AnchorRefEvaluator));
-
- // Next, inline-style links: [link text](url "optional title") or [link text](url "optional title")
- text = _anchorInline.Replace(text, new MatchEvaluator(AnchorInlineEvaluator));
-
- // Last, handle reference-style shortcuts: [link text]
- // These must come last in case you've also got [link test][1]
- // or [link test](/foo)
- text = _anchorRefShortcut.Replace(text, new MatchEvaluator(AnchorRefShortcutEvaluator));
- return text;
- }
-
- private string SaveFromAutoLinking(string s)
- {
- return s.Replace("://", AutoLinkPreventionMarker);
- }
-
- private string AnchorRefEvaluator(Match match)
- {
- string wholeMatch = match.Groups[1].Value;
- string linkText = SaveFromAutoLinking(match.Groups[2].Value);
- string linkID = match.Groups[3].Value.ToLowerInvariant();
-
- string result;
-
- // for shortcut links like [this][].
- if (linkID == "")
- linkID = linkText.ToLowerInvariant();
-
- if (_urls.ContainsKey(linkID))
- {
- string url = _urls[linkID];
-
- url = AttributeSafeUrl(url);
-
- result = "" + linkText + "";
- }
- else
- result = wholeMatch;
-
- return result;
- }
-
- private string AnchorRefShortcutEvaluator(Match match)
- {
- string wholeMatch = match.Groups[1].Value;
- string linkText = SaveFromAutoLinking(match.Groups[2].Value);
- string linkID = Regex.Replace(linkText.ToLowerInvariant(), @"[ ]*\n[ ]*", " "); // lower case and remove newlines / extra spaces
-
- string result;
-
- if (_urls.ContainsKey(linkID))
- {
- string url = _urls[linkID];
-
- url = AttributeSafeUrl(url);
-
- result = "" + linkText + "";
- }
- else
- result = wholeMatch;
-
- return result;
- }
-
-
- private string AnchorInlineEvaluator(Match match)
- {
- string linkText = SaveFromAutoLinking(match.Groups[2].Value);
- string url = match.Groups[3].Value;
- string title = match.Groups[6].Value;
- string result;
-
- if (url.StartsWith("<") && url.EndsWith(">"))
- url = url.Substring(1, url.Length - 2); // remove <>'s surrounding URL, if present
-
- url = AttributeSafeUrl(url);
-
- result = string.Format("{0}", linkText);
- return result;
- }
-
- private static Regex _imagesRef = new Regex(@"
- ( # wrap whole match in $1
- !\[
- (.*?) # alt text = $2
- \]
-
- [ ]? # one optional space
- (?:\n[ ]*)? # one optional newline followed by spaces
-
- \[
- (.*?) # id = $3
- \]
-
- )", RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled);
-
- private static Regex _imagesInline = new Regex(String.Format(@"
- ( # wrap whole match in $1
- !\[
- (.*?) # alt text = $2
- \]
- \s? # one optional whitespace character
- \( # literal paren
- [ ]*
- ({0}) # href = $3
- [ ]*
- ( # $4
- (['""]) # quote char = $5
- (.*?) # title = $6
- \5 # matching quote
- [ ]*
- )? # title is optional
- \)
- )", GetNestedParensPattern()),
- RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled);
-
- ///
- /// Turn Markdown image shortcuts into HTML img tags.
- ///
- ///
- /// ![alt text][id]
- /// ![alt text](url "optional title")
- ///
- private string DoImages(string text)
- {
- if (!text.Contains("!["))
- return text;
-
- // First, handle reference-style labeled images: ![alt text][id]
- text = _imagesRef.Replace(text, new MatchEvaluator(ImageReferenceEvaluator));
-
- // Next, handle inline images: ![alt text](url "optional title")
- // Don't forget: encode * and _
- text = _imagesInline.Replace(text, new MatchEvaluator(ImageInlineEvaluator));
-
- return text;
- }
-
- // This prevents the creation of horribly broken HTML when some syntax ambiguities
- // collide. It likely still doesn't do what the user meant, but at least we're not
- // outputting garbage.
- private string EscapeImageAltText(string s)
- {
- s = EscapeBoldItalic(s);
- s = Regex.Replace(s, @"[\[\]()]", m => _escapeTable[m.ToString()]);
- return s;
- }
-
- private string ImageReferenceEvaluator(Match match)
- {
- string wholeMatch = match.Groups[1].Value;
- string altText = match.Groups[2].Value;
- string linkID = match.Groups[3].Value.ToLowerInvariant();
-
- // for shortcut links like ![this][].
- if (linkID == "")
- linkID = altText.ToLowerInvariant();
-
- if (_urls.ContainsKey(linkID))
- {
- string url = _urls[linkID];
- string title = null;
-
- if (_titles.ContainsKey(linkID))
- title = _titles[linkID];
-
- return ImageTag(url, altText, title);
- }
- else
- {
- // If there's no such link ID, leave intact:
- return wholeMatch;
- }
- }
-
- private string ImageInlineEvaluator(Match match)
- {
- string alt = match.Groups[2].Value;
- string url = match.Groups[3].Value;
- string title = match.Groups[6].Value;
-
- if (url.StartsWith("<") && url.EndsWith(">"))
- url = url.Substring(1, url.Length - 2); // Remove <>'s surrounding URL, if present
-
- return ImageTag(url, alt, title);
- }
-
- private string ImageTag(string url, string altText, string title)
- {
- altText = EscapeImageAltText(AttributeEncode(altText));
- url = AttributeSafeUrl(url);
- var result = string.Format("
- /// Turn Markdown headers into HTML header tags
- ///
- ///
- /// Header 1
- /// ========
- ///
- /// Header 2
- /// --------
- ///
- /// # Header 1
- /// ## Header 2
- /// ## Header 2 with closing hashes ##
- /// ...
- /// ###### Header 6
- ///
- private string DoHeaders(string text)
- {
- text = _headerSetext.Replace(text, new MatchEvaluator(SetextHeaderEvaluator));
- text = _headerAtx.Replace(text, new MatchEvaluator(AtxHeaderEvaluator));
- return text;
- }
-
- private string SetextHeaderEvaluator(Match match)
- {
- string header = match.Groups[1].Value;
- int level = match.Groups[2].Value.StartsWith("=") ? 1 : 2;
- return string.Format("{0}\n\n", RunSpanGamut(header), level);
- }
-
- private string AtxHeaderEvaluator(Match match)
- {
- string header = match.Groups[2].Value;
- int level = match.Groups[1].Value.Length;
- return string.Format("{0}\n\n", RunSpanGamut(header), level);
- }
-
-
- private static Regex _horizontalRules = new Regex(@"
- ^[ ]{0,3} # Leading space
- ([-*_]) # $1: First marker
- (?> # Repeated marker group
- [ ]{0,2} # Zero, one, or two spaces.
- \1 # Marker character
- ){2,} # Group repeated at least twice
- [ ]* # Trailing spaces
- $ # End of line.
- ", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
-
- ///
- /// Turn Markdown horizontal rules into HTML hr tags
- ///
- ///
- /// ***
- /// * * *
- /// ---
- /// - - -
- ///
- private string DoHorizontalRules(string text)
- {
- return _horizontalRules.Replace(text, "
- /// Turn Markdown lists into HTML ul and ol and li tags
- ///
- private string DoLists(string text, bool isInsideParagraphlessListItem = false)
- {
- // We use a different prefix before nested lists than top-level lists.
- // See extended comment in _ProcessListItems().
- if (_listLevel > 0)
- text = _listNested.Replace(text, GetListEvaluator(isInsideParagraphlessListItem));
- else
- text = _listTopLevel.Replace(text, GetListEvaluator(false));
-
- return text;
- }
-
- private MatchEvaluator GetListEvaluator(bool isInsideParagraphlessListItem = false)
- {
- return new MatchEvaluator(match =>
- {
- string list = match.Groups[1].Value;
- string marker = match.Groups[3].Value;
- string listType = Regex.IsMatch(marker, _markerUL) ? "ul" : "ol";
- string result;
- string start = "";
- if (listType == "ol")
- {
- var firstNumber = int.Parse(marker.Substring(0, marker.Length - 1));
- if (firstNumber != 1 && firstNumber != 0)
- start = " start=\"" + firstNumber + "\"";
- }
-
- result = ProcessListItems(list, listType == "ul" ? _markerUL : _markerOL, isInsideParagraphlessListItem);
-
- result = string.Format("<{0}{1}>\n{2}{0}>\n", listType, start, result);
- return result;
- });
- }
-
- ///
- /// Process the contents of a single ordered or unordered list, splitting it
- /// into individual list items.
- ///
- private string ProcessListItems(string list, string marker, bool isInsideParagraphlessListItem = false)
- {
- // The listLevel global keeps track of when we're inside a list.
- // Each time we enter a list, we increment it; when we leave a list,
- // we decrement. If it's zero, we're not in a list anymore.
-
- // We do this because when we're not inside a list, we want to treat
- // something like this:
-
- // I recommend upgrading to version
- // 8. Oops, now this line is treated
- // as a sub-list.
-
- // As a single paragraph, despite the fact that the second line starts
- // with a digit-period-space sequence.
-
- // Whereas when we're inside a list (or sub-list), that line will be
- // treated as the start of a sub-list. What a kludge, huh? This is
- // an aspect of Markdown's syntax that's hard to parse perfectly
- // without resorting to mind-reading. Perhaps the solution is to
- // change the syntax rules such that sub-lists must start with a
- // starting cardinal number; e.g. "1." or "a.".
-
- _listLevel++;
-
- // Trim trailing blank lines:
- list = Regex.Replace(list, @"\n{2,}\z", "\n");
-
- string pattern = string.Format(
- @"(^[ ]*) # leading whitespace = $1
- ({0}) [ ]+ # list marker = $2
- ((?s:.+?) # list item text = $3
- (\n+))
- (?= (\z | \1 ({0}) [ ]+))", marker);
-
- bool lastItemHadADoubleNewline = false;
-
- // has to be a closure, so subsequent invocations can share the bool
- MatchEvaluator ListItemEvaluator = (Match match) =>
- {
- string item = match.Groups[3].Value;
-
- bool endsWithDoubleNewline = item.EndsWith("\n\n");
- bool containsDoubleNewline = endsWithDoubleNewline || item.Contains("\n\n");
-
- if (containsDoubleNewline || lastItemHadADoubleNewline)
- // we could correct any bad indentation here..
- item = RunBlockGamut(Outdent(item) + "\n", unhash: false);
- else
- {
- // recursion for sub-lists
- item = DoLists(Outdent(item), isInsideParagraphlessListItem: true);
- item = item.TrimEnd('\n');
- if (!isInsideParagraphlessListItem) // only the outer-most item should run this, otherwise it's run multiple times for the inner ones
- item = RunSpanGamut(item);
- }
- lastItemHadADoubleNewline = endsWithDoubleNewline;
- return string.Format("
{0}
\n", item);
- };
-
- list = Regex.Replace(list, pattern, new MatchEvaluator(ListItemEvaluator),
- RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline);
- _listLevel--;
- return list;
- }
-
- private static Regex _codeBlock = new Regex(string.Format(@"
- (?:\n\n|\A\n?)
- ( # $1 = the code block -- one or more lines, starting with a space
- (?:
- (?:[ ]{{{0}}}) # Lines must start with a tab-width of spaces
- .*\n+
- )+
- )
- ((?=^[ ]{{0,{0}}}[^ \t\n])|\Z) # Lookahead for non-space at line-start, or end of doc",
- _tabWidth), RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
-
- ///
- /// /// Turn Markdown 4-space indented code into HTML pre code blocks
- ///
- private string DoCodeBlocks(string text)
- {
- text = _codeBlock.Replace(text, new MatchEvaluator(CodeBlockEvaluator));
- return text;
- }
-
- private string CodeBlockEvaluator(Match match)
- {
- string codeBlock = match.Groups[1].Value;
-
- codeBlock = EncodeCode(Outdent(codeBlock));
- codeBlock = _newlinesLeadingTrailing.Replace(codeBlock, "");
-
- return string.Concat("\n\n
", codeBlock, "\n
\n\n");
- }
-
- private static Regex _codeSpan = new Regex(@"
- (?
- /// Turn Markdown `code spans` into HTML code tags
- ///
- private string DoCodeSpans(string text)
- {
- // * You can use multiple backticks as the delimiters if you want to
- // include literal backticks in the code span. So, this input:
- //
- // Just type ``foo `bar` baz`` at the prompt.
- //
- // Will translate to:
- //
- //
Just type foo `bar` baz at the prompt.
- //
- // There's no arbitrary limit to the number of backticks you
- // can use as delimters. If you need three consecutive backticks
- // in your code, use four for delimiters, etc.
- //
- // * You can use spaces to get literal backticks at the edges:
- //
- // ... type `` `bar` `` ...
- //
- // Turns to:
- //
- // ... type `bar` ...
- //
-
- return _codeSpan.Replace(text, new MatchEvaluator(CodeSpanEvaluator));
- }
-
- private string CodeSpanEvaluator(Match match)
- {
- string span = match.Groups[2].Value;
- span = Regex.Replace(span, @"^[ ]*", ""); // leading whitespace
- span = Regex.Replace(span, @"[ ]*$", ""); // trailing whitespace
- span = EncodeCode(span);
- span = SaveFromAutoLinking(span); // to prevent auto-linking. Not necessary in code *blocks*, but in code spans.
-
- return string.Concat("", span, "");
- }
-
- private static Regex _bold = new Regex(@"(\*\*|__) (?=\S) (.+?[*_]*) (?<=\S) \1",
- RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled);
- private static Regex _semiStrictBold = new Regex(@"(?=.[*_]|[*_])(^|(?=\W__|(?!\*)[\W_]\*\*|\w\*\*\w).)(\*\*|__)(?!\2)(?=\S)((?:|.*?(?!\2).)(?=\S_|\w|\S\*\*(?:[\W_]|$)).)(?=__(?:\W|$)|\*\*(?:[^*]|$))\2",
- RegexOptions.Singleline | RegexOptions.Compiled);
- private static Regex _strictBold = new Regex(@"(^|[\W_])(?:(?!\1)|(?=^))(\*|_)\2(?=\S)(.*?\S)\2\2(?!\2)(?=[\W_]|$)",
- RegexOptions.Singleline | RegexOptions.Compiled);
-
- private static Regex _italic = new Regex(@"(\*|_) (?=\S) (.+?) (?<=\S) \1",
- RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled);
- private static Regex _semiStrictItalic = new Regex(@"(?=.[*_]|[*_])(^|(?=\W_|(?!\*)(?:[\W_]\*|\D\*(?=\w)\D)).)(\*|_)(?!\2\2\2)(?=\S)((?:(?!\2).)*?(?=[^\s_]_|(?=\w)\D\*\D|[^\s*]\*(?:[\W_]|$)).)(?=_(?:\W|$)|\*(?:[^*]|$))\2",
- RegexOptions.Singleline | RegexOptions.Compiled);
- private static Regex _strictItalic = new Regex(@"(^|[\W_])(?:(?!\1)|(?=^))(\*|_)(?=\S)((?:(?!\2).)*?\S)\2(?!\2)(?=[\W_]|$)",
- RegexOptions.Singleline | RegexOptions.Compiled);
-
- ///
- /// Turn Markdown *italics* and **bold** into HTML strong and em tags
- ///
- private string DoItalicsAndBold(string text)
- {
- if (!(text.Contains("*") || text.Contains("_")))
- return text;
- // must go first, then
- if (_strictBoldItalic)
- {
- if (_asteriskIntraWordEmphasis)
- {
- text = _semiStrictBold.Replace(text, "$1$3");
- text = _semiStrictItalic.Replace(text, "$1$3");
-
- }
- else
- {
- text = _strictBold.Replace(text, "$1$3");
- text = _strictItalic.Replace(text, "$1$3");
-
- }
- }
- else
- {
- text = _bold.Replace(text, "$2");
- text = _italic.Replace(text, "$2");
- }
- return text;
- }
-
- ///
- /// Turn markdown line breaks (two space at end of line) into HTML break tags
- ///
- private string DoHardBreaks(string text)
- {
- if (_autoNewlines)
- text = Regex.Replace(text, @"\n", string.Format(" [ ]? # '>' at the start of a line
- .+\n # rest of the first line
- (.+\n)* # subsequent consecutive lines
- \n* # blanks
- )+
- )", RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline | RegexOptions.Compiled);
-
- ///
- /// Turn Markdown > quoted blocks into HTML blockquote blocks
- ///
- private string DoBlockQuotes(string text)
- {
- return _blockquote.Replace(text, new MatchEvaluator(BlockQuoteEvaluator));
- }
-
- private string BlockQuoteEvaluator(Match match)
- {
- string bq = match.Groups[1].Value;
-
- bq = Regex.Replace(bq, @"^[ ]*>[ ]?", "", RegexOptions.Multiline); // trim one level of quoting
- bq = Regex.Replace(bq, @"^[ ]+$", "", RegexOptions.Multiline); // trim whitespace-only lines
- bq = RunBlockGamut(bq); // recurse
-
- bq = Regex.Replace(bq, @"^", " ", RegexOptions.Multiline);
-
- // These leading spaces screw with
content, so we need to fix that:
- bq = Regex.Replace(bq, @"(\s*