# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"```[\S\s]*?```"
test_str = ("## 使用指南 (Usage)\n\n"
"**下载使用**\n"
"```js\n"
"git clone https://github.com/BiYuqi/webpack-seed.git\n\n"
"cd webpack-seed\n\n"
"npm install\n"
"```\n\n"
"**本地开发(dev)**\n"
"```js\n"
"npm run dev\n"
"```\n\n"
"**打包(build)**\n\n"
"* 默认情况下,该配置方案假设你的应用是被部署在一个域名的根路径上例如 https://www.my-app.com/\n"
"* 如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径\n"
"* 例如,如果你的应用被部署在 https://www.my-app.com/my-app/\n"
"* 则设置 webpack的output.publicPath 为 /my-app/\n"
"* 本项目由于需要临时部署在git-pages预览 所以改配置临时改为/webpack-seed/\n"
"* 普通打包(大部分) npm run build 默认 '/'\n"
"* 该命令具体请看package.json scripts命令配置\n"
"* [配置详情](https://github.com/BiYuqi/webpack-seed/blob/master/webpack.seed.common.js#L13)\n"
"* [scripts命令配置](https://github.com/BiYuqi/webpack-seed/blob/master/package.json#L8)\n\n"
"```js\n"
"// 普通打包(大部分) npm run build publicPath默认 '/'\n"
"npm run build\n\n"
"// 打包时 npm run build:git 该命令会打包的路径会自动带上github项目地址/webpack-seed/\n"
"//(当发布环境不是服务器根路径,都可以采用该方案,只需更改路径名称即可,本项目二级路径为webpack-seed)\n"
"npm run build:git\n\n"
"```\n"
"**依赖分析**\n"
"```js\n"
"// 利用webpack-bundle-analyzer 进行代码构建分析\n\n"
"npm run analyzer\n"
"```\n\n"
"**测试**\n"
"```js\n"
"// karma mocha chai\n"
"npm run test\n"
"```\n\n"
"## 开发规范 (Standard)\n\n"
"查看[INSTRODUCTION](https://github.com/BiYuqi/webpack-seed/blob/master/INSTRODUCTION.md)\n\n"
"## 接口配置 (Api Setting)\n\n"
"查看[API/README](https://github.com/BiYuqi/webpack-seed/blob/master/src/api/README.md)\n\n"
"## 目录结构 (Source)\n\n"
"查看[INSTRODUCTION](https://github.com/BiYuqi/webpack-seed/blob/master/INSTRODUCTION.md#%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84-source)\n\n"
"## 输出目录 (Output)\n"
"[查看输出](https://github.com/BiYuqi/webpack-seed/tree/gh-pages)\n"
"* dist/\n"
"* ---html\n"
"* ---image\n"
"* ---media\n"
"* ---css\n"
"* ---js\n"
"* ---lib\n"
"* ---index.html\n\n"
"> 注意:如果有音视频等,会被打包在media目录\n\n\n"
"## TODO\n"
"- [x] 添加ejs模板,进行页面(首尾)复用, 页面功能模板渲染\n"
"- [x] mini-css-extract-plugin 提取js内引入scss文件失败, 打包后依然在js文件(已解决)\n"
"- [x] 首页页面模板未完成(单独处理打包)\n"
"- [x] 添加第三方库以链接的方式引入\n"
"- [x] 增加ESLint代码校验\n"
"- [x] 增加两个文件夹,一个是fix IE兼容, 一个是引入的公用库,自动加载第三方库到页面,避免手动填写\n"
"- [x] 增加网站未登录的模板(无header,footer)\n"
"- [x] 添加多样化layout模板支持(示例layout/layoutAuth)\n"
"- [x] 搭建单元测试环境(基于karma mocha chai)\n"
"- [x] 单独抽离配置文件webpack.seed.common.js\n"
"- [ ] 待完善测试用例编写\n"
"- [ ] 添加doc使用说明以及实现思路解析\n\n"
"## DOING\n"
"- [ ] 添加doc使用说明以及实现思路解析\n\n"
"## LONG TODO(Base on master)\n"
"- [ ] 搭建国际化版本\n"
"- [ ] 建立分支web-system (后台管理系统模板)\n"
"- [ ] 添加完整网站demo示例\n"
"- [ ] 大众网站模板\n"
"- [ ] web-mobile(移动端模板)\n\n"
"## 更新日志 (Update log)\n\n"
"查看[CHANGELOG](https://github.com/BiYuqi/webpack-seed/blob/master/CHANGELOG.md)\n\n"
"> 本项目目前接口(使用axios只能支持到IE10+), 项目本身支持IE9+\n\n"
"## 贡献代码\n"
"* 先 Fork (https://github.com/BiYuqi/webpack-seed/fork)\n"
"* 创建分支 (git checkout -b your-idea)\n"
"* 提交更改 (git commit -am 'Fixed something')\n"
"* 推送更改 (git push origin your-idea)\n"
"* 创建一个 Pull Request\n\n"
"> [Pull Request使用](http://www.ruanyifeng.com/blog/2017/07/pull_request.html)\n\n"
"## 参考(Thanks)\n\n"
"本脚手架开发中,ejs模板渲染实现这块参考了[webpack-seed](https://github.com/Array-Huang/webpack-seed), 特此备注")
matches = re.finditer(regex, test_str)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html