mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-18 10:34:35 +03:00
Remove Github Actions scripts and workflow.
This commit is contained in:
29
.github/workflows/main.yml
vendored
29
.github/workflows/main.yml
vendored
@@ -1,29 +0,0 @@
|
|||||||
name: auto-generate-readme
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
pull_request:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
auto-generate-readme:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
ref: ${{github.event.pull_request.head.ref}}
|
|
||||||
repository: ${{github.event.pull_request.head.repo.full_name}}
|
|
||||||
- name: Install Python3
|
|
||||||
uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: '3.7'
|
|
||||||
- name: Update README
|
|
||||||
run: python auto-generate-readme.py
|
|
||||||
- name: Commit
|
|
||||||
run: |
|
|
||||||
git config --global user.name 'Github Action Bot'
|
|
||||||
git config --global user.email 'bot@example.com'
|
|
||||||
git add -u .
|
|
||||||
git commit -m 'Update README' || echo "No changes to commit"
|
|
||||||
git push origin || echo "No changes to push"
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
class MarkdownParser():
|
|
||||||
|
|
||||||
def __init__(self, text):
|
|
||||||
self.text = text
|
|
||||||
self.lines = text.split('\n')
|
|
||||||
|
|
||||||
def title(self):
|
|
||||||
return self.lines[0].split(' ')[1]
|
|
||||||
|
|
||||||
def header(self, name, level, include_header=False):
|
|
||||||
start = False
|
|
||||||
end = False
|
|
||||||
content = []
|
|
||||||
mark = '#' * level
|
|
||||||
for line in self.lines:
|
|
||||||
if start and not end:
|
|
||||||
end |= (f'{mark} ' in line[:(level + 1)]) and (not f'{mark} {name}' in line)
|
|
||||||
if end:
|
|
||||||
start = False
|
|
||||||
else:
|
|
||||||
content.append(line)
|
|
||||||
else:
|
|
||||||
start = (f'{mark} {name}' in line)
|
|
||||||
if start:
|
|
||||||
end = False
|
|
||||||
if include_header:
|
|
||||||
content.append(line)
|
|
||||||
|
|
||||||
content = '\n'.join(content)
|
|
||||||
return content
|
|
||||||
|
|
||||||
def overview(self):
|
|
||||||
overview = self.header('Overview', 2)
|
|
||||||
overview = overview.split('\n')
|
|
||||||
overview = '\n'.join(overview[1:]) # remove the first line
|
|
||||||
return overview
|
|
||||||
|
|
||||||
def features(self):
|
|
||||||
return self.header('C++', 2, True)
|
|
||||||
|
|
||||||
|
|
||||||
def combine(text, parsers):
|
|
||||||
overview = ''
|
|
||||||
features = ''
|
|
||||||
title = ''
|
|
||||||
for p in parsers:
|
|
||||||
title += p.title().replace('C++', '') + '/'
|
|
||||||
overview += p.overview() + '\n'
|
|
||||||
features += p.features() + '\n'
|
|
||||||
|
|
||||||
title = title[:-1]
|
|
||||||
overview = overview.replace('README.md#', '#')
|
|
||||||
features = features.replace('README.md#', '#')
|
|
||||||
|
|
||||||
text = text.replace('# C++\n', f'# C++{title}\n')
|
|
||||||
text = text.replace(f'<!-- overview -->', overview)
|
|
||||||
text = text.replace(f'<!-- features -->', features)
|
|
||||||
|
|
||||||
return text
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
src_dir = Path(__file__).parent
|
|
||||||
parsers = []
|
|
||||||
|
|
||||||
srcs = list(src_dir.glob('CPP*.md'))
|
|
||||||
srcs.sort(reverse=True)
|
|
||||||
for file in srcs:
|
|
||||||
with open(file, 'r') as fp:
|
|
||||||
text = fp.read()
|
|
||||||
p = MarkdownParser(text)
|
|
||||||
parsers.append(p)
|
|
||||||
|
|
||||||
template_file = src_dir / 'readme-template.md'
|
|
||||||
with open(template_file, 'r') as fp:
|
|
||||||
text = fp.read()
|
|
||||||
|
|
||||||
text = combine(text, parsers)
|
|
||||||
|
|
||||||
readme_file = src_dir / 'README.md'
|
|
||||||
with open(readme_file, 'w') as fp:
|
|
||||||
fp.write(text)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
# C++
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
<!-- overview -->
|
|
||||||
|
|
||||||
<!-- features -->
|
|
||||||
|
|
||||||
## Acknowledgements
|
|
||||||
* [cppreference](http://en.cppreference.com/w/cpp) - especially useful for finding examples and documentation of new library features.
|
|
||||||
* [C++ Rvalue References Explained](http://thbecker.net/articles/rvalue_references/section_01.html) - a great introduction I used to understand rvalue references, perfect forwarding, and move semantics.
|
|
||||||
* [clang](http://clang.llvm.org/cxx_status.html) and [gcc](https://gcc.gnu.org/projects/cxx-status.html)'s standards support pages. Also included here are the proposals for language/library features that I used to help find a description of, what it's meant to fix, and some examples.
|
|
||||||
* [Compiler explorer](https://godbolt.org/)
|
|
||||||
* [Scott Meyers' Effective Modern C++](https://www.amazon.com/Effective-Modern-Specific-Ways-Improve/dp/1491903996) - highly recommended series of books!
|
|
||||||
* [Jason Turner's C++ Weekly](https://www.youtube.com/channel/UCxHAlbZQNFU2LgEtiqd2Maw) - nice collection of C++-related videos.
|
|
||||||
* [What can I do with a moved-from object?](http://stackoverflow.com/questions/7027523/what-can-i-do-with-a-moved-from-object)
|
|
||||||
* [What are some uses of decltype(auto)?](http://stackoverflow.com/questions/24109737/what-are-some-uses-of-decltypeauto)
|
|
||||||
|
|
||||||
## Author
|
|
||||||
Anthony Calandra
|
|
||||||
|
|
||||||
## Content Contributors
|
|
||||||
See: https://github.com/AnthonyCalandra/modern-cpp-features/graphs/contributors
|
|
||||||
|
|
||||||
## License
|
|
||||||
MIT
|
|
||||||
Reference in New Issue
Block a user